diff --git a/Sln.Iot.Business/IotEnvBusiness.cs b/Sln.Iot.Business/IotEnvBusiness.cs
index fa0c86e..3d95281 100644
--- a/Sln.Iot.Business/IotEnvBusiness.cs
+++ b/Sln.Iot.Business/IotEnvBusiness.cs
@@ -56,6 +56,8 @@ namespace Sln.Iot.Business
private readonly IBaseAlarmRuleService _alarmRuleService;
private readonly WebSocketBusiness _webSocket;
+
+ private readonly StringChange _stringChange;
private readonly TcpServer _tcpServer;
@@ -66,6 +68,7 @@ namespace Sln.Iot.Business
IBaseAlarmRuleService alarmRuleService, WebSocketBusiness webSocket, TcpServer tcpServer
, IBaseMonitorInfoService monitorInfoService) : base(logger, appConfig, stringChange)
{
+ _stringChange = stringChange;
_service = service;
_alarmRuleService = alarmRuleService;
_webSocket = webSocket;
@@ -461,7 +464,7 @@ namespace Sln.Iot.Business
MonitorAlarmDto monitorAlarmDto = new MonitorAlarmDto()
{
- monitorId = item.monitorId,
+ monitorId = _stringChange.ParseToInt(_stringChange.TransformString(item.monitorId)),
isFlag = ruleRes.Count() > 0 ? 1 : 0,
deviceParam = item,
alarmRules = ruleRes,
diff --git a/Sln.Iot.Common/StringChange.cs b/Sln.Iot.Common/StringChange.cs
index 962a0b9..6c366b4 100644
--- a/Sln.Iot.Common/StringChange.cs
+++ b/Sln.Iot.Common/StringChange.cs
@@ -316,5 +316,14 @@ namespace Sln.Iot.Common
}
return BitConverter.GetBytes(Convert.ToUInt16(iVerify));
}
+
+ public string TransformString(string input)
+ {
+ if (string.IsNullOrEmpty(input))
+ return input;
+
+ // 先将 E 替换为 9,再移除下划线
+ return input.Replace('E', '9').Replace("_", "");
+ }
}
}
\ No newline at end of file
diff --git a/Sln.Iot.Model/dto/MonitorAlarmDto.cs b/Sln.Iot.Model/dto/MonitorAlarmDto.cs
index fa1dd05..6325eb0 100644
--- a/Sln.Iot.Model/dto/MonitorAlarmDto.cs
+++ b/Sln.Iot.Model/dto/MonitorAlarmDto.cs
@@ -13,7 +13,7 @@ namespace Sln.Iot.Model.dto
///
/// 设备编号
///
- public string monitorId { get;set; }
+ public long monitorId { get;set; }
///
/// 是否报警:1-是;0-否
diff --git a/Sln.Iot.Serial/SerialExtensions.cs b/Sln.Iot.Serial/SerialExtensions.cs
index 1fca02f..d26f38b 100644
--- a/Sln.Iot.Serial/SerialExtensions.cs
+++ b/Sln.Iot.Serial/SerialExtensions.cs
@@ -29,7 +29,8 @@ namespace Sln.Iot.Serial
IBaseAlarmRuleService _alarmRuleService = service.GetService();
WebSocketBusiness webSocket = service.GetService();
-
+
+
var logger = service.GetService();
try
{
@@ -108,7 +109,7 @@ namespace Sln.Iot.Serial
logger.Info($"物联网数据保存{(inRes ? "成功" : "失败")}");
- ParamAlarmFilter(iotEnvInstants,_alarmRuleService,logger, webSocket);
+ ParamAlarmFilter(iotEnvInstants,_alarmRuleService,logger, webSocket,stringChange);
}
catch (Exception ex)
{
@@ -127,7 +128,7 @@ namespace Sln.Iot.Serial
}
}
- private static void ParamAlarmFilter(List iotEnvInstants, IBaseAlarmRuleService _alarmRuleService, SerilogHelper _logger, WebSocketBusiness _webSocket)
+ private static void ParamAlarmFilter(List iotEnvInstants, IBaseAlarmRuleService _alarmRuleService, SerilogHelper _logger, WebSocketBusiness _webSocket,StringChange stringChange)
{
if (iotEnvInstants == null)
{
@@ -178,9 +179,10 @@ namespace Sln.Iot.Serial
}
}
+
MonitorAlarmDto monitorAlarmDto = new MonitorAlarmDto()
{
- monitorId = item.monitorId,
+ monitorId = stringChange.ParseToInt(stringChange.TransformString(item.monitorId)),
isFlag = ruleRes.Count() > 0 ? 1 : 0,
deviceParam = item,
alarmRules = ruleRes,