diff --git a/Backend/Controllers/DeviceImportController.cs b/Backend/Controllers/DeviceImportController.cs index 6cbfcb9..0aea80e 100644 --- a/Backend/Controllers/DeviceImportController.cs +++ b/Backend/Controllers/DeviceImportController.cs @@ -578,100 +578,103 @@ namespace Backend.Controllers -- OR ct.disaster_system_value != d.device_disaster"; } - string sql_temp = $@" - SELECT - ct.device_number AS check_temp_device_number, - ct.device_system_category_layer3 AS check_temp_device_system_category_layer3, - ct.system_category_system_key AS check_temp_device_system_category_layer3_key, - ct.disaster_system_value AS check_temp_disaster, - ct.disaster_system_key AS check_temp_disaster_key, - d.device_number, - d.device_system_category_layer3 AS device_system_category_layer3, - d.system_key AS device_system_category_layer3_key, - d.device_disaster, - d.device_disaster_type_text, - d.device_coordinate, - CASE - WHEN ct.device_number = d.device_number - THEN 0 - ELSE 1 - END AS compare_device_number, - CASE - WHEN ct.device_system_category_layer3 = d.device_system_category_layer3 - THEN 0 - ELSE 1 - END AS compare_system_category_layer3, - CASE - WHEN ct.disaster_system_value = d.device_disaster - THEN 0 - ELSE 1 - END AS compare_device_disaster - FROM ( - SELECT - ct.* , - v.system_type AS system_category_system_type, - v.system_key AS system_category_system_key, - v.system_value AS system_category_system_value, - v2.system_type AS disaster_system_type, - v2.system_key AS disaster_system_key, - v2.system_value AS disaster_system_value - FROM device_import_ckeck_temp ct - LEFT JOIN variable v ON v.system_type = 'device_system_category_layer3' AND ct.device_system_category_layer3 = v.system_value - LEFT JOIN variable v2 ON v2.system_type = 'disaster' AND v2.system_value = ct.device_disaster - {{0}} - ) ct - FULL JOIN ( - SELECT - d.* , - v.system_type, - v.system_key, - v.system_value, - (SELECT - STRING_AGG( ISNULL(system_value, ' '), ',') - FROM device_disaster dd - JOIN variable v ON v.deleted = 0 AND v.system_type = 'disaster' AND v.system_value = dd.device_system_value - WHERE dd.device_guid = d.device_guid - ) AS device_disaster, - (SELECT - STRING_AGG( ISNULL(system_key, ' '), ',') - FROM device_disaster dd - JOIN variable v ON v.deleted = 0 AND v.system_type = 'disaster' AND v.system_value = dd.device_system_value - WHERE dd.device_guid = d.device_guid - ) AS device_disaster_type_text - FROM device d - LEFT JOIN variable v ON v.system_type = 'device_system_category_layer3' AND d.device_system_category_layer3 = v.system_value - {{1}} - AND d.deleted = 0 + if (!string.IsNullOrEmpty(post.Building_tag) && !string.IsNullOrEmpty(post.System_category) && !string.IsNullOrEmpty(post.System_tag)) + { + string sql_temp = $@" + SELECT + ct.device_number AS check_temp_device_number, + ct.device_system_category_layer3 AS check_temp_device_system_category_layer3, + ct.system_category_system_key AS check_temp_device_system_category_layer3_key, + ct.disaster_system_value AS check_temp_disaster, + ct.disaster_system_key AS check_temp_disaster_key, + d.device_number, + d.device_system_category_layer3 AS device_system_category_layer3, + d.system_key AS device_system_category_layer3_key, + d.device_disaster, + d.device_disaster_type_text, + d.device_coordinate, + CASE + WHEN ct.device_number = d.device_number + THEN 0 + ELSE 1 + END AS compare_device_number, + CASE + WHEN ct.device_system_category_layer3 = d.device_system_category_layer3 + THEN 0 + ELSE 1 + END AS compare_system_category_layer3, + CASE + WHEN ct.disaster_system_value = d.device_disaster + THEN 0 + ELSE 1 + END AS compare_device_disaster + FROM ( + SELECT + ct.* , + v.system_type AS system_category_system_type, + v.system_key AS system_category_system_key, + v.system_value AS system_category_system_value, + v2.system_type AS disaster_system_type, + v2.system_key AS disaster_system_key, + v2.system_value AS disaster_system_value + FROM device_import_ckeck_temp ct + LEFT JOIN variable v ON v.system_type = 'device_system_category_layer3' AND ct.device_system_category_layer3 = v.system_value + LEFT JOIN variable v2 ON v2.system_type = 'disaster' AND v2.system_value = ct.device_disaster + {{0}} + ) ct + LEFT JOIN ( + SELECT + d.* , + v.system_type, + v.system_key, + v.system_value, + (SELECT + GROUP_CONCAT( ifnull(system_value, ' '), ',') + FROM device_disaster dd + JOIN variable v ON v.deleted = 0 AND v.system_type = 'disaster' AND v.system_value = dd.device_system_value + WHERE dd.device_guid = d.device_guid + ) AS device_disaster, + (SELECT + GROUP_CONCAT( ifnull(system_key, ' '), ',') + FROM device_disaster dd + JOIN variable v ON v.deleted = 0 AND v.system_type = 'disaster' AND v.system_value = dd.device_system_value + WHERE dd.device_guid = d.device_guid + ) AS device_disaster_type_text + FROM device d + LEFT JOIN variable v ON v.system_type = 'device_system_category_layer3' AND d.device_system_category_layer3 = v.system_value + {{1}} + AND d.deleted = 0 - )d ON ct.device_number = d.device_number - {{2}} - ORDER BY d.device_number DESC - "; + )d ON ct.device_number = d.device_number + {{2}} + ORDER BY d.device_number DESC + "; - var sql = string.Format(sql_temp, string.Format(sSubTableWhere, "ct"), string.Format(sSubTableWhere, "d"), sWhere); + var sql = string.Format(sql_temp, string.Format(sSubTableWhere, "ct"), string.Format(sSubTableWhere, "d"), sWhere); - var param = new { Device_building_tag = post.Building_tag, Device_system_tag = post.System_tag, Device_system_category_layer3 = post.System_category }; + var param = new { Device_building_tag = post.Building_tag, Device_system_tag = post.System_tag, Device_system_category_layer3 = post.System_category }; - var deviceCheckTableList = await backendRepository.GetAllAsync(sql, param); + var deviceCheckTableList = await backendRepository.GetAllAsync(sql, param); - sSubTableWhere = " WHERE {0}.device_building_tag = @Device_building_tag"; + sSubTableWhere = " WHERE {0}.device_building_tag = @Device_building_tag"; - sWhere = @"WHERE ct.device_number IS NULL AND d.device_number IS NOT NULL - -- OR ct.device_system_category_layer3 != d.device_system_category_layer3 - -- OR ct.disaster_system_value != d.device_disaster"; + sWhere = @"WHERE ct.device_number IS NULL AND d.device_number IS NOT NULL + -- OR ct.device_system_category_layer3 != d.device_system_category_layer3 + -- OR ct.disaster_system_value != d.device_disaster"; - var sql_abnormal_amount = string.Format(sql_temp, string.Format(sSubTableWhere, "ct"), string.Format(sSubTableWhere, "d") + " AND d.deleted = 0", sWhere); + var sql_abnormal_amount = string.Format(sql_temp, string.Format(sSubTableWhere, "ct"), string.Format(sSubTableWhere, "d") + " AND d.deleted = 0", sWhere); - var abnormal = await backendRepository.GetAllAsync(sql_abnormal_amount, param); + var abnormal = await backendRepository.GetAllAsync(sql_abnormal_amount, param); - var abnormal_amount = abnormal.Count(); + var abnormal_amount = abnormal.Count(); - DeviceCheck deviceCheck = new DeviceCheck(); - deviceCheck.DeviceCheckAmount = abnormal_amount; - deviceCheck.DeviceCheckTableList = deviceCheckTableList; + DeviceCheck deviceCheck = new DeviceCheck(); + deviceCheck.DeviceCheckAmount = abnormal_amount; + deviceCheck.DeviceCheckTableList = deviceCheckTableList; - apiResult.Code = "0000"; - apiResult.Data = deviceCheck; + apiResult.Code = "0000"; + apiResult.Data = deviceCheck; + } } catch (Exception exception) { diff --git a/Backend/appsettings.json b/Backend/appsettings.json index 4ec377a..0c7670b 100644 --- a/Backend/appsettings.json +++ b/Backend/appsettings.json @@ -17,7 +17,8 @@ "Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201 "Port": "js2LutKe+rdjzdxMPQUrvQ==", //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //三菱 - "Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp + //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp + "Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome "Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Password": "FVAPxztxpY4gJJKQ/se4bQ==" } diff --git a/Backend/wwwroot/upload/build_map/092e12e3-b037-4156-bfc2-ee523fd7fb79.nwc b/Backend/wwwroot/upload/build_map/092e12e3-b037-4156-bfc2-ee523fd7fb79.nwc new file mode 100644 index 0000000..5763191 Binary files /dev/null and b/Backend/wwwroot/upload/build_map/092e12e3-b037-4156-bfc2-ee523fd7fb79.nwc differ diff --git a/Backend/wwwroot/upload/build_map/0a626582-efd7-46d2-a0d7-b250241843bd.nwc b/Backend/wwwroot/upload/build_map/0a626582-efd7-46d2-a0d7-b250241843bd.nwc new file mode 100644 index 0000000..5763191 Binary files /dev/null and b/Backend/wwwroot/upload/build_map/0a626582-efd7-46d2-a0d7-b250241843bd.nwc differ diff --git a/FrontendWebApi/appsettings.Development.json b/FrontendWebApi/appsettings.Development.json index 7161e1e..8253f21 100644 --- a/FrontendWebApi/appsettings.Development.json +++ b/FrontendWebApi/appsettings.Development.json @@ -12,11 +12,14 @@ "SignKey": "TaipeiDome123456", //ñ��//�̤�16�r�� "JwtLifeSeconds": 3600 }, - "DBConfig": { + "DBConfig": { "MySqlDBConfig": { "Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201 "Port": "js2LutKe+rdjzdxMPQUrvQ==", - "Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 + //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 + //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp + "Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome + //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel "Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Password": "FVAPxztxpY4gJJKQ/se4bQ==" } diff --git a/FrontendWebApi/appsettings.json b/FrontendWebApi/appsettings.json index 393dd42..2a2253a 100644 --- a/FrontendWebApi/appsettings.json +++ b/FrontendWebApi/appsettings.json @@ -23,7 +23,9 @@ "Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201 "Port": "js2LutKe+rdjzdxMPQUrvQ==", //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //三菱 - "Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp + //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp + "Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome + //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel "Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Password": "FVAPxztxpY4gJJKQ/se4bQ==" },