Commit 967d2149 authored by 刘林's avatar 刘林

fix(equip):江西数据中心字段值修改

parent 73211926
...@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection; import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import com.yeejoin.amos.feign.systemctl.model.MessageModel; import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm; import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm;
...@@ -29,9 +28,7 @@ import com.yeejoin.equipmanage.quartz.QuartzManager; ...@@ -29,9 +28,7 @@ import com.yeejoin.equipmanage.quartz.QuartzManager;
import com.yeejoin.equipmanage.remote.RemoteSecurityService; import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import com.yeejoin.equipmanage.utils.BeanUtil; import com.yeejoin.equipmanage.utils.BeanUtil;
import javafx.scene.control.Tab;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -52,7 +49,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -52,7 +49,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -384,22 +380,22 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -384,22 +380,22 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
JSONObject jsonObject = JSONObject.parseObject(message); JSONObject jsonObject = JSONObject.parseObject(message);
String dataType = jsonObject.getString("datatype"); String dataType = jsonObject.getString("datatype");
String indexAddress,value,timeStamp,quality = null; String indexAddress, value, timeStamp, quality = null;
//如果消息是遥信类型,进行指标转换 //如果消息是遥信类型,进行指标转换
if(dataType != null && dataType.equals("state")){ if (dataType != null && dataType.equals("state")) {
indexAddress = jsonObject.getString("scadaid"); indexAddress = jsonObject.getString("scadaid");
value = jsonObject.getInteger("value") ==1 ? "true":"false"; value = jsonObject.getInteger("value") == 1 ? "true" : "false";
timeStamp = jsonObject.getString("timestamp"); timeStamp = jsonObject.getString("timestamp");
}else{ } else {
indexAddress = jsonObject.getString("key"); indexAddress = jsonObject.getString("key");
value = jsonObject.getString("value"); value = jsonObject.getString("value");
timeStamp = jsonObject.getString("time_stamp"); timeStamp = jsonObject.getString("time_stamp");
quality = jsonObject.getString("quality"); quality = jsonObject.getString("quality");
} }
EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByIndexAddress(indexAddress,null); EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByIndexAddress(indexAddress, null);
if (equipmentSpeIndex == null){ if (equipmentSpeIndex == null) {
return; return;
} }
equipmentSpeIndex.setValue(value); equipmentSpeIndex.setValue(value);
...@@ -636,7 +632,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -636,7 +632,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
//influxdb //influxdb
Map<String, String> tagsMap = new HashMap<>(); Map<String, String> tagsMap = new HashMap<>();
Map<String, Object> fieldsMap = new HashMap<>(); Map<String, Object> fieldsMap = new HashMap<>();
Map<String, Object> fieldsStrMap = new HashMap<>();
log.info("接收到iot消息: {}", message); log.info("接收到iot消息: {}", message);
TopicEntityVo topicEntity = new TopicEntityVo(); TopicEntityVo topicEntity = new TopicEntityVo();
...@@ -652,11 +647,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -652,11 +647,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
String traceId = jsonObject.getString("traceId"); String traceId = jsonObject.getString("traceId");
String deviceCode = jsonObject.getString("deviceCode"); String deviceCode = jsonObject.getString("deviceCode");
String gatewayId = jsonObject.getString("gatewayId"); String gatewayId = jsonObject.getString("gatewayId");
String value=jsonObject.getString("value"); String value = jsonObject.getString("value");
EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByIndexAddress(indexAddress,gatewayId); EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByIndexAddress(indexAddress, gatewayId);
if (equipmentSpeIndex == null){ if (equipmentSpeIndex == null) {
return; return;
} }
...@@ -671,21 +666,25 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -671,21 +666,25 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
//更新装备性能指标 //更新装备性能指标
//equipmentSpecificIndexService.updateById(equipmentSpeIndex); //equipmentSpecificIndexService.updateById(equipmentSpeIndex);
tagsMap.put("key", indexAddress+"_"+gatewayId); tagsMap.put("key", indexAddress + "_" + gatewayId);
String valueLabel = valueTranslate(value, equipmentSpeIndex.getValueEnum());
fieldsMap.put("traceId", traceId); fieldsMap.put("traceId", traceId);
fieldsMap.put("address", indexAddress); fieldsMap.put("address", indexAddress);
fieldsMap.put("value", value); fieldsMap.put("value", value);
fieldsMap.put("valueLabel", valueLabel.equals("") ? value : valueLabel);
fieldsMap.put("gatewayId", gatewayId); fieldsMap.put("gatewayId", gatewayId);
fieldsMap.put("dataType", dataType); fieldsMap.put("dataType", dataType);
fieldsMap.put("equipmentId", equipmentSpeIndex.getEquipmentId()); fieldsMap.put("equipmentId", equipmentSpeIndex.getEquipmentId());
fieldsMap.put("equipmentIndexName", equipmentSpeIndex.getEquipmentIndexName()); fieldsMap.put("equipmentIndexName", equipmentSpeIndex.getEquipmentIndexName());
fieldsMap.put("equipmentIndexKey", equipmentSpeIndex.getEquipmentIndexKey()); fieldsMap.put("equipmentIndexKey", equipmentSpeIndex.getEquipmentIndexKey());
fieldsMap.put("isAlarm", equipmentSpeIndex.getIsAlarm().toString()); fieldsMap.put("isAlarm", equipmentSpeIndex.getIsAlarm().toString());
fieldsMap.put("unit", equipmentSpeIndex.getIndexUnitName());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
fieldsMap.put("createdTime", simpleDateFormat.format(new Date())); fieldsMap.put("createdTime", simpleDateFormat.format(new Date()));
fieldsMap.put("equipmentIndex", JSON.toJSONString(equipmentSpeIndex)); fieldsMap.put("equipmentIndex", JSON.toJSONString(equipmentSpeIndex));
//保存influxDB库
influxDbConnection.insert("iot_data", tagsMap, fieldsMap); influxDbConnection.insert("iot_data", tagsMap, fieldsMap);
QueryWrapper<EquipmentSpecific> queryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentSpecific> queryWrapper = new QueryWrapper<>();
...@@ -951,8 +950,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -951,8 +950,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
} else { } else {
//恢复后修改 wl_equip_qrcode_record中对应记录 //恢复后修改 wl_equip_qrcode_record中对应记录
LambdaQueryWrapper<EquipQrcodeRecord> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EquipQrcodeRecord> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EquipQrcodeRecord::getEquipid,action.getEquipmentSpecificId()); wrapper.eq(EquipQrcodeRecord::getEquipid, action.getEquipmentSpecificId());
wrapper.eq(EquipQrcodeRecord::getSourceId,action.getId()); wrapper.eq(EquipQrcodeRecord::getSourceId, action.getId());
EquipQrcodeRecord equipQrcodeRecord = equipQrcodeRecordMapper.selectOne(wrapper); EquipQrcodeRecord equipQrcodeRecord = equipQrcodeRecordMapper.selectOne(wrapper);
equipQrcodeRecord.setCleanTime(new Date()); equipQrcodeRecord.setCleanTime(new Date());
equipQrcodeRecordMapper.updateById(equipQrcodeRecord); equipQrcodeRecordMapper.updateById(equipQrcodeRecord);
...@@ -965,12 +964,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -965,12 +964,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
bool = Boolean.TRUE; bool = Boolean.TRUE;
LambdaQueryWrapper<EquipQrcodeRecord> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EquipQrcodeRecord> query = new LambdaQueryWrapper<>();
query.eq(EquipQrcodeRecord::getEquipid,action.getEquipmentSpecificId()); query.eq(EquipQrcodeRecord::getEquipid, action.getEquipmentSpecificId());
query.isNull(EquipQrcodeRecord::getCleanTime); query.isNull(EquipQrcodeRecord::getCleanTime);
List<EquipQrcodeRecord> equipQrcodeRecords = equipQrcodeRecordMapper.selectList(query); List<EquipQrcodeRecord> equipQrcodeRecords = equipQrcodeRecordMapper.selectList(query);
if (equipQrcodeRecords.size() > 0){ //如果记录表中还存在未消除的巡检故障 则先修改为黄码 if (equipQrcodeRecords.size() > 0) { //如果记录表中还存在未消除的巡检故障 则先修改为黄码
iEquipmentSpecificSerivce.updateEquipSpecificStatus(equipQrcodeRecords.get(0).getStatus(), String.valueOf(specific.getId())); iEquipmentSpecificSerivce.updateEquipSpecificStatus(equipQrcodeRecords.get(0).getStatus(), String.valueOf(specific.getId()));
}else { } else {
iEquipmentSpecificSerivce.updateEquipSpecificStatus(specific.getEquipStatus(), String.valueOf(specific.getId())); iEquipmentSpecificSerivce.updateEquipSpecificStatus(specific.getEquipStatus(), String.valueOf(specific.getId()));
} }
...@@ -987,7 +986,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -987,7 +986,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 触发风险---> 站端发送消息到Message服务 // 触发风险---> 站端发送消息到Message服务
publishDataToMessage(equipmentSpecificIndexList, isAlarm); publishDataToMessage(equipmentSpecificIndexList, isAlarm);
if("zd".equals(system)){ if ("zd".equals(system)) {
System.out.println("站端系统----------------"); System.out.println("站端系统----------------");
// 向预控系统发送消息 // 向预控系统发送消息
...@@ -1011,39 +1010,39 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1011,39 +1010,39 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 向其他系统推送报警 // 向其他系统推送报警
equipmentAlarmLogsToOtherSystems(alarmLogs); equipmentAlarmLogsToOtherSystems(alarmLogs);
if(vo.getEcode()!=null){ if (vo.getEcode() != null) {
String ecode= vo.getEcode(); String ecode = vo.getEcode();
boolean flag=false; boolean flag = false;
//消防泵 //消防泵
String[] strings = pumpCodes.split(","); String[] strings = pumpCodes.split(",");
for (String string : strings) { for (String string : strings) {
if(ecode.startsWith(string)){ if (ecode.startsWith(string)) {
//通知>消防应急预案 //通知>消防应急预案
topicEntity.setType("xfb"); topicEntity.setType("xfb");
mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity)); mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity));
flag=true; flag = true;
break; break;
} }
} }
// 消防炮 // 消防炮
String[] stringxfp = monitorCodes.split(","); String[] stringxfp = monitorCodes.split(",");
if(!flag){ if (!flag) {
for (String string1 : stringxfp) { for (String string1 : stringxfp) {
if(ecode.startsWith(string1)){ if (ecode.startsWith(string1)) {
//通知>消防应急预案 //通知>消防应急预案
topicEntity.setType("xfp"); topicEntity.setType("xfp");
mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity)); mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity));
flag=true; flag = true;
break; break;
} }
} }
} }
//消防水源 //消防水源
if(!flag){ if (!flag) {
List<Map> lit= iEquipmentSpecificSerivce.getWater(vo.getId()); List<Map> lit = iEquipmentSpecificSerivce.getWater(vo.getId());
if(lit!=null&& lit.size()>0){ if (lit != null && lit.size() > 0) {
topicEntity.setType("xfsy"); topicEntity.setType("xfsy");
mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity)); mqttSendGateway.sendToMqtt(emergencyDisposalIndicators, JSONObject.toJSONString(topicEntity));
} }
......
...@@ -133,8 +133,7 @@ ...@@ -133,8 +133,7 @@
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex"> resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT wesi.id AS id, SELECT wesi.id AS id,
wei.name_key AS nameKey, wei.name_key AS nameKey,
IFNULL(si.value_label, si.`value`) AS 'value', IFNULL(si.value_label, si.`value`) AS 'value', wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId, wesi.equipment_index_id AS equipmentIndexId,
wes.org_code AS code, wes.org_code AS code,
wes.iot_code AS iotCode, wes.iot_code AS iotCode,
...@@ -180,11 +179,9 @@ ...@@ -180,11 +179,9 @@
wled.id equip_detail_id, wled.id equip_detail_id,
wles.qr_code, wles.qr_code,
wles.CODE, wles.CODE,
( (select GROUP_CONCAT(fs.name)
select GROUP_CONCAT(fs.name)
from f_fire_fighting_system fs from f_fire_fighting_system fs
where FIND_IN_SET(fs.id, wles.system_id) where FIND_IN_SET(fs.id, wles.system_id)) as System_name,
) as System_name,
wlec.NAME category_name, wlec.NAME category_name,
wlws.full_name warehouse_name, wlws.full_name warehouse_name,
wled.standard, wled.standard,
...@@ -209,13 +206,11 @@ ...@@ -209,13 +206,11 @@
LEFT JOIN wl_warehouse_structure wlws ON wlsd.warehouse_structure_id = wlws.id LEFT JOIN wl_warehouse_structure wlws ON wlsd.warehouse_structure_id = wlws.id
LEFT JOIN wl_unit wlun ON wle.unit_id = wlun.id LEFT JOIN wl_unit wlun ON wle.unit_id = wlun.id
LEFT JOIN wl_manufacturer_info wlmi ON wlmi.id = wled.manufacturer_id LEFT JOIN wl_manufacturer_info wlmi ON wlmi.id = wled.manufacturer_id
LEFT JOIN ( LEFT JOIN (SELECT wlei.equipment_id,
SELECT wlei.equipment_id,
wlesi.`value` wlesi.`value`
FROM wl_equipment_index wlei FROM wl_equipment_index wlei
LEFT JOIN wl_equipment_specific_index wlesi ON wlei.id = wlesi.equipment_index_id LEFT JOIN wl_equipment_specific_index wlesi ON wlei.id = wlesi.equipment_index_id
WHERE wlei.name_key = 'runState' WHERE wlei.name_key = 'runState') wleias ON wle.id = wleias.equipment_id
) wleias ON wle.id = wleias.equipment_id
WHERE wles.id = #{id} WHERE wles.id = #{id}
</select> </select>
<select id="selectEquProperty" resultType="java.util.HashMap"> <select id="selectEquProperty" resultType="java.util.HashMap">
...@@ -480,7 +475,7 @@ ...@@ -480,7 +475,7 @@
wes.position, wes.position,
wes.name, wes.name,
we.expiry_date as weExpiry, we.expiry_date as weExpiry,
<!-- wed.expiry_date as wesExpiry,--> <!-- wed.expiry_date as wesExpiry,-->
wed.area as area, wed.area as area,
wed.production_date as product wed.production_date as product
from wl_equipment_specific wes from wl_equipment_specific wes
...@@ -532,7 +527,7 @@ ...@@ -532,7 +527,7 @@
wei.type_code AS typeCode, wei.type_code AS typeCode,
wei.type_name AS typeName, wei.type_name AS typeName,
wei.name AS indexName, wei.name AS indexName,
wei.unit AS indexUnitName, wesi.unit AS indexUnitName,
wes.org_code AS orgCode, wes.org_code AS orgCode,
ed.`name` AS equipmentSpecificName, ed.`name` AS equipmentSpecificName,
ed.equipment_name AS equipmentName, ed.equipment_name AS equipmentName,
......
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