From 7fb85c72d7d1d10c962ebdc752bce66d6fca86aa Mon Sep 17 00:00:00 2001 From: "jay.chang" Date: Fri, 30 Aug 2024 16:51:10 +0800 Subject: [PATCH] =?UTF-8?q?[BGService]=E4=BF=AE=E6=94=B9=E7=B7=8A=E6=80=A5?= =?UTF-8?q?=E6=87=89=E8=AE=8A=E7=B4=80=E9=8C=84=E7=9A=84=E7=9B=B8=E9=97=9C?= =?UTF-8?q?=E9=82=8F=E8=BC=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BackendWorkerService/Quartz/Jobs/EmergencyRecordJob.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BackendWorkerService/Quartz/Jobs/EmergencyRecordJob.cs b/BackendWorkerService/Quartz/Jobs/EmergencyRecordJob.cs index db01740..b06eb72 100644 --- a/BackendWorkerService/Quartz/Jobs/EmergencyRecordJob.cs +++ b/BackendWorkerService/Quartz/Jobs/EmergencyRecordJob.cs @@ -88,7 +88,8 @@ namespace BackendWorkerService.Quartz.Jobs foreach (var obj in filteredObjs) { - var newguid = Guid.NewGuid(); + var guid = obj.Descendants().Where(d => d.Name.LocalName == "str" && d.Attribute("name").Value == "niagara-uuid"). + Select(x => x.Attribute("val").Value).FirstOrDefault(); var alarm_timestamp = obj.Descendants().Where(d => d.Name.LocalName == "abstime" && d.Attribute("name").Value == "timestamp") .Select(d => { @@ -110,7 +111,7 @@ namespace BackendWorkerService.Quartz.Jobs var dictionary = new Dictionary() { - {"@emergency_event_guid",newguid}, + {"@emergency_event_guid",guid}, {"@disaster",filterDevice.device_system_value}, {"@building_tag", filterDevice.device_building_tag}, {"@device_guid",filterDevice.device_guid }, @@ -120,7 +121,7 @@ namespace BackendWorkerService.Quartz.Jobs dictionaryList.Add(dictionary); } - + // 之前以為沒有唯一識別碼(uuid),故該table有設置一個以device_guid跟alarm_time的unique替代 var mergeSql = @" INSERT INTO emergency_event (emergency_event_guid, disaster, device_guid, building_tag, type, alarm_time)