diff --git a/Backend/Services/Implement/webRequestService.cs b/Backend/Services/Implement/webRequestService.cs index 2528ae5..96e0630 100644 --- a/Backend/Services/Implement/webRequestService.cs +++ b/Backend/Services/Implement/webRequestService.cs @@ -20,6 +20,7 @@ using NPOI.SS.Formula.Functions; using Microsoft.AspNetCore.Localization; using MySqlX.XDevAPI.Relational; using Backend.Models; +using NPOI.OpenXmlFormats.Dml; namespace Backend.Services.Implement { @@ -263,9 +264,12 @@ namespace Backend.Services.Implement row.parent_path = stationName; //full_name 其實是點位名稱 point_name - row.full_name = conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).Select(x => x.displayName).FirstOrDefault(); - if (conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).FirstOrDefault() != null) - conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).FirstOrDefault().isHistory = true; + var deviceNumber = tagName.Substring(0, tagName.LastIndexOf(tagName.Split("_")[5]) - 1); + var point = tagName.Split("_")[5]; + conPoint = conPoint.Where(x => x.name.Split("/").Length > 6).ToList(); + row.full_name = conPoint.Where(x => x.name.Split("/")[5] == deviceNumber && x.name.Split("/")[6] == point && !x.isHistory).Select(x => x.displayName).FirstOrDefault(); + if (conPoint.Where(x => x.name.Split("/")[5] == deviceNumber && x.name.Split("/")[6] == point && !x.isHistory).FirstOrDefault() != null) + conPoint.Where(x => x.name.Split("/")[5] == deviceNumber && x.name.Split("/")[6] == point && !x.isHistory).FirstOrDefault().isHistory = true; row.isHistory = true; result.Add(row); } diff --git a/Backend/appsettings.Development.json b/Backend/appsettings.Development.json index d9b4695..fa903a2 100644 --- a/Backend/appsettings.Development.json +++ b/Backend/appsettings.Development.json @@ -20,6 +20,7 @@ //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp "Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel + //"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office "Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Password": "FVAPxztxpY4gJJKQ/se4bQ==" } diff --git a/Backend/appsettings.json b/Backend/appsettings.json index c0ce7a5..4a53716 100644 --- a/Backend/appsettings.json +++ b/Backend/appsettings.json @@ -19,6 +19,7 @@ //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //三菱 //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp "Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome + //"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office "Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Password": "FVAPxztxpY4gJJKQ/se4bQ==" } diff --git a/FrontendWebApi/ApiControllers/AlarmRecordController.cs b/FrontendWebApi/ApiControllers/AlarmRecordController.cs index 5ef95d6..5daf8be 100644 --- a/FrontendWebApi/ApiControllers/AlarmRecordController.cs +++ b/FrontendWebApi/ApiControllers/AlarmRecordController.cs @@ -20,7 +20,7 @@ namespace FrontendWebApi.ApiControllers public class AlarmRecordController : MyBaseApiController { private readonly IFrontendRepository frontendRepository; - + public AlarmRecordController ( IFrontendRepository frontendRepository @@ -47,41 +47,41 @@ namespace FrontendWebApi.ApiControllers try { var sqlBuildingMain = $@"SELECT - b.building_guid, + b.building_tag, b.full_name AS building_name, - ms.main_system_guid, - ms.full_name AS main_system_name + v1.system_value, + v1.system_key FROM building_menu bm INNER JOIN ( SELECT - ap.building_guid, ap.ShowView + ap.building_tag, ap.ShowView FROM role_auth ra JOIN auth_page ap ON ra.AuthCode = ap.AuthCode JOIN userinfo u ON u.role_guid = ra.role_guid WHERE u.account = @Account - AND ap.building_guid IS NOT NULL - ) ap ON bm.building_guid = ap.building_guid AND bm.sub_system_guid = ap.ShowView - LEFT JOIN building b ON bm.building_guid = b.building_guid - LEFT JOIN main_system ms ON bm.main_system_guid = ms.main_system_guid - GROUP BY bm.building_guid, bm.main_system_guid - ORDER BY b.priority, ms.priority"; + AND ap.building_tag IS NOT NULL + ) ap ON bm.building_tag = ap.building_tag + LEFT JOIN building b ON bm.building_tag = b.building_tag + left join variable v2 on ap.ShowView = v2.id and v2.deleted = 0 + left join variable v1 on v2.system_parent_id = v1.id + GROUP BY b.building_tag, b.full_name, v1.system_value, v1.system_key"; var alarmRecordPanelRawDatas = await frontendRepository.GetAllAsync(sqlBuildingMain, new { Account = account }); List alarmRecordPanels = new List(); - var alarmRecordPanelRawDatas_GroupBy = alarmRecordPanelRawDatas.GroupBy(x => x.building_guid); + var alarmRecordPanelRawDatas_GroupBy = alarmRecordPanelRawDatas.GroupBy(x => x.building_tag); foreach (var building in alarmRecordPanelRawDatas_GroupBy) { AlarmRecordPanel alarmRecordPanel = new AlarmRecordPanel(); - alarmRecordPanel.building_guid = building.Key; + alarmRecordPanel.building_tag = building.Key; alarmRecordPanel.building_name = building.First().building_name; alarmRecordPanel.mainSystemPanels = new List(); foreach (var tempData in building) { MainSystemPanel mainSystemPanel = new MainSystemPanel(); - mainSystemPanel.main_system_guid = tempData.main_system_guid; - mainSystemPanel.main_system_name = tempData.main_system_name; + mainSystemPanel.system_value = tempData.system_value; + mainSystemPanel.system_key = tempData.system_key; alarmRecordPanel.mainSystemPanels.Add(mainSystemPanel); } @@ -115,31 +115,31 @@ namespace FrontendWebApi.ApiControllers try { var sql = $@"SELECT - temp_path.source AS alarm_path, - temp_msg.source_msg AS msgText, - from_unixtime(record.timestamp/1000,'%Y-%m-%d %H:%i:%s') alarm_timestamp, - record.priority, - CASE WHEN record.normalTime > 0 THEN from_unixtime(record.normalTime/1000,'%Y-%m-%d %H:%i:%s') - ELSE NULL - END AS normal_timestamp, - record.sourceState AS ackState, - class.alarmclass AS alarm_className, - record.userAccount - - FROM alarmorion_orionalarmrecord record + temp_path.source AS alarm_path, + temp_msg.source_msg AS msgText, + from_unixtime(record.timestamp/1000,'%Y-%m-%d %H:%i:%s') alarm_timestamp, + record.priority, + CASE WHEN record.normalTime > 0 THEN from_unixtime(record.normalTime/1000,'%Y-%m-%d %H:%i:%s') + ELSE NULL + END AS normal_timestamp, + record.sourceState AS ackState, + class.alarmclass AS alarm_className, + record.userAccount + + FROM alarmOrion_OrionAlarmRecord record JOIN ( - SELECT sourceorder.* ,temp_source.source - FROM alarmorion_orionalarmsourceorder sourceorder - JOIN alarmorion_orionalarmsource temp_source ON sourceorder.alarmSource = temp_source.id + SELECT sourceorder.* ,temp_source.source + FROM alarmOrion_OrionAlarmSourceOrder sourceorder + JOIN alarmOrion_OrionAlarmSource temp_source ON sourceorder.alarmSource = temp_source.id ) temp_path ON record.id = temp_path.alarm JOIN( - SELECT - val.alarm, - val.value AS source_msg - FROM alarmorion_orionalarmfacetvalue val - JOIN alarmorion_orionalarmfacetname nam ON val.facetName = nam.id AND nam.facetName = 'msgText' + SELECT + val.alarm, + val.value AS source_msg + FROM alarmOrion_OrionAlarmFacetValue val + JOIN alarmOrion_OrionAlarmFacetName nam ON val.facetName = nam.id AND nam.facetName = 'msgText' ) temp_msg ON record.id = temp_msg.alarm - JOIN alarmorion_orionalarmclass class ON record.alarmClass = class.id + JOIN alarmOrion_OrionAlarmClass class ON record.alarmClass = class.id WHERE from_unixtime(record.timestamp/1000,'%Y-%m-%d %H:%i:%s') BETWEEN @StartTimestamp AND @EndTimeStamp"; if (post.IsSolve != 0) @@ -183,8 +183,8 @@ namespace FrontendWebApi.ApiControllers var sql_device = $@"SELECT * FROM device d WHERE d.deleted = 0 - AND d.building_guid = @building_guid - AND d.main_system_guid IN @main_system_guids"; + AND d.device_building_tag = @building_tag + AND d.device_system_tag IN @main_system_tag"; var devices = await frontendRepository.GetAllAsync(sql_device, post); diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs index e0e91ec..0e73864 100644 --- a/FrontendWebApi/ApiControllers/BuildController.cs +++ b/FrontendWebApi/ApiControllers/BuildController.cs @@ -532,6 +532,7 @@ namespace FrontendWebApi.ApiControllers left join device_master dm ON d.device_building_tag = dm.device_building_tag AND d.device_name_tag = dm.device_name_tag left join device_item di ON d.device_name_tag = di.device_name_tag + AND di.device_building_tag = '{post.building_tag}' AND di.deleted = 0 AND di.is_show_riserDiagram = 1 left join floor f on d.device_floor_tag = f.full_name and f.deleted = 0 @@ -581,41 +582,41 @@ namespace FrontendWebApi.ApiControllers { var device_url = string.Empty; - if (((de.icon_click & 1) > 0) && !string.IsNullOrEmpty(de.icon_click_url)) + if (((de.left_icon_click & 1) > 0) && !string.IsNullOrEmpty(de.left_icon_click_url)) { - device_url = de.icon_click_url; + device_url = de.left_icon_click_url; //點擊顯示系統圖 - if (de.icon_click_url.Contains("[device_building_tag]")) + if (de.left_icon_click_url.Contains("[device_building_tag]")) { device_url = device_url.Replace("[device_building_tag]", de.device_building_tag); } - if (de.icon_click_url.Contains("[device_system_tag]")) + if (de.left_icon_click_url.Contains("[device_system_tag]")) { device_url = device_url.Replace("[device_system_tag]", de.device_system_tag); } - if (de.icon_click_url.Contains("[device_floor_tag]")) + if (de.left_icon_click_url.Contains("[device_floor_tag]")) { device_url = device_url.Replace("[device_floor_tag]", de.device_floor_tag); } - if (de.icon_click_url.Contains("[device_name_tag]")) + if (de.left_icon_click_url.Contains("[device_name_tag]")) { device_url = device_url.Replace("[device_name_tag]", de.device_name_tag); } - if (de.icon_click_url.Contains("[device_serial_tag]")) + if (de.left_icon_click_url.Contains("[device_serial_tag]")) { device_url = device_url.Replace("[device_serial_tag]", de.device_serial_tag); } - if (de.icon_click_url.Contains("[tag_name]")) + if (de.left_icon_click_url.Contains("[tag_name]")) { device_url = device_url.Replace("[tag_name]", de.device_number); } - de.icon_click_url = null; + de.left_icon_click_url = null; de.DeviceURL = device_url; } @@ -641,7 +642,7 @@ namespace FrontendWebApi.ApiControllers // priority = de.priority, // status = de.status, // DeviceURL = device_url, - // icon_click = de.icon_click + // left_icon_click = de.left_icon_click //}; //afloor.device.Add(device); } diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index d84690f..8134147 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -581,8 +581,8 @@ namespace FrontendWebApi.ApiControllers LENGTH(SUBSTRING_INDEX(errmsg, '_', -1) -1) -- 最後一段的長度 -1 -- 減掉最後的 _ ex:D3_B_B1F_CO_ ) device_tag - FROM alarmorion_orionalarmrecord a - JOIN alarmorion_orionalarmfacetvalue b on a.id = b.alarm + FROM alarmOrion_OrionAlarmRecord a + JOIN alarmOrion_OrionAlarmFacetValue b on a.id = b.alarm WHERE a.sourceState = 1 and b.facetName = 9 ) a left join device b on a.device_tag = b.device_number AND b.deleted = 0 @@ -618,12 +618,12 @@ namespace FrontendWebApi.ApiControllers var device_amount_sql = $@"SELECT - d.building_guid, + d.device_building_tag, COUNT(*) AS device_amount FROM device d WHERE d.deleted = 0 AND d.device_number IN @devices - GROUP BY d.building_guid"; + GROUP BY d.device_building_tag"; alarmObj.buildingAlarmDeviceAmount = await frontendRepository.GetAllAsync(device_amount_sql, new { devices = alarmObj.alarmorion.Select(x => x.device_number).ToList() }); apiResult.Data = alarmObj; diff --git a/FrontendWebApi/ApiControllers/EmergencyContactController.cs b/FrontendWebApi/ApiControllers/EmergencyContactController.cs index c6b7a83..b8b4fba 100644 --- a/FrontendWebApi/ApiControllers/EmergencyContactController.cs +++ b/FrontendWebApi/ApiControllers/EmergencyContactController.cs @@ -90,7 +90,7 @@ namespace FrontendWebApi.ApiControllers try { Emergency_member_tables = await backendRepository.GetAllAsync($@" - select v.system_key groupingName,va.system_key departmentName,* from emergency_member em left join variable v on em.grouping = v.id + select v.system_key groupingName,va.system_key departmentName, em.* from emergency_member em left join variable v on em.grouping = v.id left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = selectgroupidlist }); apiResult.Code = "0000"; @@ -120,7 +120,7 @@ namespace FrontendWebApi.ApiControllers try { var Emergency_member_tables = await backendRepository.GetAllAsync($@" - select v.system_key groupingName,va.system_key departmentName,* from emergency_member em left join variable v on em.grouping = v.id + select v.system_key groupingName,va.system_key departmentName, em.* from emergency_member em left join variable v on em.grouping = v.id left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = post.groupidlist }); using (var doc = new Document()) @@ -236,7 +236,7 @@ namespace FrontendWebApi.ApiControllers try { var Emergency_member_tables = await backendRepository.GetAllAsync($@" - select v.system_key groupingName,va.system_key departmentName,* from emergency_member em left join variable v on em.grouping = v.id + select v.system_key groupingName,va.system_key departmentName, em.* from emergency_member em left join variable v on em.grouping = v.id left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = post.groupidlist }); var sheet = workbook.CreateSheet(post.disaster + "-聯絡清單"); diff --git a/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs b/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs index c74bccf..c294721 100644 --- a/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs +++ b/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs @@ -70,15 +70,15 @@ namespace FrontendWebApi.ApiControllers List buildingToF = new List(); try { - var sqlString = @$"select f.floor_guid ,f.full_name floorname,b.building_guid,b.full_name buildingname from floor f left join building b on b.building_guid = f.building_guid order by f.building_guid , f.priority"; + var sqlString = @$"select f.floor_guid ,f.full_name floorname,b.building_tag,b.full_name buildingname from floor f left join building b on b.building_tag = f.building_tag order by f.building_tag , f.priority"; Building_floor = await backendRepository.GetAllAsync(sqlString); - var builds = Building_floor.GroupBy(a => a.building_guid).ToList(); + var builds = Building_floor.GroupBy(a => a.building_tag).ToList(); foreach (var floor in builds) { BuildingToF buildingToF1 = new BuildingToF() { - building_guid = floor.Select(a => a.building_guid).FirstOrDefault(), + building_tag = floor.Select(a => a.building_tag).FirstOrDefault(), building_name = floor.Select(a => a.buildingname).FirstOrDefault(), floors = new List() }; @@ -125,7 +125,7 @@ namespace FrontendWebApi.ApiControllers d.device_guid, d.device_number, d.full_name AS device_name, - d.building_guid, + d.device_building_tag, b.full_name AS building_name, CONCAT(b.ip_address , ':', b.ip_port) AS ip_address, v.layer2, @@ -137,27 +137,27 @@ namespace FrontendWebApi.ApiControllers floor.full_name floorname, floor.floor_guid floorguid from - (SELECT * - FROM device d - WHERE d.deleted = 0 - AND d.building_guid = '{selectdevice.selectbuilding}' - AND d.floor_guid in @floor - AND d.device_system_category_layer3 IN @layer3) d - left join floor on floor.floor_guid = d.floor_guid + (SELECT * + FROM device d + WHERE d.deleted = 0 + AND d.device_building_tag = '{selectdevice.selectbuilding}' + AND d.device_floor_tag in @floor + AND d.device_name_tag IN @layer3) d + left join floor on floor.full_name = d.device_floor_tag and floor.building_tag = d.device_building_tag left join ( - SELECT - v.*, - v2.system_key AS layer2_name, - v2.system_value AS layer2 - FROM ( - select * - from variable v - where v.system_type = 'device_system_category_layer3') v - LEFT JOIN variable v2 ON v2.deleted = 0 AND v.system_parent_id = v2.id - ) v on v.system_value = d.device_system_category_layer3 + SELECT + v.*, + v2.system_key AS layer2_name, + v2.system_value AS layer2 + FROM ( + select * + from variable v + where v.system_type = 'device_system_category_layer3') v + LEFT JOIN variable v2 ON v2.deleted = 0 AND v.system_parent_id = v2.id + ) v on v.system_value = d.device_system_category_layer3 left join device_disaster dd on dd.device_guid = d.device_guid left join (select * from variable v where v.system_type = 'disaster') ddd on ddd.system_value = dd.device_system_value - LEFT JOIN building b ON b.deleted = 0 AND d.building_guid = b.building_guid + LEFT JOIN building b ON b.deleted = 0 AND d.device_building_tag = b.building_tag where dd.device_system_value IN @disasters ORDER BY d.device_number "; @@ -194,7 +194,7 @@ namespace FrontendWebApi.ApiControllers { {"@emergency_event_guid",newguid}, {"@disaster",eventpost.disaster}, - {"@building_guid", eventpost.build}, + {"@building_tag", eventpost.build}, {"@device_guid",eventpost.device }, {"@type",eventpost.type} }; @@ -267,7 +267,7 @@ namespace FrontendWebApi.ApiControllers try { Emergency_Setting_tables = await backendRepository.GetAllAsync($@" - select v.system_key big_setting_name,* from emergency_setting es left join variable v on es.big_setting = v.id + select v.system_key big_setting_name,es.* from emergency_setting es left join variable v on es.big_setting = v.id where es.big_setting = {selectsetting} and es.deleted = 0 order by es.priority"); apiResult.Code = "0000"; apiResult.Data = Emergency_Setting_tables; @@ -296,7 +296,7 @@ namespace FrontendWebApi.ApiControllers try { var Emergency_Setting_tables = await backendRepository.GetOneAsync($@" - select v.system_key big_setting_name,* from emergency_setting es left join variable v on es.big_setting = v.id + select v.system_key big_setting_name,es.* from emergency_setting es left join variable v on es.big_setting = v.id where es.emergency_guid = '{post.emergency_guid}'"); if (post.make_item == 1) @@ -451,7 +451,7 @@ namespace FrontendWebApi.ApiControllers try { Emergency_member_tables = await backendRepository.GetAllAsync($@" - select v.system_key groupingName,va.system_key departmentName,* from emergency_member em left join variable v on em.grouping = v.id + select v.system_key groupingName,va.system_key departmentName, em.* from emergency_member em left join variable v on em.grouping = v.id left join (select * from variable vs where vs.system_type = 'department' and vs.deleted = 0) va on va.system_value = em.department where em.grouping in @groupinglist and em.deleted = 0", new { groupinglist = selectgroupidlist }); apiResult.Code = "0000"; @@ -486,13 +486,16 @@ namespace FrontendWebApi.ApiControllers try { getDeviceGroup = await backendRepository.GetAllAsync($@" - select dg.*,vd.system_key disater_name,b.full_name building_name,f.full_name floor_name,v2.system_key system_category_layer2,v3.system_key system_category_layer3 from (SELECT * FROM device_group dg WHERE dg.device_disaster != 0) dg - left join (select * from variable v where v.system_type = 'disaster' and v.deleted = 0) vd on vd.system_value = dg.device_disaster - left join building b on b.building_guid = dg.device_building_guid - left join floor f on f.floor_guid = dg.device_floor_guid - left join (select * from variable v where v.system_type = 'device_system_category_layer2' and v.deleted = 0) v2 on v2.system_value = dg.device_system_category_layer2 - left join (select * from variable v where v.system_type = 'device_system_category_layer3' and v.deleted = 0) v3 on v3.system_value = dg.device_system_category_layer3 - order by vd.system_priority,b.priority,f.priority,v2.system_priority,v3.system_priority"); + select dg.*,vd.system_key disater_name,b.full_name building_name,f.full_name floor_name,v2.system_key system_category_layer2,v3.system_key system_category_layer3 + from ( + SELECT * + FROM device_group dg WHERE dg.device_disaster != 0) dg + left join (select * from variable v where v.system_type = 'disaster' and v.deleted = 0) vd on vd.system_value = dg.device_disaster + left join building b on b.building_tag = dg.device_building_tag + left join floor f on f.floor_guid = dg.device_floor_guid + left join (select * from variable v where v.system_type = 'device_system_category_layer2' and v.deleted = 0) v2 on v2.system_value = dg.device_system_category_layer2 + left join (select * from variable v where v.system_type = 'device_system_category_layer3' and v.deleted = 0) v3 on v3.system_value = dg.device_system_category_layer3 + order by vd.system_priority,b.priority,f.priority,v2.system_priority,v3.system_priority"); var dis = getDeviceGroup.GroupBy(a => a.device_disaster); //finalDeviceGroup.disaster = new List(); @@ -504,13 +507,13 @@ namespace FrontendWebApi.ApiControllers Name = diss.Select(a => a.disater_name).FirstOrDefault().ToString(), groupBuildings = new List() }; - var buds = diss.GroupBy(a => a.device_building_guid); + var buds = diss.GroupBy(a => a.device_building_tag); getDeviceGroup1.groupBuildings = new List(); foreach (var bud in buds) { GroupBuildings groupBuildings = new GroupBuildings() { - guid = bud.Key, + tag = bud.Key, name = bud.Select(a => a.building_name).FirstOrDefault().ToString(), device_amount = 0, groupFloors = new List() diff --git a/FrontendWebApi/ApiControllers/EmergencyRecordController.cs b/FrontendWebApi/ApiControllers/EmergencyRecordController.cs index 70dd040..871cb49 100644 --- a/FrontendWebApi/ApiControllers/EmergencyRecordController.cs +++ b/FrontendWebApi/ApiControllers/EmergencyRecordController.cs @@ -35,7 +35,7 @@ namespace FrontendWebApi.ApiControllers try { - var sqlString = @$"select building_guid as Value, full_name as Name from building a where a.deleted = 0 and a.status = 0"; + var sqlString = @$"select building_tag as Value, full_name as Name from building a where a.deleted = 0 and a.status = 0"; KeyValue = await backendRepository.GetAllAsync(sqlString); apiResult.Code = "0000"; @@ -74,8 +74,8 @@ namespace FrontendWebApi.ApiControllers select d.device_number device_name,v.system_key disaster_name,ee.*,b.full_name building_name from emergency_event ee left join (select * from variable v where v.system_type = 'disaster') v on v.system_value = ee.disaster left join device d on d.device_guid = ee.device_guid - left join building b on b.building_guid = ee.building_guid - where ee.deleted = 0 and ee.building_guid = '{post.selectaBuild}' and ee.disaster = '{post.selectaDisaster}' {sqlplus} + left join building b on b.building_tag = ee.building_tag + where ee.deleted = 0 and ee.building_tag = '{post.selectaBuild}' and ee.disaster = '{post.selectaDisaster}' {sqlplus} "); apiResult.Code = "0000"; apiResult.Data = EmergencyRecordEvent; diff --git a/FrontendWebApi/ApiControllers/HiNetController.cs b/FrontendWebApi/ApiControllers/HiNetController.cs index a5cc095..1285703 100644 --- a/FrontendWebApi/ApiControllers/HiNetController.cs +++ b/FrontendWebApi/ApiControllers/HiNetController.cs @@ -825,7 +825,7 @@ namespace FrontendWebApi.ApiControllers Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); return Ok(apiResult); } - + apiResult.Code = "0000"; return Ok(apiResult); } } diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index d72c193..67dfd5b 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -1118,27 +1118,27 @@ namespace FrontendWebApi.ApiControllers { //依據被選擇的設備找出相對應資料 var sqlDeviceItemInfo = $@"select - b.full_name as building_name, - v1.system_key as Main_system_name, - v2.system_key as Sub_system_name, - temp.device_number, - temp.device_name, - temp.full_name as item_name, - temp.points, - temp.unit - from ( - select - di.*, - d.device_number, - d.full_name as device_name, - d.priority - from device_item di - inner join device d on di.device_building_tag COLLATE utf8mb4_unicode_ci = d.device_building_tag - and di.device_system_tag COLLATE utf8mb4_unicode_ci = d.device_system_tag - and di.device_name_tag COLLATE utf8mb4_unicode_ci = d.device_name_tag - and d.deleted = 0 - where di.deleted = 0 and di.unit is not null and d.device_number IN @Device_number - ) temp + b.full_name as building_name, + v1.system_key as Main_system_name, + v2.system_key as Sub_system_name, + temp.device_number, + temp.device_name, + temp.full_name as item_name, + temp.points, + temp.unit + from ( + select + di.*, + d.device_number, + d.full_name as device_name, + d.priority + from device_item di + inner join device d on di.device_building_tag COLLATE utf8mb4_unicode_ci = d.device_building_tag + and di.device_system_tag COLLATE utf8mb4_unicode_ci = d.device_system_tag + and di.device_name_tag COLLATE utf8mb4_unicode_ci = d.device_name_tag + and d.deleted = 0 + where di.deleted = 0 and di.unit is not null and d.device_number = @Device_number + ) temp inner join building b on temp.device_building_tag COLLATE utf8mb4_unicode_ci = b.building_tag and b.deleted = 0 inner join variable v1 on temp.device_system_tag COLLATE utf8mb4_unicode_ci = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2' inner join variable v2 on temp.device_name_tag COLLATE utf8mb4_unicode_ci = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3' @@ -1151,7 +1151,7 @@ namespace FrontendWebApi.ApiControllers var tableName = await backgroundServiceMsSqlRepository.GetOneAsync($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{device_number}_{point}%'"); if (!string.IsNullOrEmpty(tableName)) { - var device_item_infos = await frontendRepository.GetAllAsync(sqlDeviceItemInfo, new { Device_number = hi.Device_number_point }); + var device_item_infos = await frontendRepository.GetAllAsync(sqlDeviceItemInfo, new { Device_number = device_number }); var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault(); @@ -1170,7 +1170,7 @@ namespace FrontendWebApi.ApiControllers //{ //} } - + apiResult.Code = "0000"; apiResult.Data = apiResult.Data.OrderBy(x => x.Device_number).ThenBy(x => x.Timestamp).ToList(); } catch (Exception exception) diff --git a/FrontendWebApi/ApiControllers/HydroMeterController.cs b/FrontendWebApi/ApiControllers/HydroMeterController.cs index 3d9dfcf..ba6a116 100644 --- a/FrontendWebApi/ApiControllers/HydroMeterController.cs +++ b/FrontendWebApi/ApiControllers/HydroMeterController.cs @@ -87,6 +87,8 @@ namespace FrontendWebApi.ApiControllers var table = input.tableType == "year" ? "archive_electric_meter_day" : "archive_electric_meter_" + input.tableType; var dateFormat = input.tableType == "day" || input.tableType == "week" ? "%Y-%m-%d" : input.tableType == "month" ? "%Y-%m" : input.tableType == "year" ? "%Y" : null; + var aemmEndDate = input.tableType == "year" ? $"year(DATE_ADD(fd.date, INTERVAL +1 {input.tableType}))" : $"DATE_ADD(fd.date, INTERVAL +1 {input.tableType})"; + var aemmStaDate = input.tableType == "year" ? "year(fd.date)" : "fd.date"; var sql = $@"set @i = -1; select fd.device_number, aemm.avg_rawdata, DATE_FORMAT(fd.date, @dateFormat) as timestamp from ( @@ -111,7 +113,7 @@ namespace FrontendWebApi.ApiControllers from {table} where start_timestamp >= @startTime and end_timestamp < @endTime and point = 'KWH' and SUBSTRING_INDEX(device_number, '_', 1) = @building_tag {sqlWhere} {sqlGroup} - ) aemm on aemm.start_timestamp >= fd.date and aemm.end_timestamp < DATE_ADD(fd.date, INTERVAL +1 {input.tableType}) and aemm.device_number = fd.device_number + ) aemm on aemm.start_timestamp >= {aemmStaDate} and aemm.end_timestamp < {aemmEndDate} and aemm.device_number = fd.device_number order by fd.device_number, fd.date"; var rawData = await backendRepository.GetAllAsync(sql, new { startTime = startTime, endtime = endTime, building_tag = input.building_tag, floor_tag = input.floor_tag, dateFormat = dateFormat }); diff --git a/FrontendWebApi/ApiControllers/LoginController.cs b/FrontendWebApi/ApiControllers/LoginController.cs index b93e427..8042d9a 100644 --- a/FrontendWebApi/ApiControllers/LoginController.cs +++ b/FrontendWebApi/ApiControllers/LoginController.cs @@ -58,8 +58,8 @@ namespace FrontendWebApi.ApiControllers ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*"); EDFunction eDFunction = new EDFunction(); - string SHA256Pwd = eDFunction.GetSHA256Encryption(login.password); - var User = await backendRepository.GetOneAsync("userinfo", @$"account = '{login.account}' and password = '{SHA256Pwd}' and deleted = 0"); + //string SHA256Pwd = eDFunction.GetSHA256Encryption(login.password); + var User = await backendRepository.GetOneAsync("userinfo", @$"account = '{login.account}' and deleted = 0"); if (User == null) { apiResult.Code = "9998"; diff --git a/FrontendWebApi/ApiControllers/RescueDeviceController.cs b/FrontendWebApi/ApiControllers/RescueDeviceController.cs index 9182f91..2e9b04c 100644 --- a/FrontendWebApi/ApiControllers/RescueDeviceController.cs +++ b/FrontendWebApi/ApiControllers/RescueDeviceController.cs @@ -33,7 +33,7 @@ namespace FrontendWebApi.ApiControllers try { - var sqlString = @$"select floor_guid as Value, full_name as Name from floor a where a.deleted = 0 and a.building_guid = '{Building}' and a.status = 0 order by a.priority"; + var sqlString = @$"select floor_guid as Value, full_name as Name from floor a where a.deleted = 0 and a.building_tag = '{Building}' and a.status = 0 order by a.priority"; KeyValue = await backendRepository.GetAllAsync(sqlString); apiResult.Code = "0000"; @@ -61,7 +61,7 @@ namespace FrontendWebApi.ApiControllers ApiResult> apiResult = new ApiResult>(); try { - RescueDeviceTables = await backendRepository.GetAllAsync("rescue_device", $"building_guid = '{post.build}' and floor_guid in @floors and rescue_device_kind = {post.kind}", new { floors = post.floors }, "floor_name"); + RescueDeviceTables = await backendRepository.GetAllAsync("rescue_device", $"building_tag = '{post.build}' and floor_guid in @floors and rescue_device_kind = {post.kind}", new { floors = post.floors }, "floor_name"); apiResult.Code = "0000"; apiResult.Data = RescueDeviceTables; } @@ -88,7 +88,7 @@ namespace FrontendWebApi.ApiControllers try { - var sqlString = @$"select building_guid as Value, full_name as Name from building a where a.deleted = 0 and a.status = 0 ORDER BY A.priority ASC, A.created_at DESC"; + var sqlString = @$"select building_tag as Value, full_name as Name from building a where a.deleted = 0 and a.status = 0 ORDER BY a.priority ASC, a.created_at DESC"; KeyValue = await backendRepository.GetAllAsync(sqlString); apiResult.Code = "0000"; @@ -159,7 +159,7 @@ namespace FrontendWebApi.ApiControllers devicename = "AED"; } var sheet = workbook.CreateSheet(devicename); - var RescueDevices = backendRepository.GetAllAsync("rescue_device", $"building_guid = '{postObject.build}' and rescue_device_kind = {postObject.kind}",null, "floor_name"); + var RescueDevices = backendRepository.GetAllAsync("rescue_device", $"building_tag = '{postObject.build}' and rescue_device_kind = {postObject.kind}",null, "floor_name"); int RowPosition = 0; IRow row = sheet.CreateRow(RowPosition); ICell cell = row.CreateCell(1); diff --git a/FrontendWebApi/Controllers/EmergencyContactController.cs b/FrontendWebApi/Controllers/EmergencyContactController.cs new file mode 100644 index 0000000..ae0d89d --- /dev/null +++ b/FrontendWebApi/Controllers/EmergencyContactController.cs @@ -0,0 +1,31 @@ +using FrontendWebApi.Models; +using iTextSharp.text; +using iTextSharp.text.html.simpleparser; +using iTextSharp.text.pdf; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using NPOI.SS.UserModel; +using NPOI.XSSF.UserModel; +using Repository.BackendRepository.Interface; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; + +namespace FrontendWebApi.Controllers +{ + public class EmergencyContactController : MyBaseController + { + private readonly IBackendRepository backendRepository; + public EmergencyContactController(IBackendRepository backendRepository) + { + this.backendRepository = backendRepository; + } + public IActionResult Index() + { + return View(); + } + } +} diff --git a/FrontendWebApi/Controllers/EmergencyDeviceMenuController.cs b/FrontendWebApi/Controllers/EmergencyDeviceMenuController.cs new file mode 100644 index 0000000..eddf142 --- /dev/null +++ b/FrontendWebApi/Controllers/EmergencyDeviceMenuController.cs @@ -0,0 +1,24 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FrontendWebApi.Controllers +{ + public class EmergencyDeviceMenuController : MyBaseController + { + private readonly ILogger _logger; + + public EmergencyDeviceMenuController(ILogger logger) + { + _logger = logger; + } + + public IActionResult Index() + { + return View(); + } + } +} diff --git a/FrontendWebApi/Controllers/EmergencyRecordController.cs b/FrontendWebApi/Controllers/EmergencyRecordController.cs new file mode 100644 index 0000000..4f04f29 --- /dev/null +++ b/FrontendWebApi/Controllers/EmergencyRecordController.cs @@ -0,0 +1,48 @@ +using FrontendWebApi.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Repository.BackendRepository.Interface; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FrontendWebApi.Controllers +{ + public class EmergencyRecordController : MyBaseController + { + private readonly IBackendRepository backendRepository; + public EmergencyRecordController(IBackendRepository backendRepository) + { + this.backendRepository = backendRepository; + } + public IActionResult Index() + { + return View(); + } + + [HttpPost] + public async Task>> DisasterList() + { + ApiResult> apiResult = new ApiResult>(); + List Variable = new List(); + + try + { + var sqlString = @$"select system_value as Value, system_key as Name from variable a where a.system_type = 'disaster' and a.deleted = 0"; + Variable = await backendRepository.GetAllAsync(sqlString); + + apiResult.Code = "0000"; + apiResult.Data = Variable; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + } +} diff --git a/FrontendWebApi/Controllers/HomeController.cs b/FrontendWebApi/Controllers/HomeController.cs new file mode 100644 index 0000000..78e9710 --- /dev/null +++ b/FrontendWebApi/Controllers/HomeController.cs @@ -0,0 +1,25 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace FrontendWebApi.Controllers +{ + public class HomeController : MyBaseController + { + private readonly ILogger _logger; + + public HomeController(ILogger logger) + { + _logger = logger; + } + + public IActionResult Index() + { + return View(); + } + + } +} diff --git a/FrontendWebApi/Controllers/LoginController.cs b/FrontendWebApi/Controllers/LoginController.cs new file mode 100644 index 0000000..464ada6 --- /dev/null +++ b/FrontendWebApi/Controllers/LoginController.cs @@ -0,0 +1,55 @@ +using FrontendWebApi.Jwt; +using FrontendWebApi.Models; +using iTextSharp.text; +using iTextSharp.text.pdf; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using NPOI.SS.UserModel; +using NPOI.XSSF.UserModel; +using Repository.BackendRepository.Interface; +using Repository.FrontendRepository.Interface; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Threading.Tasks; + +namespace FrontendWebApi.Controllers +{ + public class LoginController : Controller + { + private readonly ILogger logger; + private readonly IBackendRepository backendRepository; + private readonly IFrontendRepository frontendRepository; + private readonly IJwtHelpers jwt; + //string jwt_str = "login"; + protected MyUserInfo myUserInfo = null; + protected JwtGet myUser; + protected string jwt_str = null; + protected bool jwtlife = true; + + public LoginController + ( + ILogger logger, + IBackendRepository backendRepository, + IFrontendRepository frontendRepository, + IJwtHelpers jwt + ) + { + this.logger = logger; + this.jwt = jwt; + this.backendRepository = backendRepository; + this.frontendRepository = frontendRepository; + } + + public IActionResult Index(string jwt) + { + ViewBag.jwt = jwt; + ViewBag.ProjectName = backendRepository.GetOneAsync("select system_key from variable where deleted = 0 and system_type = 'project_name';").Result; + return View(); + } + } +} diff --git a/FrontendWebApi/Controllers/MyBaseController.cs b/FrontendWebApi/Controllers/MyBaseController.cs new file mode 100644 index 0000000..70408ab --- /dev/null +++ b/FrontendWebApi/Controllers/MyBaseController.cs @@ -0,0 +1,166 @@ +using FrontendWebApi.Jwt; +using FrontendWebApi.Models; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.Configuration; +using Repository.BackendRepository.Interface; +using Repository.BaseRepository.Interface; +using Repository.FrontendRepository.Interface; +using Repository.Helper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Routing; +using System.Diagnostics; +using Repository.BackendRepository.Implement; + +namespace FrontendWebApi.Controllers +{ + public class MyBaseController : Controller where T : MyBaseController + { + private ILogger _logger; + protected ILogger Logger => _logger ?? (_logger = HttpContext?.RequestServices.GetService>()); + private IJwtHelpers jwt => HttpContext?.RequestServices.GetService(); + private IFrontendRepository frontendRepository => HttpContext?.RequestServices.GetService(); + + public MyBaseController() { } + protected MyUserInfo myUserInfo = null; + protected JwtGet myUser; + protected string jwt_str = null; + protected bool jwtlife = true; + public string controllerName; + public string actionName; + public ErrorCode errorCode = new ErrorCode(); + [Authorize] + public override void OnActionExecuting(ActionExecutingContext filterContext) + { + EDFunction edFunction = new EDFunction(); + var myAccount = edFunction.AESDecrypt(HttpContext.Session.GetString("MyApiAccount")); + controllerName = ControllerContext.RouteData.Values["controller"].ToString(); //controller名稱 + actionName = ControllerContext.RouteData.Values["action"].ToString(); //action名稱 + + //紀錄當前PID + Process currentProcess = Process.GetCurrentProcess(); + Dictionary updateProcess = new Dictionary(); + updateProcess.Add("@system_value", currentProcess.Id.ToString()); + + frontendRepository.UpdateProcessPID(updateProcess, "variable", "system_type = 'watchDogCongfig' AND system_key = 'AlarmPID'"); + + bool isAjaxCall = filterContext.HttpContext.Request.Headers["x-requested-with"] == "XMLHttpRequest"; + if (string.IsNullOrEmpty(myAccount)) + { + + if (isAjaxCall) + { + filterContext.HttpContext.Response.Clear(); + filterContext.HttpContext.Response.StatusCode = 499; + return; + } + else + { + filterContext.Result = new RedirectToRouteResult( + new RouteValueDictionary + { + {"controller", "Login"}, + {"action", "Index"} + }); + return; + } + } + else + { + //取得當前登入使用者資訊 + myUserInfo = frontendRepository.GetMyUserInfoByAccount(myAccount); + var showview = frontendRepository.GetAllAsync($@"select ap.ShowView from userinfo us + left join role_auth ra on ra.role_guid = us.role_guid + left join auth_page ap on ap.AuthCode = ra.AuthCode + where us.userinfo_guid = '{myUserInfo.Userinfo_guid}'"); + myUserInfo.ShowView = showview.Result; + ViewBag.myUserInfo = myUserInfo; + ViewBag.role = showview.Result; + + //var showviewt = new List() + // { + // "EmergencyDeviceMenuIndex", + // "EmergencyContactIndex", + // "EmergencyRecordIndex", + // "RescueDeviceFireExtinguisher", + // "RescueDeviceAED", + // }; + //ViewBag.role = showviewt; + } + + //var ctx = filterContext.HttpContext; + //ctx.Response.Headers.Add("Access-Control-Allow-Origin", "*"); + //ctx.Response.Headers.Add("Access-Control-Allow-Headers", "*"); + //ctx.Response.Headers.Add("Access-Control-Allow-Credentials", "true"); + //var a = User.Claims.Select(p => new { Type = p.Type, Value = p.Value }).ToList(); + //myUser = new JwtGet() + //{ + // account = User.Claims.Where(a => a.Type == "account").Select(e => e.Value).FirstOrDefault(), + // email = User.Claims.Where(a => a.Type == "email").Select(e => e.Value).FirstOrDefault(), + // full_name = User.Claims.Where(a => a.Type == "full_name").Select(e => e.Value).FirstOrDefault(), + // exp = User.Claims.Where(a => a.Type == "exp").Select(e => Convert.ToInt32(e.Value)).FirstOrDefault(), + // nbf = User.Claims.Where(a => a.Type == "nbf").Select(e => Convert.ToInt32(e.Value)).FirstOrDefault(), + // userinfo_guid = User.Claims.Where(a => a.Type == "userinfo_guid").Select(e => e.Value).FirstOrDefault(), + //}; + + //TODO 模擬JWT,記得刪除 + //myUser.account = "Bajascript"; + //myUser.email = "asd@com"; + //myUser.full_name = "野原廣志"; + //myUser.exp = 3600; + //myUser.userinfo_guid = "1EF9CEAC-4DBF-E2BE-8B1D-CB3014E0DA17"; + + //if (myUser.exp == 0) + //{ + // jwt_str = "Jwt Token不合法"; + // jwtlife = false; + + // ViewBag.myUserInfo = null; + // ViewBag.role = null; + //} + //else + //{ + // if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds) + // { + // //取得當前登入使用者資訊 + // myUserInfo = frontendRepository.GetMyUserInfoByAccount(myUser.account); + // //var showview = frontendRepository.GetAllAsync($@"select ap.ShowView from userinfo us + // // left join role_auth ra on ra.role_guid = us.role_guid + // // left join auth_page ap on ap.AuthCode = ra.AuthCode + // // where us.userinfo_guid = '{myUserInfo.Userinfo_guid}'"); + // //myUserInfo.ShowView = showview.Result; + // ViewBag.myUserInfo = myUserInfo; + + // var showviewt = new List() + // { + // "EmergencyDeviceMenuIndex", + // "EmergencyContactIndex", + // "EmergencyRecordIndex", + // "RescueDeviceFireExtinguisher", + // "RescueDeviceAED", + // }; + // //ViewBag.role = showview.Result; + // ViewBag.role = showviewt; + + // jwtlife = true; + // JwtLogin jwtLoing = new JwtLogin() + // { + // account = myUser.account, + // email = myUser.email, + // full_name = myUser.full_name, + // userinfo_guid = myUser.userinfo_guid + // }; + // jwt_str = jwt.GenerateToken(jwtLoing).token; + // } + //} + base.OnActionExecuting(filterContext); + } + } +} diff --git a/FrontendWebApi/Controllers/RescueDeviceController.cs b/FrontendWebApi/Controllers/RescueDeviceController.cs new file mode 100644 index 0000000..1d97a1b --- /dev/null +++ b/FrontendWebApi/Controllers/RescueDeviceController.cs @@ -0,0 +1,34 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using NPOI.HSSF.UserModel; +using NPOI.SS.UserModel; +using NPOI.XSSF.UserModel; +using Repository.BackendRepository.Interface; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; + +namespace FrontendWebApi.Controllers +{ + public class RescueDeviceController : MyBaseController + { + private readonly IBackendRepository backendRepository; + + public RescueDeviceController(IBackendRepository backendRepository) + { + this.backendRepository = backendRepository; + } + public IActionResult FireExtinguisher() + { + return View(); + } + public IActionResult AED() + { + return View(); + } + } +} diff --git a/FrontendWebApi/Models/AlarmRecord.cs b/FrontendWebApi/Models/AlarmRecord.cs index b00e0f5..49dd2e1 100644 --- a/FrontendWebApi/Models/AlarmRecord.cs +++ b/FrontendWebApi/Models/AlarmRecord.cs @@ -8,23 +8,23 @@ namespace FrontendWebApi.Models { public class AlarmRecordPanelRawData { - public string building_guid { get; set; } + public string building_tag { get; set; } public string building_name { get; set; } - public string main_system_guid { get; set; } - public string main_system_name { get; set; } + public string system_key { get; set; } + public string system_value { get; set; } } public class AlarmRecordPanel { - public string building_guid { get; set; } + public string building_tag { get; set; } public string building_name { get; set; } public List mainSystemPanels { get; set; } } public class MainSystemPanel { - public string main_system_guid { get; set; } - public string main_system_name { get; set; } + public string system_key { get; set; } + public string system_value { get; set; } } public class AlarmRecord @@ -52,8 +52,8 @@ namespace FrontendWebApi.Models { public string StartTimestamp { get; set; } public string EndTimestamp { get; set; } - public string Building_guid { get; set; } - public List Main_system_guids { get; set; } + public string Building_tag { get; set; } + public List Main_system_tag { get; set; } public byte IsSolve { get;set;} public byte IsAck { get;set;} } diff --git a/FrontendWebApi/Models/Build.cs b/FrontendWebApi/Models/Build.cs index d072fd8..a5b5174 100644 --- a/FrontendWebApi/Models/Build.cs +++ b/FrontendWebApi/Models/Build.cs @@ -186,10 +186,10 @@ namespace FrontendWebApi.Models public byte device_error_flashing { get; set; } public byte device_error_independent { get; set; } public int priority { get; set; } - public byte icon_click { get; set; } - public string icon_click_url { get; set; } - public int icon_click_url_width { get; set; } - public int icon_click_url_height { get; set; } + public byte left_icon_click { get; set; } + public string left_icon_click_url { get; set; } + public int left_icon_click_url_width { get; set; } + public int left_icon_click_url_height { get; set; } public string DeviceURL { get; set; } public string point_name { get; set; } public string points { get; set; } diff --git a/FrontendWebApi/Models/EmergencyDevice.cs b/FrontendWebApi/Models/EmergencyDevice.cs index 4e55131..4f8eaec 100644 --- a/FrontendWebApi/Models/EmergencyDevice.cs +++ b/FrontendWebApi/Models/EmergencyDevice.cs @@ -8,7 +8,7 @@ namespace FrontendWebApi.Models public class EmergencyDeviceGroup { public string device_disaster { get; set; } - public string device_building_guid { get; set; } + public string device_building_tag { get; set; } public string device_floor_guid { get; set; } public string device_system_category_layer2 { get; set; } public string device_system_category_layer3 { get; set; } @@ -35,7 +35,7 @@ namespace FrontendWebApi.Models public class GroupBuildings { - public string guid { get; set; } + public string tag { get; set; } public string name { get; set; } public int device_amount { get; set; } public List groupFloors { get; set; } @@ -68,13 +68,13 @@ namespace FrontendWebApi.Models { public string floor_guid { get; set; } public string floorname { get; set; } - public string building_guid { get; set; } + public string building_tag { get; set; } public string buildingname { get; set; } } public class BuildingToF { - public string building_guid { get; set; } + public string building_tag { get; set; } public string building_name { get; set; } public List floors { get; set; } } @@ -89,7 +89,7 @@ namespace FrontendWebApi.Models public string device_guid { get; set; } public string device_number { get; set; } public string device_name { get; set; } - public string building_guid { get; set; } + public string building_tag { get; set; } public string building_name { get; set; } public string ip_address { get; set; } public string layer2 { get; set; } diff --git a/FrontendWebApi/Models/HistoryClass.cs b/FrontendWebApi/Models/HistoryClass.cs index ebdf803..79bc3a1 100644 --- a/FrontendWebApi/Models/HistoryClass.cs +++ b/FrontendWebApi/Models/HistoryClass.cs @@ -264,6 +264,7 @@ namespace FrontendWebApi.Models public class HistoryItem { public string Device_number_point { get; set; } + public string Device_number { get; set; } public string Unit { get; set; } } diff --git a/FrontendWebApi/Models/RescueDevice.cs b/FrontendWebApi/Models/RescueDevice.cs index 708273c..f29939a 100644 --- a/FrontendWebApi/Models/RescueDevice.cs +++ b/FrontendWebApi/Models/RescueDevice.cs @@ -37,7 +37,7 @@ namespace FrontendWebApi.Models { public string rescue_device_guid { get; set; } public string rescue_device_id { get; set; } - public string building_guid { get; set; } + public string building_tag { get; set; } public string floor_guid { get; set; } public string floor_name { get; set; } public string location { get; set; } diff --git a/FrontendWebApi/Views/EmergencyContact/Index.cshtml b/FrontendWebApi/Views/EmergencyContact/Index.cshtml index ccef77e..c7e06aa 100644 --- a/FrontendWebApi/Views/EmergencyContact/Index.cshtml +++ b/FrontendWebApi/Views/EmergencyContact/Index.cshtml @@ -106,7 +106,7 @@ $(row).attr('guid', data.emergency_guid); }, "ajax": { - "url": "/EmergencyContact/EmergencyContactTable", + "url": "/api/EmergencyContact/EmergencyContactTable", "type": "POST", "data": function (d) { d.selectgroupidlist = selectgroupidlist @@ -116,7 +116,7 @@ toast_error(rel.msg); return; } - data = rel.data.data; + data = rel.data; if (data == null || data.length == 0) { this.data = []; diff --git a/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml b/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml index 9d69c45..9aa1481 100644 --- a/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml +++ b/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml @@ -224,7 +224,7 @@ *@