fix:测试问题修复,ph值。
This commit is contained in:
@@ -2089,41 +2089,33 @@ public class DeviceDataHandler {
|
|||||||
sensorData.setDeviceName(deviceName);
|
sensorData.setDeviceName(deviceName);
|
||||||
|
|
||||||
// 解析传感器数据(根据实际字段映射)
|
// 解析传感器数据(根据实际字段映射)
|
||||||
// 支持小写和驼峰命名两种格式
|
if (params.containsKey("dissolvedOxygen")) {
|
||||||
if (params.containsKey("dissolvedoxygen") || params.containsKey("dissolvedOxygen")) {
|
Double value = params.getDouble("dissolvedOxygen");
|
||||||
Double value = params.containsKey("dissolvedOxygen") ?
|
|
||||||
params.getDouble("dissolvedOxygen") : params.getDouble("dissolvedoxygen");
|
|
||||||
sensorData.setDissolvedOxygen(value);
|
sensorData.setDissolvedOxygen(value);
|
||||||
}
|
}
|
||||||
if (params.containsKey("temperature")) {
|
|
||||||
sensorData.setTemperature(params.getDouble("temperature"));
|
|
||||||
}
|
|
||||||
if (params.containsKey("currentTemperature")) {
|
if (params.containsKey("currentTemperature")) {
|
||||||
sensorData.setTemperature(params.getDouble("currentTemperature"));
|
sensorData.setTemperature(params.getDouble("currentTemperature"));
|
||||||
}
|
}
|
||||||
if (params.containsKey("saturability") || params.containsKey("dosat")) {
|
if (params.containsKey("dosat")) {
|
||||||
Double value = params.containsKey("dosat") ?
|
Double value = params.getDouble("dosat") ;
|
||||||
params.getDouble("dosat") : params.getDouble("saturability");
|
|
||||||
sensorData.setSaturability(value);
|
sensorData.setSaturability(value);
|
||||||
}
|
}
|
||||||
if (params.containsKey("ph")) {
|
if (params.containsKey("PH")) {
|
||||||
sensorData.setPh(params.getDouble("ph"));
|
sensorData.setPh(params.getDouble("PH"));
|
||||||
}
|
}
|
||||||
if (params.containsKey("salinity")) {
|
if (params.containsKey("salinity")) {
|
||||||
sensorData.setSalinity(params.getDouble("salinity"));
|
sensorData.setSalinity(params.getDouble("salinity"));
|
||||||
}
|
}
|
||||||
if (params.containsKey("treference") || params.containsKey("Treference")) {
|
if (params.containsKey("Treference")) {
|
||||||
Double value = params.containsKey("Treference") ?
|
Double value = params.getDouble("Treference");
|
||||||
params.getDouble("Treference") : params.getDouble("treference");
|
|
||||||
sensorData.setTreference(value);
|
sensorData.setTreference(value);
|
||||||
}
|
}
|
||||||
if (params.containsKey("tfluorescence") || params.containsKey("Tfluorescence")) {
|
if (params.containsKey("Tfluorescence")) {
|
||||||
Double value = params.containsKey("Tfluorescence") ?
|
Double value = params.getDouble("Tfluorescence");
|
||||||
params.getDouble("Tfluorescence") : params.getDouble("tfluorescence");
|
|
||||||
sensorData.setTfluorescence(value);
|
sensorData.setTfluorescence(value);
|
||||||
}
|
}
|
||||||
if (params.containsKey("phasedifference")) {
|
if (params.containsKey("Phasedifference")) {
|
||||||
sensorData.setPhaseDifference(params.getDouble("phasedifference"));
|
sensorData.setPhaseDifference(params.getDouble("Phasedifference"));
|
||||||
}
|
}
|
||||||
if (params.containsKey("battery")) {
|
if (params.containsKey("battery")) {
|
||||||
sensorData.setBattery(params.getDouble("battery"));
|
sensorData.setBattery(params.getDouble("battery"));
|
||||||
|
|||||||
@@ -115,4 +115,16 @@ public interface AquWarnCallNoticeMapper extends BaseMapper<AquWarnCallNotice> {
|
|||||||
"INNER JOIN aqu_map_message_warn_call_notice m ON m.message_warn_id = w.id " +
|
"INNER JOIN aqu_map_message_warn_call_notice m ON m.message_warn_id = w.id " +
|
||||||
"WHERE m.call_notice_id = #{callNoticeId} LIMIT 1")
|
"WHERE m.call_notice_id = #{callNoticeId} LIMIT 1")
|
||||||
String selectWarnMessageByCallNoticeId(@Param("callNoticeId") Long callNoticeId);
|
String selectWarnMessageByCallNoticeId(@Param("callNoticeId") Long callNoticeId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过 callNoticeId 查询关联的第一条告警消息标题(title)
|
||||||
|
* 用于定时任务重发时作为 TTS warnMessage 参数,避免将完整消息内容传入导致 TTS 播报异常
|
||||||
|
*
|
||||||
|
* @param callNoticeId 通知记录ID
|
||||||
|
* @return 告警标题,不存在时返回 null
|
||||||
|
*/
|
||||||
|
@Select("SELECT w.title FROM aqu_message_warn w " +
|
||||||
|
"INNER JOIN aqu_map_message_warn_call_notice m ON m.message_warn_id = w.id " +
|
||||||
|
"WHERE m.call_notice_id = #{callNoticeId} LIMIT 1")
|
||||||
|
String selectWarnTitleByCallNoticeId(@Param("callNoticeId") Long callNoticeId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,16 +254,18 @@ public class WarnCallNoticeServiceImpl implements WarnCallNoticeService {
|
|||||||
int sentCount = 0;
|
int sentCount = 0;
|
||||||
for (AquWarnCallNotice notice : pendingList) {
|
for (AquWarnCallNotice notice : pendingList) {
|
||||||
try {
|
try {
|
||||||
// 查询关联的告警消息内容,用于构建 TTS 参数
|
// 查询关联的告警标题(title),作为 TTS warnMessage 参数
|
||||||
String rawMessage = warnCallNoticeMapper.selectWarnMessageByCallNoticeId(notice.getId());
|
// 使用 title(如"设备离线"、"溶解氧")而非完整 message,避免长字符串被 TTS 逐字播报
|
||||||
String warnMessageShort = parseWarnMessageShort(rawMessage);
|
String warnTitle = warnCallNoticeMapper.selectWarnTitleByCallNoticeId(notice.getId());
|
||||||
|
String warnMessageShort = (warnTitle != null && !warnTitle.isEmpty()) ? warnTitle : "异常";
|
||||||
|
|
||||||
// 通过 deviceId 查询设备名称
|
// 通过 deviceId 查询设备名称
|
||||||
|
// 注意:不使用 serialNum 作为 fallback,避免数字序列号被 TTS 逐位播报
|
||||||
String deviceName = null;
|
String deviceName = null;
|
||||||
if (notice.getDeviceId() != null) {
|
if (notice.getDeviceId() != null) {
|
||||||
Device device = deviceMapper.selectById(notice.getDeviceId());
|
Device device = deviceMapper.selectById(notice.getDeviceId());
|
||||||
if (device != null) {
|
if (device != null && device.getDeviceName() != null && !device.getDeviceName().isEmpty()) {
|
||||||
deviceName = device.getDeviceName() != null ? device.getDeviceName() : device.getSerialNum();
|
deviceName = device.getDeviceName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user