From ca78d5655169eac84d0b2b9e7221fe830e4a1f5d Mon Sep 17 00:00:00 2001 From: ISA Date: Mon, 24 Jun 2024 07:05:22 +0200 Subject: [PATCH] edit: Stationen auf die Karte bekommen , muss der IP des Server eingegeben werden in [...path] --- .env.local | 2 +- components/MapComponent.js | 12 +- config/config.js | 10 + pages/api/[...path].js | 5 +- pages/api/{talas_v5 => talas5}/area.js | 0 .../{talas_v5 => talas5}/location_device.js | 0 .../webserviceMap/GisStationsMeasurements.js | 116 ++++++++ .../GisStationsStaticDistrict.js | 281 ++++++++++++++++++ .../GisStationsStatusDistrict.js | 206 +++++++++++++ .../talas5/webserviceMap/GisSystemStatic.js | 273 +++++++++++++++++ .../gisStationsMeasurementsSQL.js | 70 +++++ .../GisStationsMeasurements.js | 0 .../GisStationsStaticDistrict.js | 0 .../GisStationsStatusDistrict.js | 0 .../WebserviceMap.asmx/GisSystemStatic.js | 0 15 files changed, 968 insertions(+), 7 deletions(-) rename pages/api/{talas_v5 => talas5}/area.js (100%) rename pages/api/{talas_v5 => talas5}/location_device.js (100%) create mode 100644 pages/api/talas5/webserviceMap/GisStationsMeasurements.js create mode 100644 pages/api/talas5/webserviceMap/GisStationsStaticDistrict.js create mode 100644 pages/api/talas5/webserviceMap/GisStationsStatusDistrict.js create mode 100644 pages/api/talas5/webserviceMap/GisSystemStatic.js create mode 100644 pages/api/talas5/webserviceMap/gisStationsMeasurementsSQL.js delete mode 100644 pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisStationsMeasurements.js delete mode 100644 pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict.js delete mode 100644 pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisStationsStatusDistrict.js delete mode 100644 pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisSystemStatic.js diff --git a/.env.local b/.env.local index 975de0335..cb14642ed 100644 --- a/.env.local +++ b/.env.local @@ -7,4 +7,4 @@ DB_PASSWORD="root#$" DB_NAME=talas_v5 DB_PORT=3306 ######################### Kontetmenü -> Station in tab öffnen -BASE_URL=http://10.10.0.13/talas5/devices/ \ No newline at end of file +#BASE_URL=http://10.10.0.13/talas5/devices/ \ No newline at end of file diff --git a/components/MapComponent.js b/components/MapComponent.js index 2cd31ecb6..e4c5a8455 100644 --- a/components/MapComponent.js +++ b/components/MapComponent.js @@ -149,8 +149,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { const zoomTrigger = useRecoilValue(zoomTriggerState); const offlineTileLayer = "/mapTiles/{z}/{x}/{y}.png"; //const onlineTileLayer = "/mapTiles/{z}/{x}/{y}.png"; - const onlineTileLayer = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"; - //const onlineTileLayer = "http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"; //Talas_v5 Server + //const onlineTileLayer = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"; + const onlineTileLayer = "http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"; //Talas_v5 Server + //const onlineTileLayer = "http://192.168.10.14:3000/mapTiles/{z}/{x}/{y}.png"; //Talas_v5 Server // Create map layers const TALAS = new L.layerGroup(); const ECI = new L.layerGroup(); @@ -169,7 +170,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { const [gisSystemStaticLoaded, setGisSystemStaticLoaded] = useState(false); const baseUrl = "http://10.10.0.13/talas5/devices/"; // für Station öffnen in neuer tab und gleicher tab, im localhost gab es keine Probleme mit der Frame - //const baseUrl = "http://localhost/talas5/devices/"; + //const baseUrl = "http://localhost:3000/talas5/devices/"; + //const baseUrl = "http://192.168.10.14/talas5/devices/"; const [isPoiTypLoaded, setIsPoiTypLoaded] = useState(false); const [poiTypMap, setPoiTypMap] = useState(new Map()); const [showPopup, setShowPopup] = useState(false); @@ -755,7 +757,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { const protocol = url.protocol; // "http:" oder "https:" //const serverURL = `${protocol}//${hostname}`; const serverURL = "http://10.10.0.13"; // weil ich keine API habe, ansonsten serverURL ist localhost(IP-Adresse) für GisSystemStatic für die Benutzerrechte - //const serverURL = "http://localhost:3000"; + //const serverURL = "http://localhost:3000"; // weil ich keine API habe, ansonsten serverURL ist localhost(IP-Adresse) für GisSystemStatic für die Benutzerrechte const params = new URL(window.location.href).searchParams; //const serverURL = `${protocol}//${hostname}${port ? `:${port}` : ""}`; @@ -767,9 +769,11 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { try { const response = await fetch( `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${c}&idUser=${user}` + //`${serverURL}/api/talas5/webserviceMap/GisSystemStatic?idMap=${c}&idUser=${user}` //Berechtigung zum hinzufügen von POIs in der Karte //`${serverURL}/api/rights?idMap=${c}&idUser=${user}` ); const data = await response.json(); + console.log("Benutzerrechte:", data); const rightsArray = data.Rights; // Nehmen an, dass 'Rights' das Array von Rechten ist // Speichert die IDs der Rechte in einem Array diff --git a/config/config.js b/config/config.js index 26c19cb22..a6038a0fd 100644 --- a/config/config.js +++ b/config/config.js @@ -31,6 +31,8 @@ if (typeof window !== "undefined") { // Konstruktion von URLs, die auf spezifische Ressourcen auf dem Server zeigen //http://localhost:3000/?m=10&u=485 + + //-----------------Von WebService------------------------------------------------ mapGisStationsStaticDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict?idMap=${c}&idUser=${user}`; //idMap: 10, idUser: 484 mapGisStationsStatusDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStatusDistrict?idMap=${c}&idUser=${user}`; mapGisStationsMeasurementsUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsMeasurements?idMap=${c}`; @@ -39,6 +41,7 @@ if (typeof window !== "undefined") { webserviceGisLinesStatusUrl = `http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisLinesStatus?idMap=${c}`; //webserviceGisLinesStatusUrl = `http://localhost:3000/api/linesColorApi`; + //webserviceGisLinesStatusUrl = `http://192.168.10.14/talas5/ClientData/WebServiceMap.asmx/GisLinesStatus?idMap=${c}`; //http://10.10.0.13/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=12&idUser=484 @@ -47,6 +50,13 @@ if (typeof window !== "undefined") { mapGisStationsMeasurementsUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsMeasurements`; mapGisSystemStaticUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic`; mapDataIconUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GetIconsStatic`; */ + + /* mapGisStationsStaticDistrictUrl = `${serverURL}/api/talas5/webserviceMap/GisStationsStaticDistrict?idMap=${c}&idUser=${user}`; + mapGisStationsStatusDistrictUrl = `${serverURL}/api/talas5/webserviceMap/GisStationsStatusDistrict?idMap=${c}&idUser=${user}`; + mapGisStationsMeasurementsUrl = `${serverURL}/api/talas5/webserviceMap/GisStationsMeasurements?idMap=${c}`; + mapGisStationsMeasurementsUrl = `${serverURL}/api/talas5/webserviceMap/gisStationsMeasurementsSQL?idMap=${c}`; + mapGisSystemStaticUrl = `${serverURL}/api/talas5/webserviceMap/GisSystemStatic?idMap=${c}&idUser=${user}`; + mapDataIconUrl = `${serverURL}/api/talas5/webserviceMap/GetIconsStatic`; */ } // Export der definierten Variablen und URLs, damit sie in anderen Teilen der Anwendung verwendet werden können diff --git a/pages/api/[...path].js b/pages/api/[...path].js index 30205dad5..febda1fa8 100644 --- a/pages/api/[...path].js +++ b/pages/api/[...path].js @@ -3,11 +3,12 @@ import { createProxyMiddleware } from "http-proxy-middleware"; export default createProxyMiddleware({ //target: "http://192.168.10.58:3001", - + // Stationen bekommen target: "http://10.10.0.13", // Ziel-URL des Proxys // API Aufruf zum mapGisStationsStaticDistrictUrl, mapGisStationsStatusDistrictUrl, mapGisStationsMeasurementsUrl, mapGisSystemStaticUrl und mapDataIconUrl - //target: "http://localhost", // Ziel-URL des Proxys + //target: "http://localhost:3000", // Ziel-URL des Proxys //target: "http://192.168.10.187:3000", // Ziel-URL des Proxys + //target: "http://192.168.10.14", changeOrigin: true, pathRewrite: { "^/api": "/", // Optional: Entfernt /api aus dem Pfad, wenn das Backend dies nicht erfordert diff --git a/pages/api/talas_v5/area.js b/pages/api/talas5/area.js similarity index 100% rename from pages/api/talas_v5/area.js rename to pages/api/talas5/area.js diff --git a/pages/api/talas_v5/location_device.js b/pages/api/talas5/location_device.js similarity index 100% rename from pages/api/talas_v5/location_device.js rename to pages/api/talas5/location_device.js diff --git a/pages/api/talas5/webserviceMap/GisStationsMeasurements.js b/pages/api/talas5/webserviceMap/GisStationsMeasurements.js new file mode 100644 index 000000000..5aba69fc6 --- /dev/null +++ b/pages/api/talas5/webserviceMap/GisStationsMeasurements.js @@ -0,0 +1,116 @@ +// /pages/api/talas5/webserviceMap/GisStationsMeasurements.js +const GisStationsMeasurements = { + "Name": "Liste aller Messungen der Geraete", + "Zeitstempel": "2024-05-31T15:25:32.5047629+02:00", + "IdMap": "10", + "Statis": [ + { + "IdLD": 50004, + "IdL": 18624, + "IdDP": 3, + "Na": "FBT", + "Val": "20.5", + "Unit": "°C", + "Gr": "GMA", + "Area_Name": "Renzenhof (RG)" + }, + { + "IdLD": 50004, + "IdL": 18624, + "IdDP": 10, + "Na": "GT", + "Val": "nicht ermittelbar", + "Unit": "°C", + "Gr": "GMA", + "Area_Name": "Renzenhof (RG)" + }, + { + "IdLD": 50004, + "IdL": 18624, + "IdDP": 2, + "Na": "LT", + "Val": "Datenlücke", + "Unit": "°C", + "Gr": "GMA", + "Area_Name": "Renzenhof (RG)" + }, + { + "IdLD": 50004, + "IdL": 18624, + "IdDP": 6, + "Na": "RLF", + "Val": "100.0", + "Unit": "%", + "Gr": "GMA", + "Area_Name": "Renzenhof (RG)" + }, + { + "IdLD": 50004, + "IdL": 18624, + "IdDP": 11, + "Na": "TPT", + "Val": "8.3", + "Unit": "°C", + "Gr": "GMA", + "Area_Name": "Renzenhof (RG)" + }, + { + "IdLD": 50004, + "IdL": 18624, + "IdDP": 12, + "Na": "TT1", + "Val": "---", + "Unit": "°C", + "Gr": "GMA", + "Area_Name": "Renzenhof (RG)" + }, + { + "IdLD": 50004, + "IdL": 18624, + "IdDP": 16, + "Na": "WFD", + "Val": "0.12", + "Unit": "mm", + "Gr": "GMA", + "Area_Name": "Renzenhof (RG)" + }, + { + "IdLD": 50004, + "IdL": 18624, + "IdDP": 8, + "Na": "WGM", + "Val": "---", + "Unit": "m/s", + "Gr": "GMA", + "Area_Name": "Renzenhof (RG)" + }, + { + "IdLD": 50004, + "IdL": 18624, + "IdDP": 9, + "Na": "WGS", + "Val": "---", + "Unit": "m/s", + "Gr": "GMA", + "Area_Name": "Renzenhof (RG)" + } + ] + } + + // Export an async function handler for the API route. + export default async function handler(req, res) { + // Initialize an empty params object to store query parameters. + const params = { + idMap: req.query.idMap, + + }; + + // Check if the requested ID map and user match certain conditions. + if (params.idMap === '10') { + // If the conditions are met, return the GisStationsMeasurements object with a 200 status code. + res.status(200).json(GisStationsMeasurements); + } else { + // If not, return a 404 error with the message "Not Found". + res.status(404).send('Not Found'); + } + }; \ No newline at end of file diff --git a/pages/api/talas5/webserviceMap/GisStationsStaticDistrict.js b/pages/api/talas5/webserviceMap/GisStationsStaticDistrict.js new file mode 100644 index 000000000..bf302f3d7 --- /dev/null +++ b/pages/api/talas5/webserviceMap/GisStationsStaticDistrict.js @@ -0,0 +1,281 @@ +// /pages/api/talas5/webserviceMap/GisStationsStaticDistrict.js +const GisStationsStaticDistrict = { + "Name": "Liste aller Geraete einer bestimmten Karte", + "Zeitstempel": "2024-05-31T15:26:56.9235766+02:00", + "IdMap": "10", + "Points": [ + { + "LD_Name": "CPL Bentheim", + "IdLD": 50017, + "Device": "CPL V3.5 mit 16 Kü", + "Link": "cpl.aspx?ver=35&kue=16&id=50017", + "Location_Name": "Technikraum", + "Location_Short": "BEHE", + "IdLocation": 17448, + "Area_Name": "Bad-Bentheim", + "Area_Short": "BEHE--00", + "IdArea": 16418, + "X": 51.5728, + "Y": 9.00056, + "Icon": 20, + "System": 1, + "Active": 0 + }, + { + "LD_Name": "Drucker", + "IdLD": 50084, + "Device": "Basisgerät", + "Link": "basis.aspx?ver=1&id=50084", + "Location_Name": "Technikraum", + "Location_Short": "SLUE", + "IdLocation": 17776, + "Area_Name": "Schlüchtern II", + "Area_Short": "SLUE--00", + "IdArea": 14688, + "X": 53.2455, + "Y": 8.1614, + "Icon": 14, + "System": 200, + "Active": 0 + }, + { + "LD_Name": "Türkontakt", + "IdLD": 50666, + "Device": "ECI", + "Link": "eci.aspx?ver=1&id=50666", + "Location_Name": "Technikraum", + "Location_Short": "SLUE", + "IdLocation": 17776, + "Area_Name": "Schlüchtern II", + "Area_Short": "SLUE--00", + "IdArea": 14688, + "X": 53.2455, + "Y": 8.1614, + "Icon": 17, + "System": 2, + "Active": 0 + }, + { + "LD_Name": "Triptis", + "IdLD": 50888, + "Device": "CPL 200", + "Link": "cpl.aspx?ver=30&kue=16&id=50888", + "Location_Name": "Technikraum", + "Location_Short": "SLUE", + "IdLocation": 17776, + "Area_Name": "Schlüchtern II", + "Area_Short": "SLUE--00", + "IdArea": 14688, + "X": 53.2455, + "Y": 8.1614, + "Icon": 20, + "System": 1, + "Active": 0 + }, + { + "LD_Name": "Rodaborn I", + "IdLD": 50889, + "Device": "cpl.mio V>6", + "Link": "cplmio.aspx?ver=1&id=50889", + "Location_Name": "Technikraum", + "Location_Short": "SLUE", + "IdLocation": 17776, + "Area_Name": "Schlüchtern II", + "Area_Short": "SLUE--00", + "IdArea": 14688, + "X": 53.2455, + "Y": 8.1614, + "Icon": 20, + "System": 1, + "Active": 0 + }, + { + "LD_Name": "Rodaborn II", + "IdLD": 50900, + "Device": "cpl.mio V>6", + "Link": "cplmio.aspx?ver=1&id=50900", + "Location_Name": "Technikraum", + "Location_Short": "SLUE", + "IdLocation": 17776, + "Area_Name": "Schlüchtern II", + "Area_Short": "SLUE--00", + "IdArea": 14688, + "X": 53.2455, + "Y": 8.1614, + "Icon": 20, + "System": 1, + "Active": 0 + }, + { + "LD_Name": "Hermsdorf", + "IdLD": 50901, + "Device": "CPL V3.5 mit 24 Kü", + "Link": "cpl.aspx?ver=35&kue=24&id=50901", + "Location_Name": "Technikraum", + "Location_Short": "SLUE", + "IdLocation": 17776, + "Area_Name": "Schlüchtern II", + "Area_Short": "SLUE--00", + "IdArea": 14688, + "X": 53.2455, + "Y": 8.1614, + "Icon": 20, + "System": 1, + "Active": 1 + }, + { + "LD_Name": "GMA Littwin (TEST)", + "IdLD": 50004, + "Device": "Glättemeldeanlage", + "Link": "gma.aspx?ver=1&id=50004", + "Location_Name": "RG Relaisraum", + "Location_Short": "REZR", + "IdLocation": 18624, + "Area_Name": "Renzenhof (RG)", + "Area_Short": "REZHRG00", + "IdArea": 16570, + "X": 53.246036, + "Y": 8.163293, + "Icon": 1, + "System": 11, + "Active": 0 + }, + { + "LD_Name": "NRS Testserver", + "IdLD": 50005, + "Device": "Notruf Server", + "Link": "nrs_server.aspx?ver=1&id=50005", + "Location_Name": "(EV Ammersricht BZR REL)", + "Location_Short": "AMME", + "IdLocation": 21118, + "Area_Name": "Ammersricht BZR (FGN)", + "Area_Short": "AMMER--00", + "IdArea": 15958, + "X": 52.52726, + "Y": 12.165488, + "Icon": 19, + "System": 8, + "Active": 0 + }, + { + "LD_Name": "Gateway 2", + "IdLD": 50007, + "Device": "Notruf Server", + "Link": "nrs_server.aspx?ver=1&id=50007", + "Location_Name": "(EV Ammersricht BZR REL)", + "Location_Short": "AMME", + "IdLocation": 21118, + "Area_Name": "Ammersricht BZR (FGN)", + "Area_Short": "AMMER--00", + "IdArea": 15958, + "X": 52.52726, + "Y": 12.165488, + "Icon": 19, + "System": 8, + "Active": 0 + }, + { + "LD_Name": "Basisgerät mit SNMP MVP", + "IdLD": 50669, + "Device": "Basisgerät + SNMP", + "Link": "basisSNMP.aspx?&ver=1&id=50669", + "Location_Name": "Mylinghauserstraße Engelbert", + "Location_Short": "G-GEVELSBE-1", + "IdLocation": 24012, + "Area_Name": "Gevelsberg", + "Area_Short": "GMA-GEVELSBE", + "IdArea": 20919, + "X": 51.316799, + "Y": 7.33281, + "Icon": 14, + "System": 200, + "Active": 1 + }, + { + "LD_Name": "Server 3", + "IdLD": 50009, + "Device": "Notruf Server", + "Link": "nrs_server.aspx?ver=1&id=50009", + "Location_Name": "Militärringstraße Militärringstraße", + "Location_Short": "G-KÖLN-1", + "IdLocation": 24015, + "Area_Name": "Köln", + "Area_Short": "GMA-KÖLN", + "IdArea": 20921, + "X": 50.898399, + "Y": 6.92278, + "Icon": 19, + "System": 8, + "Active": 0 + }, + { + "LD_Name": "ICL Test 5", + "IdLD": 50054, + "Device": "ICL", + "Link": "icl.aspx?ver=1&id=50054", + "Location_Name": "Recheder Mühlenweg Dortmund-Ems-Kanal", + "Location_Short": "G-OLFEN-SE-1", + "IdLocation": 24022, + "Area_Name": "Olfen-Selm", + "Area_Short": "GMA-OLFEN-SE", + "IdArea": 20926, + "X": 51.702202, + "Y": 7.40822, + "Icon": 23, + "System": 100, + "Active": 0 + }, + { + "LD_Name": "ICL Test 3", + "IdLD": 50052, + "Device": "ICL", + "Link": "icl.aspx?ver=1&id=50052", + "Location_Name": "Weidenstraße Hestenberg", + "Location_Short": "G-PLETTENB-1", + "IdLocation": 24024, + "Area_Name": "Plettenberg", + "Area_Short": "GMA-PLETTENB", + "IdArea": 20928, + "X": 51.224098, + "Y": 7.86969, + "Icon": 23, + "System": 100, + "Active": 0 + }, + { + "LD_Name": "Test Februar Kai", + "IdLD": 50912, + "Device": "Dauerzählstelle DZ", + "Link": "dauz.aspx?ver=1&id=50912", + "Location_Name": "In der Hoffnung Kiesberg - BG Ost", + "Location_Short": "G-WUPPERTA-4", + "IdLocation": 24039, + "Area_Name": "Wuppertal", + "Area_Short": "GMA-WUPPERTA", + "IdArea": 20937, + "X": 51.238899, + "Y": 7.12715, + "Icon": 14, + "System": 110, + "Active": 1 + } + ] + } + + // Export an async function handler for the API route. + export default async function handler(req, res) { + // Initialize an empty params object to store query parameters. + const params = { + idMap: req.query.idMap, + idUser: req.query.idUser + }; + + // Check if the requested ID map and user match certain conditions. + if (params.idMap === '10' && params.idUser === '484') { + // If the conditions are met, return the GisStationsStaticDistrict object with a 200 status code. + res.status(200).json(GisStationsStaticDistrict); + } else { + // If not, return a 404 error with the message "Not Found". + res.status(404).send('Not Found'); + } + }; \ No newline at end of file diff --git a/pages/api/talas5/webserviceMap/GisStationsStatusDistrict.js b/pages/api/talas5/webserviceMap/GisStationsStatusDistrict.js new file mode 100644 index 000000000..5a532d499 --- /dev/null +++ b/pages/api/talas5/webserviceMap/GisStationsStatusDistrict.js @@ -0,0 +1,206 @@ +// /pages/api/talas5/webserviceMap/GisStationsStatusDistrict.js +const GisStationsStatusDistrict = { + "Name": "Liste aller Statis der Geraete", + "Zeitstempel": "2024-05-31T15:28:10.2538122+02:00", + "IdMap": "10", + "Statis": [ + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE04 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE05 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE06 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE07 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE09 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE10 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE12 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE13 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE14 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE15 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE16 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "system", + "Le": 4, + "Co": "#FF00FF", + "Me": "Eingang DE17 kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "minor", + "Le": 3, + "Co": "#FFFF00", + "Me": "Eingang DE01 gehend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "minor", + "Le": 3, + "Co": "#FFFF00", + "Me": "KÜG 07: Übersapnnung kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50004, + "Na": "major", + "Le": 2, + "Co": "#FF9900", + "Me": "Fahrbahntemperatur okay", + "Feld": 53, + "Icon": 25 + }, + { + "IdLD": 50017, + "Na": "critical", + "Le": 1, + "Co": "#FF0000", + "Me": "KÜG 01: Isolationsminderung kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "critical", + "Le": 1, + "Co": "#FF0000", + "Me": "KÜG 02: Isolationsminderung kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "critical", + "Le": 1, + "Co": "#FF0000", + "Me": "KÜG 03: Isolationsminderung kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "critical", + "Le": 1, + "Co": "#FF0000", + "Me": "KÜG 04: Isolationsminderung kommend", + "Feld": 3, + "Icon": 0 + }, + { + "IdLD": 50017, + "Na": "critical", + "Le": 1, + "Co": "#FF0000", + "Me": "Ping True", + "Feld": 3, + "Icon": 0 + } + ] + } + + // Export an async function handler for the API route. + export default async function handler(req, res) { + // Initialize an empty params object to store query parameters. + const params = { + idMap: req.query.idMap, + idUser: req.query.idUser + }; + + // Check if the requested ID map and user match certain conditions. + if (params.idMap === '10' && params.idUser === '484') { + // If the conditions are met, return the GisStationsStatusDistrict object with a 200 status code. + res.status(200).json(GisStationsStatusDistrict); + } else { + // If not, return a 404 error with the message "Not Found". + res.status(404).send('Not Found'); + } + }; \ No newline at end of file diff --git a/pages/api/talas5/webserviceMap/GisSystemStatic.js b/pages/api/talas5/webserviceMap/GisSystemStatic.js new file mode 100644 index 000000000..b2fb56635 --- /dev/null +++ b/pages/api/talas5/webserviceMap/GisSystemStatic.js @@ -0,0 +1,273 @@ +// /pages/api/webServiceMap.js +const gisSystemStatic = { + "Name": "Liste aller angezeigten Systeme", + "Zeitstempel": "2024-05-31T15:08:49.8599542+02:00", + "IdMap": "10", + "Systems": [ + { + "IdSystem": 1, + "Name": "TALAS", + "Longname": "Talas Meldestationen", + "Allow": 1, + "Icon": 1 + }, + { + "IdSystem": 2, + "Name": "ECI", + "Longname": "ECI Geräte", + "Allow": 1, + "Icon": 2 + }, + { + "IdSystem": 5, + "Name": "GSM Modem", + "Longname": "LR77 GSM Modems", + "Allow": 1, + "Icon": 5 + }, + { + "IdSystem": 6, + "Name": "Cisco Router", + "Longname": "Cisco Router", + "Allow": 1, + "Icon": 6 + }, + { + "IdSystem": 7, + "Name": "WAGO", + "Longname": "WAGO I/O Systeme", + "Allow": 1, + "Icon": 7 + }, + { + "IdSystem": 8, + "Name": "Siemens", + "Longname": "Siemens Notrufsystem", + "Allow": 0, + "Icon": 8 + }, + { + "IdSystem": 9, + "Name": "OTDR", + "Longname": "Glasfaserüberwachung OTU", + "Allow": 0, + "Icon": 9 + }, + { + "IdSystem": 10, + "Name": "WDM", + "Longname": " Wavelength Division Multiplexing", + "Allow": 0, + "Icon": 10 + }, + { + "IdSystem": 11, + "Name": "GMA", + "Longname": "Glättemeldeanlagen", + "Allow": 1, + "Icon": 11 + }, + { + "IdSystem": 13, + "Name": "Messstellen", + "Longname": "Messstellen", + "Allow": 0, + "Icon": 13 + }, + { + "IdSystem": 100, + "Name": "TALAS ICL", + "Longname": "Talas ICL Unterstationen", + "Allow": 1, + "Icon": 100 + }, + { + "IdSystem": 110, + "Name": "DAUZ", + "Longname": "Dauerzählstellen", + "Allow": 1, + "Icon": 110 + }, + { + "IdSystem": 111, + "Name": "SMS-Funkmodem", + "Longname": "SMS-Funkmodem", + "Allow": 0, + "Icon": 111 + }, + { + "IdSystem": 200, + "Name": "Sonstige", + "Longname": "Sonstige", + "Allow": 1, + "Icon": 200 + } + ], + "Rights": [ + { + "IdRight": 1 + }, + { + "IdRight": 2 + }, + { + "IdRight": 3 + }, + { + "IdRight": 5 + }, + { + "IdRight": 6 + }, + { + "IdRight": 7 + }, + { + "IdRight": 8 + }, + { + "IdRight": 10 + }, + { + "IdRight": 11 + }, + { + "IdRight": 12 + }, + { + "IdRight": 20 + }, + { + "IdRight": 22 + }, + { + "IdRight": 23 + }, + { + "IdRight": 25 + }, + { + "IdRight": 30 + }, + { + "IdRight": 40 + }, + { + "IdRight": 41 + }, + { + "IdRight": 42 + }, + { + "IdRight": 43 + }, + { + "IdRight": 44 + }, + { + "IdRight": 45 + }, + { + "IdRight": 46 + }, + { + "IdRight": 47 + }, + { + "IdRight": 48 + }, + { + "IdRight": 49 + }, + { + "IdRight": 50 + }, + { + "IdRight": 51 + }, + { + "IdRight": 52 + }, + { + "IdRight": 55 + }, + { + "IdRight": 56 + }, + { + "IdRight": 60 + }, + { + "IdRight": 61 + }, + { + "IdRight": 62 + }, + { + "IdRight": 63 + }, + { + "IdRight": 64 + }, + { + "IdRight": 65 + }, + { + "IdRight": 68 + }, + { + "IdRight": 69 + }, + { + "IdRight": 70 + }, + { + "IdRight": 71 + }, + { + "IdRight": 72 + }, + { + "IdRight": 73 + }, + { + "IdRight": 79 + }, + { + "IdRight": 80 + }, + { + "IdRight": 90 + }, + { + "IdRight": 93 + }, + { + "IdRight": 94 + }, + { + "IdRight": 95 + }, + { + "IdRight": 96 + } + ] +} + +// Export an async function handler for the API route. +export default async function handler(req, res) { + // Initialize an empty params object to store query parameters. + const params = { + idMap: req.query.idMap, + idUser: req.query.idUser + }; + + // Check if the requested ID map and user match certain conditions. + if (params.idMap === '10' && params.idUser === '484') { + // If the conditions are met, return the gisSystemStatic object with a 200 status code. + res.status(200).json(gisSystemStatic); + } else { + // If not, return a 404 error with the message "Not Found". + res.status(404).send('Not Found'); + } +}; \ No newline at end of file diff --git a/pages/api/talas5/webserviceMap/gisStationsMeasurementsSQL.js b/pages/api/talas5/webserviceMap/gisStationsMeasurementsSQL.js new file mode 100644 index 000000000..de3670b6d --- /dev/null +++ b/pages/api/talas5/webserviceMap/gisStationsMeasurementsSQL.js @@ -0,0 +1,70 @@ +import mysql from "mysql"; + +const dbConfig = { + host: process.env.DB_HOST, + user: process.env.DB_USER, + password: process.env.DB_PASSWORD, + database: process.env.DB_NAME, + port: process.env.DB_PORT, +}; + +const connection = mysql.createConnection(dbConfig); +connection.connect((err) => { + if (err) { + console.error("Fehler beim Verbinden:", err.stack); + return; + } + console.log("Database connected successfully."); +}); + +export default function handler(req, res) { + const idMap = req.query.idMap; + if (req.method !== "GET") { + return res.status(405).json({ error: "Nur GET Methode erlaubt" }); + } + + connection.query(` + SELECT + ld.idLD, + dp.idDP, + dp.name AS Na, + dp.value AS Val, + dp.unit AS Unit, + mg.name AS Gr, + ld.idLocation, + area.Name AS Area_Name + FROM location_device as ld + LEFT JOIN location_coordinates AS co ON ld.idLocation = co.idLocation and co.idMaps = ${idMap} + LEFT JOIN devices AS de ON de.idDevice = ld.idDevice + LEFT JOIN datapoint AS dp ON ld.idLD = dp.idLD + LEFT JOIN message_group AS mg ON dp.idmessage_group = mg.idmessage_group + LEFT JOIN location AS loc ON ld.idLocation = loc.idLocation + LEFT JOIN area AS area ON loc.idArea = area.idArea + WHERE co.X > 0 AND dp.idmessage_group>0 AND length(dp.unit)> 0 AND length(dp.value)> 0 + `, (error, results) => { + if (error) { + console.error("Fehler beim Abrufen der gis_lines:", error); + return res + .status(500) + .json({ error: "Fehler beim Abrufen der gis_lines" }); + } + + const response = { + "Name": "Liste aller Messungen der Geraete", + "Zeitstempel": new Date().toISOString(), + "IdMap":idMap, + "Statis": results.map((row) => ({ + IdLD: row.idLD, + IdDP: row.idDP, + Na: row.Na, + Val: row.Val, + Unit: row.Unit, + Gr: row.Gr, + IdLocation: row.IdLocation, + Area_Name: row.Area_Name, + })), + }; + + res.json(response); + }); +} \ No newline at end of file diff --git a/pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisStationsMeasurements.js b/pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisStationsMeasurements.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict.js b/pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisStationsStatusDistrict.js b/pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisStationsStatusDistrict.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisSystemStatic.js b/pages/api/talas_v5/ClientData/WebserviceMap.asmx/GisSystemStatic.js deleted file mode 100644 index e69de29bb..000000000