Commit 10d8bb24 authored by litengwei's avatar litengwei

任务 11836

parent 2946ec84
...@@ -150,4 +150,13 @@ public class EquipmentSpecificIndex extends BaseEntity { ...@@ -150,4 +150,13 @@ public class EquipmentSpecificIndex extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private Integer isTrend; private Integer isTrend;
@ApiModelProperty(value = "装备系统code")
@TableField(exist = false)
private String specificCode;
@ApiModelProperty(value = "装备定义名称")
@TableField(exist = false)
private String equipmentName;
} }
...@@ -39,6 +39,7 @@ import org.springframework.util.StringUtils; ...@@ -39,6 +39,7 @@ import org.springframework.util.StringUtils;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -146,6 +147,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -146,6 +147,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value("${equipManage.name}") @Value("${equipManage.name}")
private String serverName; private String serverName;
@Value("${state.code:code}")
private String stationCode;
@Value("${state.name:name}")
private String stationName;
@Value("${mqtt.vehicle.topic}") @Value("${mqtt.vehicle.topic}")
private String carTopic; private String carTopic;
...@@ -226,6 +233,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -226,6 +233,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
} catch (MqttException e) { } catch (MqttException e) {
e.printStackTrace(); e.printStackTrace();
} }
if (!StringUtils.isEmpty(traceId)) { if (!StringUtils.isEmpty(traceId)) {
String finalTraceId = traceId; String finalTraceId = traceId;
List<IotDataVO> collect = iotDatalist.stream().map(x -> { List<IotDataVO> collect = iotDatalist.stream().map(x -> {
...@@ -309,6 +318,48 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -309,6 +318,48 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if (equipmentSpecificIndex.getIsAlarm() != null && 1 == equipmentSpecificIndex.getIsAlarm()) { if (equipmentSpecificIndex.getIsAlarm() != null && 1 == equipmentSpecificIndex.getIsAlarm()) {
equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpecificIndex)); equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpecificIndex));
} }
// 遥测遥信数据推送云端kafka
JSONObject jsonObjectXf = new JSONObject();
jsonObjectXf.put("data_class", "realdata");
// 遥测
if(equipmentSpeIndex.getIsTrend() == 1) {
jsonObjectXf.put("data_type", "analog");
} else {
jsonObjectXf.put("data_type", "state");
}
String date = DateUtils.date2LongStr(new Date());
jsonObjectXf.put("op_type", "subscribe_emergency");
JSONObject jsonObjectCondition = new JSONObject();
jsonObjectCondition.put("station_psr_id", stationCode);
jsonObjectCondition.put("station_name", stationName);
jsonObjectCondition.put("data_upload_time", date );
jsonObjectXf.put("condition",jsonObjectCondition);
JSONObject jsonObjectData = new JSONObject();
jsonObjectData.put("psrId", stationCode);
jsonObjectData.put("astId", equipmentSpecificIndex.getSpecificCode());
jsonObjectData.put("equipType", equipmentSpecificIndex.getEquipmentCode());
jsonObjectData.put("name", equipmentSpecificIndex.getEquipmentSpecificName()+"-"+equipmentSpecificIndex.getEquipmentSpecificIndexName());
if(value.equals("true")) {
jsonObjectData.put("value","1");
} else if (value.equals("false")) {
jsonObjectData.put("value","0");
} else {
jsonObjectData.put("value", value);
}
jsonObjectData.put("measurementType",equipmentSpecificIndex.getEquipmentIndexKey());
jsonObjectData.put("dateTime",date);
jsonObjectData.put("quality","0"); // 量测质量码:0 有效,1 无效
List<JSONObject> jsonObjects = Arrays.asList(jsonObjectData);
jsonObjectXf.put("data", jsonObjects);
try {
emqKeeper.getMqttClient().publish("eqm.xf.created",jsonObjectXf.toString().getBytes(),1,false);
} catch (MqttException e) {
e.printStackTrace();
}
} }
} }
}); });
......
...@@ -94,3 +94,6 @@ equipment.plan.pump=92010600,92030600,92130400,92140200,92150300 ...@@ -94,3 +94,6 @@ equipment.plan.pump=92010600,92030600,92130400,92140200,92150300
# 电力使用 # 电力使用
iot.code.prefix.have.used= iot.code.prefix.have.used=
# 站端标识
state.code=JP
state.name=NAME
\ No newline at end of file
...@@ -48,9 +48,12 @@ ...@@ -48,9 +48,12 @@
wei.unit AS indexUnitName, wei.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,
wes.iot_code AS iotCode, wes.iot_code AS iotCode,
wes.code AS specificCode,
wei.`name` AS equipmentSpecificIndexName, wei.`name` AS equipmentSpecificIndexName,
wei.`value_enum` AS valueEnum, wei.`value_enum` AS valueEnum,
wei.is_trend AS isTrend,
wes.qr_code AS qrCode, wes.qr_code AS qrCode,
wesi.update_date AS updateDate, wesi.update_date AS updateDate,
ed.code AS equipmentCode, ed.code AS equipmentCode,
......
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