diff --git a/intc-modules/intc-iot/src/main/java/com/intc/iot/service/impl/WarnCallNoticeServiceImpl.java b/intc-modules/intc-iot/src/main/java/com/intc/iot/service/impl/WarnCallNoticeServiceImpl.java index 4f58d00..833fea6 100644 --- a/intc-modules/intc-iot/src/main/java/com/intc/iot/service/impl/WarnCallNoticeServiceImpl.java +++ b/intc-modules/intc-iot/src/main/java/com/intc/iot/service/impl/WarnCallNoticeServiceImpl.java @@ -2,6 +2,8 @@ package com.intc.iot.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.intc.fishery.domain.Device; +import com.intc.fishery.mapper.DeviceMapper; import com.intc.iot.domain.AquWarnCallNotice; import com.intc.iot.domain.VmsCallback; import com.intc.iot.domain.VmsNoticeResponse; @@ -35,6 +37,7 @@ public class WarnCallNoticeServiceImpl implements WarnCallNoticeService { private final AquWarnCallNoticeMapper warnCallNoticeMapper; private final VmsCallbackMapper vmsCallbackMapper; private final VmsNoticeService vmsNoticeService; + private final DeviceMapper deviceMapper; /** * 呼叫状态枚举(对应 C# EnumCallNoticeStatus) @@ -255,10 +258,19 @@ public class WarnCallNoticeServiceImpl implements WarnCallNoticeService { String rawMessage = warnCallNoticeMapper.selectWarnMessageByCallNoticeId(notice.getId()); String warnMessageShort = parseWarnMessageShort(rawMessage); + // 通过 deviceId 查询设备名称 + String deviceName = null; + if (notice.getDeviceId() != null) { + Device device = deviceMapper.selectById(notice.getDeviceId()); + if (device != null) { + deviceName = device.getDeviceName() != null ? device.getDeviceName() : device.getSerialNum(); + } + } + // 构建 TTS 参数 Map ttsParams = new HashMap<>(); ttsParams.put("pondName", notice.getPondName() != null ? notice.getPondName() : "未知塘口"); - ttsParams.put("deviceName", "设备"); + ttsParams.put("deviceName", deviceName != null ? deviceName : "未知设备"); ttsParams.put("warnMessage", warnMessageShort); String outId = "ALARM_" + notice.getId() + "_" + System.currentTimeMillis();