diff --git a/BackendWorkerService/Program.cs b/BackendWorkerService/Program.cs index af122ff..6177f06 100644 --- a/BackendWorkerService/Program.cs +++ b/BackendWorkerService/Program.cs @@ -97,47 +97,47 @@ namespace BackendWorkerService - #region 背景執行計畫(設定1min執行一次) - services.AddSingleton(); - services.AddSingleton( - new JobSchedule(jobType: typeof(ExecutionBackgroundServicePlanJob), cronExpression: configuration.GetValue("BackgroundServiceCron:ExecutionBackgroundServicePlanJob")) - ); - #endregion + //#region 背景執行計畫(設定1min執行一次) + //services.AddSingleton(); + //services.AddSingleton( + //new JobSchedule(jobType: typeof(ExecutionBackgroundServicePlanJob), cronExpression: configuration.GetValue("BackgroundServiceCron:ExecutionBackgroundServicePlanJob")) + //); + //#endregion - #region 訊息通知(設定每 30min 執行一次) - services.AddSingleton(); - services.AddSingleton( - new JobSchedule(jobType: typeof(MessageNotificationJob), cronExpression: configuration.GetValue("BackgroundServiceCron:MessageNotificationJob")) - ); - #endregion + //#region 訊息通知(設定每 30min 執行一次) + //services.AddSingleton(); + //services.AddSingleton( + //new JobSchedule(jobType: typeof(MessageNotificationJob), cronExpression: configuration.GetValue("BackgroundServiceCron:MessageNotificationJob")) + //); + //#endregion - #region 定時將特定資料表加入至派送任務(設定每日 2AM 執行一次) - services.AddSingleton(); - services.AddSingleton( - new JobSchedule(jobType: typeof(RegularUpdateDBTableJob), cronExpression: configuration.GetValue("BackgroundServiceCron:RegularUpdateDBTableJob")) - ); - #endregion + //#region 定時將特定資料表加入至派送任務(設定每日 2AM 執行一次) + //services.AddSingleton(); + //services.AddSingleton( + //new JobSchedule(jobType: typeof(RegularUpdateDBTableJob), cronExpression: configuration.GetValue("BackgroundServiceCron:RegularUpdateDBTableJob")) + //); + //#endregion - #region 資料派送(設定每 5min 執行一次) - services.AddSingleton(); - services.AddSingleton( - new JobSchedule(jobType: typeof(DataDeliveryJob), cronExpression: configuration.GetValue("BackgroundServiceCron:DataDeliveryJob")) - ); - #endregion + //#region 資料派送(設定每 5min 執行一次) + //services.AddSingleton(); + //services.AddSingleton( + //new JobSchedule(jobType: typeof(DataDeliveryJob), cronExpression: configuration.GetValue("BackgroundServiceCron:DataDeliveryJob")) + //); + //#endregion - #region 停車場管理(設定每 5秒 執行一次) - services.AddSingleton(); - services.AddSingleton( - new JobSchedule(jobType: typeof(ParkingJob), cronExpression: configuration.GetValue("BackgroundServiceCron:ParkingJob")) - ); - #endregion + //#region 停車場管理(設定每 5秒 執行一次) + //services.AddSingleton(); + //services.AddSingleton( + //new JobSchedule(jobType: typeof(ParkingJob), cronExpression: configuration.GetValue("BackgroundServiceCron:ParkingJob")) + //); + //#endregion - #region 電錶歸檔(設定每 小時 執行一次) - services.AddSingleton(); - services.AddSingleton( - new JobSchedule(jobType: typeof(ArchiveElectricMeterHourJob), cronExpression: configuration.GetValue("BackgroundServiceCron:ArchiveElectricMeterHourJob")) - ); - #endregion + //#region 電錶歸檔(設定每 小時 執行一次) + //services.AddSingleton(); + //services.AddSingleton( + //new JobSchedule(jobType: typeof(ArchiveElectricMeterHourJob), cronExpression: configuration.GetValue("BackgroundServiceCron:ArchiveElectricMeterHourJob")) + //); + //#endregion #region 電錶歸檔(設定每 天 執行一次) services.AddSingleton(); services.AddSingleton( diff --git a/BackendWorkerService/Quartz/Jobs/WeatherAPIJob.cs b/BackendWorkerService/Quartz/Jobs/WeatherAPIJob.cs index 8cf37f2..b375d16 100644 --- a/BackendWorkerService/Quartz/Jobs/WeatherAPIJob.cs +++ b/BackendWorkerService/Quartz/Jobs/WeatherAPIJob.cs @@ -200,71 +200,71 @@ namespace BackendWorkerService.Quartz.Jobs doc.Load("root/PowerfulRain.xml"); var json = JsonConvert.SerializeXmlNode(doc); var haveinfo = json.Split("info"); - if (haveinfo.Length > 2) - { - var observation = JsonConvert.DeserializeObject(json); - var area = observation.Alert.Info[0].Area.Where(a => a.Geocode.Value == "63").Select(a => a.AreaDesc).FirstOrDefault(); - var sql = $"select id from api_rain where msgType = '{observation.Alert.MsgType}' and onset = '{observation.Alert.Info[0].Onset.ToString("yyyy-MM-dd HH:mm:ss")}' and expires = '{observation.Alert.Info[0].Expires.ToString("yyyy-MM-dd HH:mm:ss")}'"; - var NeedCallApi = await backendRepository.GetOneAsync(sql); + //if (haveinfo.Length > 2) + //{ + // var observation = RainApi.Welcome.FromJson(json); + // var area = observation.Alert.Info[0].Area.Where(a => a.Geocode.Value == "63").Select(a => a.AreaDesc).FirstOrDefault(); + // var sql = $"select id from api_rain where msgType = '{observation.Alert.MsgType}' and onset = '{observation.Alert.Info[0].Onset.ToString("yyyy-MM-dd HH:mm:ss")}' and expires = '{observation.Alert.Info[0].Expires.ToString("yyyy-MM-dd HH:mm:ss")}'"; + // var NeedCallApi = await backendRepository.GetOneAsync(sql); - Dictionary RainAPIdb = new Dictionary() - { - { "@msgType", observation.Alert.MsgType}, - { "@headline", observation.Alert.Info[0].Headline}, - { "@areaDesc", area}, - { "@onset", observation.Alert.Info[0].Onset}, - { "@expires", observation.Alert.Info[0].Expires}, - { "@created_by", "system"}, - { "@created_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}, - }; - var id = await backendRepository.AddOneByCustomTableReturnId(RainAPIdb, "api_rain"); - if (NeedCallApi != 0) - { - var val = RainValue(observation.Alert.MsgType, observation.Alert.Info[0].Headline); - if (val < 5) - { - var ReStr = Fetch_PostWithJSONFormat($@"{obixApiConfig.ApiBase}obix/config/Arena/D2/CWB/L110/CAP/D2_CWB_L110_CAP_MET1/SeverityLEVL_RAIN/set", val.ToString()); - UpdatedNiagara("api_rain", ReStr, id); - } - } + // Dictionary RainAPIdb = new Dictionary() + // { + // { "@msgType", observation.Alert.MsgType}, + // { "@headline", observation.Alert.Info[0].Headline}, + // { "@areaDesc", area}, + // { "@onset", observation.Alert.Info[0].Onset}, + // { "@expires", observation.Alert.Info[0].Expires}, + // { "@created_by", "system"}, + // { "@created_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}, + // }; + // var id = await backendRepository.AddOneByCustomTableReturnId(RainAPIdb, "api_rain"); + // if (NeedCallApi != 0) + // { + // var val = RainValue(observation.Alert.MsgType, observation.Alert.Info[0].Headline); + // if (val < 5) + // { + // var ReStr = Fetch_PostWithJSONFormat($@"{obixApiConfig.ApiBase}obix/config/Arena/D2/CWB/L110/CAP/D2_CWB_L110_CAP_MET1/SeverityLEVL_RAIN/set", val.ToString()); + // UpdatedNiagara("api_rain", ReStr, id); + // } + // } - FolderFunction folderFunction = new FolderFunction(); - folderFunction.DeleteFile("root/PowerfulRain.xml"); - await task_Detail.InsertWorkTime_End("WeatherAPI", "api_rain"); - } - else - { - var observation = JsonConvert.DeserializeObject(json); - var area = observation.Alert.Info.Area.Where(a => a.Geocode.Value == "63").Select(a => a.AreaDesc).FirstOrDefault(); - var sql = $"select id from api_rain where msgType = '{observation.Alert.MsgType}' and onset = '{observation.Alert.Info.Onset.ToString("yyyy-MM-dd HH:mm:ss")}' and expires = '{observation.Alert.Info.Expires.ToString("yyyy-MM-dd HH:mm:ss")}'"; - var NeedCallApi = await backendRepository.GetOneAsync(sql); + // FolderFunction folderFunction = new FolderFunction(); + // folderFunction.DeleteFile("root/PowerfulRain.xml"); + // await task_Detail.InsertWorkTime_End("WeatherAPI", "api_rain"); + //} + //else + //{ + // var observation = RainApi.Welcome.FromJson(json); + // var area = observation.Alert.Info[0].Area.Where(a => a.Geocode.Value == "63").Select(a => a.AreaDesc).FirstOrDefault(); + // var sql = $"select id from api_rain where msgType = '{observation.Alert.MsgType}' and onset = '{observation.Alert.Info[0].Onset.ToString("yyyy-MM-dd HH:mm:ss")}' and expires = '{observation.Alert.Info[0].Expires.ToString("yyyy-MM-dd HH:mm:ss")}'"; + // var NeedCallApi = await backendRepository.GetOneAsync(sql); - Dictionary RainAPIdb = new Dictionary() - { - { "@msgType", observation.Alert.MsgType}, - { "@headline", observation.Alert.Info.Headline}, - { "@areaDesc", area}, - { "@onset", observation.Alert.Info.Onset.ToString("yyyy-MM-dd HH:mm:ss")}, - { "@expires", observation.Alert.Info.Expires.ToString("yyyy-MM-dd HH:mm:ss")}, - { "@created_by", "system"}, - { "@created_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}, - }; - var id = await backendRepository.AddOneByCustomTableReturnId(RainAPIdb, "api_rain"); - if (NeedCallApi != 0) - { - var val = RainValue(observation.Alert.MsgType, observation.Alert.Info.Headline); - if (val < 5) - { - var ReStr = Fetch_PostWithJSONFormat($@"{obixApiConfig.ApiBase}obix/config/Arena/D2/CWB/L110/CAP/D2_CWB_L110_CAP_MET1/SeverityLEVL_RAIN/set", val.ToString()); - UpdatedNiagara("api_rain", ReStr, id); - } - } + // Dictionary RainAPIdb = new Dictionary() + // { + // { "@msgType", observation.Alert.MsgType}, + // { "@headline", observation.Alert.Info[0].Headline}, + // { "@areaDesc", area}, + // { "@onset", observation.Alert.Info[0].Onset.ToString("yyyy-MM-dd HH:mm:ss")}, + // { "@expires", observation.Alert.Info[0].Expires.ToString("yyyy-MM-dd HH:mm:ss")}, + // { "@created_by", "system"}, + // { "@created_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}, + // }; + // var id = await backendRepository.AddOneByCustomTableReturnId(RainAPIdb, "api_rain"); + // if (NeedCallApi != 0) + // { + // var val = RainValue(observation.Alert.MsgType, observation.Alert.Info[0].Headline); + // if (val < 5) + // { + // var ReStr = Fetch_PostWithJSONFormat($@"{obixApiConfig.ApiBase}obix/config/Arena/D2/CWB/L110/CAP/D2_CWB_L110_CAP_MET1/SeverityLEVL_RAIN/set", val.ToString()); + // UpdatedNiagara("api_rain", ReStr, id); + // } + // } - FolderFunction folderFunction = new FolderFunction(); - folderFunction.DeleteFile("root/PowerfulRain.xml"); - await task_Detail.InsertWorkTime_End("WeatherAPI", "api_rain"); + // FolderFunction folderFunction = new FolderFunction(); + // folderFunction.DeleteFile("root/PowerfulRain.xml"); + // await task_Detail.InsertWorkTime_End("WeatherAPI", "api_rain"); - } + //} } catch (Exception ex) { @@ -284,71 +284,71 @@ namespace BackendWorkerService.Quartz.Jobs var json = JsonConvert.SerializeXmlNode(doc); var haveinfo = json.Split("info"); - if (haveinfo.Length > 2) - { - var observation = JsonConvert.DeserializeObject(json); - var area = observation.Alert.Info[0].Area.Where(a => a.Geocode.Value == "63").Select(a => a.AreaDesc).FirstOrDefault(); - var sql = $"select id from api_typhoon where msgType = '{observation.Alert.MsgType}' and onset = '{observation.Alert.Info[0].Onset.ToString("yyyy-MM-dd HH:mm:ss")}' and expires = '{observation.Alert.Info[0].Expires.ToString("yyyy-MM-dd HH:mm:ss")}'"; - var NeedCallApi = await backendRepository.GetOneAsync(sql); - Dictionary EarthquakeAPIdb = new Dictionary() - { - { "@msgType", observation.Alert.MsgType}, - { "@headline", observation.Alert.Info[0].Headline}, - { "@areaDesc", area}, - { "@urgency",observation.Alert.Info[0].Urgency}, - { "@severity",observation.Alert.Info[0].Severity}, - { "@onset", observation.Alert.Info[0].Onset}, - { "@expires", observation.Alert.Info[0].Expires}, - { "@created_by", "system"}, - { "@created_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}, - }; - var id = await backendRepository.AddOneByCustomTableReturnId(EarthquakeAPIdb, "api_typhoon"); - if (NeedCallApi != 0) - { - if (observation.Alert.Info[0].Urgency != null && observation.Alert.Info[0].Urgency != "Expected") - { + //if (haveinfo.Length > 2) + //{ + // var observation = TyphoonApi.Welcome.FromJson(json); + // var area = observation.Alert.Info.Area.Where(a => a.Geocode.Value == "63").Select(a => a.AreaDesc).FirstOrDefault(); + // var sql = $"select id from api_typhoon where msgType = '{observation.Alert.MsgType}' and onset = '{observation.Alert.Info[0].Onset.ToString("yyyy-MM-dd HH:mm:ss")}' and expires = '{observation.Alert.Info[0].Expires.ToString("yyyy-MM-dd HH:mm:ss")}'"; + // var NeedCallApi = await backendRepository.GetOneAsync(sql); + // Dictionary EarthquakeAPIdb = new Dictionary() + // { + // { "@msgType", observation.Alert.MsgType}, + // { "@headline", observation.Alert.Info[0].Headline}, + // { "@areaDesc", area}, + // { "@urgency",observation.Alert.Info[0].Urgency}, + // { "@severity",observation.Alert.Info[0].Severity}, + // { "@onset", observation.Alert.Info[0].Onset}, + // { "@expires", observation.Alert.Info[0].Expires}, + // { "@created_by", "system"}, + // { "@created_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}, + // }; + // var id = await backendRepository.AddOneByCustomTableReturnId(EarthquakeAPIdb, "api_typhoon"); + // if (NeedCallApi != 0) + // { + // if (observation.Alert.Info[0].Urgency != null && observation.Alert.Info[0].Urgency != "Expected") + // { - var ReStr = Fetch_PostWithJSONFormat($@"{obixApiConfig.ApiBase}obix/config/Arena/D2/CWB/L110/CAP/D2_CWB_L110_CAP_MET2/SeverityLEVL_Typhoon/set", observation.Alert.Info[0].Urgency); - UpdatedNiagara("api_typhoon", ReStr, id); - } - } - FolderFunction folderFunction = new FolderFunction(); - folderFunction.DeleteFile("root/Typhoon.xml"); - await task_Detail.InsertWorkTime_End("WeatherAPI", "api_typhoon"); - } - else - { - var observation = JsonConvert.DeserializeObject(json); - var area = observation.Alert.Info.Area.Where(a => a.Geocode.Value == "63").Select(a => a.AreaDesc).FirstOrDefault(); - var sql = $"select id from api_typhoon where msgType = '{observation.Alert.MsgType}' and onset = '{observation.Alert.Info.Onset.ToString("yyyy-MM-dd HH:mm:ss")}' and expires = '{observation.Alert.Info.Expires.ToString("yyyy-MM-dd HH:mm:ss")}'"; - var NeedCallApi = await backendRepository.GetOneAsync(sql); - Dictionary EarthquakeAPIdb = new Dictionary() - { - { "@msgType", observation.Alert.MsgType}, - { "@headline", observation.Alert.Info.Headline}, - { "@areaDesc", area}, - { "@urgency",observation.Alert.Info.Urgency}, - { "@severity",observation.Alert.Info.Severity}, - { "@onset", observation.Alert.Info.Onset.ToString("yyyy-MM-dd HH:mm:ss")}, - { "@expires", observation.Alert.Info.Expires.ToString("yyyy-MM-dd HH:mm:ss")}, - { "@created_by", "system"}, - { "@created_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}, - }; - var id = await backendRepository.AddOneByCustomTableReturnId(EarthquakeAPIdb, "api_typhoon"); - if (NeedCallApi != 0) - { - if (observation.Alert.Info.Urgency != null && observation.Alert.Info.Urgency != "Expected") - { + // var ReStr = Fetch_PostWithJSONFormat($@"{obixApiConfig.ApiBase}obix/config/Arena/D2/CWB/L110/CAP/D2_CWB_L110_CAP_MET2/SeverityLEVL_Typhoon/set", observation.Alert.Info[0].Urgency); + // UpdatedNiagara("api_typhoon", ReStr, id); + // } + // } + // FolderFunction folderFunction = new FolderFunction(); + // folderFunction.DeleteFile("root/Typhoon.xml"); + // await task_Detail.InsertWorkTime_End("WeatherAPI", "api_typhoon"); + //} + //else + //{ + // var observation = TyphoonApi.Welcome.FromJson(json); + // //var area = observation.Alert.Info.Area.Where(a => a.Geocode.Value == "63").Select(a => a.AreaDesc).FirstOrDefault(); + // var sql = $"select id from api_typhoon where msgType = '{observation.Alert.MsgType}' and onset = '{observation.Alert.Info.Onset.ToString("yyyy-MM-dd HH:mm:ss")}' and expires = '{observation.Alert.Info.Expires.ToString("yyyy-MM-dd HH:mm:ss")}'"; + // var NeedCallApi = await backendRepository.GetOneAsync(sql); + // Dictionary EarthquakeAPIdb = new Dictionary() + // { + // { "@msgType", observation.Alert.MsgType}, + // { "@headline", observation.Alert.Info.Headline}, + // //{ "@areaDesc", area}, + // { "@urgency",observation.Alert.Info.Urgency}, + // { "@severity",observation.Alert.Info.Severity}, + // { "@onset", observation.Alert.Info.Onset.ToString("yyyy-MM-dd HH:mm:ss")}, + // { "@expires", observation.Alert.Info.Expires.ToString("yyyy-MM-dd HH:mm:ss")}, + // { "@created_by", "system"}, + // { "@created_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}, + // }; + // var id = await backendRepository.AddOneByCustomTableReturnId(EarthquakeAPIdb, "api_typhoon"); + // if (NeedCallApi != 0) + // { + // if (observation.Alert.Info.Urgency != null && observation.Alert.Info.Urgency != "Expected") + // { - var ReStr = Fetch_PostWithJSONFormat($@"{obixApiConfig.ApiBase}obix/config/Arena/D2/CWB/L110/CAP/D2_CWB_L110_CAP_MET2/SeverityLEVL_Typhoon/set", observation.Alert.Info.Urgency); - UpdatedNiagara("api_typhoon", ReStr, id); - } - } - FolderFunction folderFunction = new FolderFunction(); - folderFunction.DeleteFile("root/Typhoon.xml"); - await task_Detail.InsertWorkTime_End("WeatherAPI", "api_typhoon"); + // var ReStr = Fetch_PostWithJSONFormat($@"{obixApiConfig.ApiBase}obix/config/Arena/D2/CWB/L110/CAP/D2_CWB_L110_CAP_MET2/SeverityLEVL_Typhoon/set", observation.Alert.Info.Urgency); + // UpdatedNiagara("api_typhoon", ReStr, id); + // } + // } + // FolderFunction folderFunction = new FolderFunction(); + // folderFunction.DeleteFile("root/Typhoon.xml"); + // await task_Detail.InsertWorkTime_End("WeatherAPI", "api_typhoon"); - } + //} } catch (Exception ex) diff --git a/BackendWorkerService/Services/Implement/RainApi.cs b/BackendWorkerService/Services/Implement/RainApi.cs new file mode 100644 index 0000000..ec870f9 --- /dev/null +++ b/BackendWorkerService/Services/Implement/RainApi.cs @@ -0,0 +1,228 @@ +嚜簑sing System; +using System.Collections.Generic; +using System.Text; + +// +// +// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: +// +// using QuickType; +// +// var welcome = Welcome.FromJson(jsonString); + +namespace RainApi +{ + using System; + using System.Collections.Generic; + + using System.Globalization; + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + + public partial class Welcome + { + [JsonProperty("?xml")] + public Xml Xml { get; set; } + + [JsonProperty("alert")] + public Alert Alert { get; set; } + } + + public partial class Alert + { + [JsonProperty("@xmlns")] + public string Xmlns { get; set; } + + [JsonProperty("identifier")] + public string Identifier { get; set; } + + [JsonProperty("sender")] + public string Sender { get; set; } + + [JsonProperty("sent")] + public DateTimeOffset Sent { get; set; } + + [JsonProperty("status")] + public string Status { get; set; } + + [JsonProperty("msgType")] + public string MsgType { get; set; } + + [JsonProperty("scope")] + public string Scope { get; set; } + + [JsonProperty("references")] + public string References { get; set; } + + [JsonProperty("info")] + public Info[] Info { get; set; } + } + + public partial class Info + { + [JsonProperty("language")] + public string Language { get; set; } + + [JsonProperty("category")] + public string Category { get; set; } + + [JsonProperty("event")] + public string Event { get; set; } + + [JsonProperty("responseType")] + public string ResponseType { get; set; } + + [JsonProperty("urgency")] + public string Urgency { get; set; } + + [JsonProperty("severity")] + public string Severity { get; set; } + + [JsonProperty("certainty")] + public string Certainty { get; set; } + + [JsonProperty("eventCode")] + public EventCode EventCode { get; set; } + + [JsonProperty("effective")] + public DateTimeOffset Effective { get; set; } + + [JsonProperty("onset")] + public DateTimeOffset Onset { get; set; } + + [JsonProperty("expires")] + public DateTimeOffset Expires { get; set; } + + [JsonProperty("senderName")] + public string SenderName { get; set; } + + [JsonProperty("headline")] + public string Headline { get; set; } + + [JsonProperty("description")] + public string Description { get; set; } + + [JsonProperty("web")] + public Uri Web { get; set; } + + [JsonProperty("parameter")] + public EventCode[] Parameter { get; set; } + + [JsonProperty("area")] + public Area[] Area { get; set; } + } + + public partial class Area + { + [JsonProperty("areaDesc")] + public string AreaDesc { get; set; } + + [JsonProperty("geocode")] + public EventCode Geocode { get; set; } + } + + public partial class EventCode + { + [JsonProperty("valueName")] + public ValueName ValueName { get; set; } + + [JsonProperty("value")] + public string Value { get; set; } + } + + public partial class Xml + { + [JsonProperty("@version")] + public string Version { get; set; } + + [JsonProperty("@encoding")] + public string Encoding { get; set; } + } + + public enum ValueName { AlertColor, AlertTitle, ProfileCapTwpEvent10, SeverityLevel, TaiwanGeocode103, WebsiteColor }; + + public partial class Welcome + { + public static Welcome FromJson(string json) => JsonConvert.DeserializeObject(json, QuickType.Converter.Settings); + } + + public static class Serialize + { + public static string ToJson(this Welcome self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings); + } + + internal static class Converter + { + public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings + { + MetadataPropertyHandling = MetadataPropertyHandling.Ignore, + DateParseHandling = DateParseHandling.None, + Converters = + { + ValueNameConverter.Singleton, + new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } + }, + }; + } + + internal class ValueNameConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(ValueName) || t == typeof(ValueName?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + switch (value) + { + case "Taiwan_Geocode_103": + return ValueName.TaiwanGeocode103; + case "alert_color": + return ValueName.AlertColor; + case "alert_title": + return ValueName.AlertTitle; + case "profile:CAP-TWP:Event:1.0": + return ValueName.ProfileCapTwpEvent10; + case "severity_level": + return ValueName.SeverityLevel; + case "website_color": + return ValueName.WebsiteColor; + } + throw new Exception("Cannot unmarshal type ValueName"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (ValueName)untypedValue; + switch (value) + { + case ValueName.TaiwanGeocode103: + serializer.Serialize(writer, "Taiwan_Geocode_103"); + return; + case ValueName.AlertColor: + serializer.Serialize(writer, "alert_color"); + return; + case ValueName.AlertTitle: + serializer.Serialize(writer, "alert_title"); + return; + case ValueName.ProfileCapTwpEvent10: + serializer.Serialize(writer, "profile:CAP-TWP:Event:1.0"); + return; + case ValueName.SeverityLevel: + serializer.Serialize(writer, "severity_level"); + return; + case ValueName.WebsiteColor: + serializer.Serialize(writer, "website_color"); + return; + } + throw new Exception("Cannot marshal type ValueName"); + } + + public static readonly ValueNameConverter Singleton = new ValueNameConverter(); + } +} diff --git a/BackendWorkerService/Services/Implement/TyphoonApi.cs b/BackendWorkerService/Services/Implement/TyphoonApi.cs new file mode 100644 index 0000000..07c8546 --- /dev/null +++ b/BackendWorkerService/Services/Implement/TyphoonApi.cs @@ -0,0 +1,283 @@ +嚜簑sing System; +using System.Collections.Generic; +using System.Text; + +// +// +// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: +// +// using QuickType; +// +// var welcome = Welcome.FromJson(jsonString); + +namespace TyphoonApi +{ + using System; + using System.Collections.Generic; + + using System.Globalization; + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + + public partial class Welcome + { + [JsonProperty("?xml")] + public Xml Xml { get; set; } + + [JsonProperty("alert")] + public Alert Alert { get; set; } + } + + public partial class Alert + { + [JsonProperty("@xmlns")] + public string Xmlns { get; set; } + + [JsonProperty("identifier")] + public string Identifier { get; set; } + + [JsonProperty("sender")] + public string Sender { get; set; } + + [JsonProperty("sent")] + public DateTimeOffset Sent { get; set; } + + [JsonProperty("status")] + public string Status { get; set; } + + [JsonProperty("msgType")] + public string MsgType { get; set; } + + [JsonProperty("scope")] + public string Scope { get; set; } + + [JsonProperty("references")] + public string References { get; set; } + + [JsonProperty("info")] + public Info Info { get; set; } + } + + public partial class Info + { + [JsonProperty("language")] + public string Language { get; set; } + + [JsonProperty("category")] + public string Category { get; set; } + + [JsonProperty("event")] + public string Event { get; set; } + + [JsonProperty("responseType")] + public string ResponseType { get; set; } + + [JsonProperty("urgency")] + public string Urgency { get; set; } + + [JsonProperty("severity")] + public string Severity { get; set; } + + [JsonProperty("certainty")] + public string Certainty { get; set; } + + [JsonProperty("eventCode")] + public EventCode EventCode { get; set; } + + [JsonProperty("effective")] + public DateTimeOffset Effective { get; set; } + + [JsonProperty("onset")] + public DateTimeOffset Onset { get; set; } + + [JsonProperty("expires")] + public DateTimeOffset Expires { get; set; } + + [JsonProperty("senderName")] + public string SenderName { get; set; } + + [JsonProperty("headline")] + public string Headline { get; set; } + + [JsonProperty("description")] + public Description Description { get; set; } + + [JsonProperty("web")] + public Uri Web { get; set; } + + [JsonProperty("parameter")] + public EventCode[] Parameter { get; set; } + + [JsonProperty("area")] + public Area[] Area { get; set; } + } + + public partial class Area + { + [JsonProperty("areaDesc")] + public string AreaDesc { get; set; } + + [JsonProperty("polygon")] + public string Polygon { get; set; } + } + + public partial class Description + { + [JsonProperty("typhoon-info")] + public TyphoonInfo TyphoonInfo { get; set; } + + [JsonProperty("section")] + public DescriptionSection[] Section { get; set; } + } + + public partial class DescriptionSection + { + [JsonProperty("@title")] + public string Title { get; set; } + + [JsonProperty("#text")] + public string Text { get; set; } + } + + public partial class TyphoonInfo + { + [JsonProperty("section")] + public TyphoonInfoSection[] Section { get; set; } + } + + public partial class TyphoonInfoSection + { + [JsonProperty("@title")] + public string Title { get; set; } + + [JsonProperty("#text", NullValueHandling = NullValueHandling.Ignore)] + public string Text { get; set; } + + [JsonProperty("typhoon_name", NullValueHandling = NullValueHandling.Ignore)] + public string TyphoonName { get; set; } + + [JsonProperty("cwb_typhoon_name", NullValueHandling = NullValueHandling.Ignore)] + public string CwbTyphoonName { get; set; } + + [JsonProperty("analysis", NullValueHandling = NullValueHandling.Ignore)] + public Analysis Analysis { get; set; } + + [JsonProperty("prediction", NullValueHandling = NullValueHandling.Ignore)] + public Analysis Prediction { get; set; } + } + + public partial class Analysis + { + [JsonProperty("time")] + public DateTimeOffset Time { get; set; } + + [JsonProperty("position")] + public string Position { get; set; } + + [JsonProperty("max_winds")] + public Gust MaxWinds { get; set; } + + [JsonProperty("gust")] + public Gust Gust { get; set; } + + [JsonProperty("pressure")] + public Gust Pressure { get; set; } + + [JsonProperty("radius_of_15mps")] + public Gust RadiusOf15Mps { get; set; } + + [JsonProperty("scale", NullValueHandling = NullValueHandling.Ignore)] + public Scale[] Scale { get; set; } + } + + public partial class Gust + { + [JsonProperty("@unit")] + public string Unit { get; set; } + + [JsonProperty("#text")] + [JsonConverter(typeof(ParseStringConverter))] + public long Text { get; set; } + } + + public partial class Scale + { + [JsonProperty("@lang")] + public string Lang { get; set; } + + [JsonProperty("#text")] + public string Text { get; set; } + } + + public partial class EventCode + { + [JsonProperty("valueName")] + public string ValueName { get; set; } + + [JsonProperty("value")] + public string Value { get; set; } + } + + public partial class Xml + { + [JsonProperty("@version")] + public string Version { get; set; } + + [JsonProperty("@encoding")] + public string Encoding { get; set; } + } + + public partial class Welcome + { + public static Welcome FromJson(string json) => JsonConvert.DeserializeObject(json, QuickType.Converter.Settings); + } + + public static class Serialize + { + public static string ToJson(this Welcome self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings); + } + + internal static class Converter + { + public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings + { + MetadataPropertyHandling = MetadataPropertyHandling.Ignore, + DateParseHandling = DateParseHandling.None, + Converters = + { + new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } + }, + }; + } + + internal class ParseStringConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(long) || t == typeof(long?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Null) return null; + var value = serializer.Deserialize(reader); + long l; + if (Int64.TryParse(value, out l)) + { + return l; + } + throw new Exception("Cannot unmarshal type long"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + if (untypedValue == null) + { + serializer.Serialize(writer, null); + return; + } + var value = (long)untypedValue; + serializer.Serialize(writer, value.ToString()); + return; + } + + public static readonly ParseStringConverter Singleton = new ParseStringConverter(); + } +} diff --git a/BackendWorkerService/root/PowerfulRain.xml b/BackendWorkerService/root/PowerfulRain.xml new file mode 100644 index 0000000..d650403 --- /dev/null +++ b/BackendWorkerService/root/PowerfulRain.xml @@ -0,0 +1,1155 @@ + + + + CWB-Weather_extremely-rain_202305311525001 + weather@cwb.gov.tw + 2023-05-31T15:33:17+08:00 + Actual + Update + Public + weather@cwb.gov.tw,CWB-Weather_extremely-rain_202305311515001,2023-05-31T15:23:25+08:00 weather@cwb.gov.tw,CWB-Weather_extremely-rain_202305311455001,2023-05-31T15:03:04+08:00 weather@cwb.gov.tw,CWB-Weather_extremely-rain_202305311310001,2023-05-31T13:18:35+08:00 weather@cwb.gov.tw,CWB-Weather_extremely-rain_202305311305001,2023-05-31T13:10:42+08:00 weather@cwb.gov.tw,CWB-Weather_extremely-rain_202305311150001,2023-05-31T11:55:41+08:00 weather@cwb.gov.tw,CWB-Weather_extremely-rain_202305311050001,2023-05-31T10:55:42+08:00 weather@cwb.gov.tw,CWB-Weather_extremely-rain_202305310915001,2023-05-31T09:22:56+08:00 + + zh-TW + Met + + Monitor + Expected + Severe + Likely + + profile:CAP-TWP:Event:1.0 + rainfall + + 2023-05-31T15:25:00+08:00 + 2023-05-31T15:29:00+08:00 + 2023-05-31T23:00:00+08:00 + 銝剖亢瘞鞊∪ + 鞊芷函孵 + +憸梢◢憭唳敶梢踹敺撠瘚脩頂澆箇嚗剖辣撘琿剁隞嚗嚗嚗嚗交啣撣獢撣撅勗摰剔腦撅勗箔葉撣撅勗撅典之冽鞊芷函潛嚗憭扯箏獢啁姘梯柴箏擃啣撅勗(憟撅勗)撅典之函潛璈嚗隢瘜冽瑟撘琿憸典皞芣偌湔撞嚗撅勗隢瘜冽賜喳嫘 + + https://www.cwb.gov.tw/V8/C/P/Warning/FIFOWS.html + + alert_title + 鞊芷函孵 + + + severity_level + 鞊芷 + + + alert_color + + + + website_color + 255,128,0 + + + + 粹撣摰璅 + + Taiwan_Geocode_103 + 1001706 + + + 粹撣靽∠儔 + + Taiwan_Geocode_103 + 1001707 + + + 粹撣隞 + + Taiwan_Geocode_103 + 1001704 + + + 粹撣 + + Taiwan_Geocode_103 + 1001703 + + + 粹撣銝剜迤 + + Taiwan_Geocode_103 + 1001701 + + + 粹撣銝剖控 + + Taiwan_Geocode_103 + 1001705 + + + 粹撣銝萄 + + Taiwan_Geocode_103 + 1001702 + + + 箔葉撣啁冗 + + Taiwan_Geocode_103 + 6601900 + + + 箔葉撣勗W + + Taiwan_Geocode_103 + 6601000 + + + 摰剔腦瞉喲 + + Taiwan_Geocode_103 + 1000212 + + + 摰剔腦憭批 + + Taiwan_Geocode_103 + 1000211 + + + 啣撣瘛⊥偌 + + Taiwan_Geocode_103 + 6501000 + + + 箔葉撣憭芸像 + + Taiwan_Geocode_103 + 6602700 + + + 箔葉撣喳瓷 + + Taiwan_Geocode_103 + 6602000 + + + 箔葉撣撟喳 + + Taiwan_Geocode_103 + 6602900 + + + 啣撣祇 + + Taiwan_Geocode_103 + 6502800 + + + 啣撣靘 + + Taiwan_Geocode_103 + 6502900 + + + 啣撣芣 + + Taiwan_Geocode_103 + 6502000 + + + 啣撣銝 + + Taiwan_Geocode_103 + 6502100 + + + 啣撣喲 + + Taiwan_Geocode_103 + 6502200 + + + 啣撣恍 + + Taiwan_Geocode_103 + 6502300 + + + 啣撣撟單漯 + + Taiwan_Geocode_103 + 6502400 + + + 啣撣鞎W祚 + + Taiwan_Geocode_103 + 6502600 + + + 啣撣撅勗 + + Taiwan_Geocode_103 + 6502700 + + + 啣撣鈭∪ + + Taiwan_Geocode_103 + 6501500 + + + 啣撣瘣脣 + + Taiwan_Geocode_103 + 6501400 + + + 啣撣 + + Taiwan_Geocode_103 + 6501700 + + + 啣撣瘜啣控 + + Taiwan_Geocode_103 + 6501600 + + + 啣撣瘙甇W + + Taiwan_Geocode_103 + 6501100 + + + 啣撣 + + Taiwan_Geocode_103 + 6501300 + + + 啣撣喳 + + Taiwan_Geocode_103 + 6501200 + + + 啣撣喟 + + Taiwan_Geocode_103 + 6501900 + + + 啣撣瘛勗 + + Taiwan_Geocode_103 + 6501800 + + + 啣撣皞芸 + + Taiwan_Geocode_103 + 6502500 + + + 獢撣敺抵 + + Taiwan_Geocode_103 + 6801300 + + + 啣撣銝 + + Taiwan_Geocode_103 + 6500200 + + + 啣撣銝剖 + + Taiwan_Geocode_103 + 6500300 + + + 啣撣踵 + + Taiwan_Geocode_103 + 6500100 + + + 啣撣啣 + + Taiwan_Geocode_103 + 6500600 + + + 啣撣璅寞 + + Taiwan_Geocode_103 + 6500700 + + + 啣撣瘞詨 + + Taiwan_Geocode_103 + 6500400 + + + 啣撣啗 + + Taiwan_Geocode_103 + 6500500 + + + 啣撣曊舀 + + Taiwan_Geocode_103 + 6500800 + + + 啣撣銝撜賢 + + Taiwan_Geocode_103 + 6500900 + + + + + + zh-TW + Met + + Monitor + Future + Moderate + Likely + + profile:CAP-TWP:Event:1.0 + rainfall + + 2023-05-31T15:25:00+08:00 + 2023-05-31T15:29:00+08:00 + 2023-05-31T23:00:00+08:00 + 銝剖亢瘞鞊∪ + 鞊芷函孵 + +憸梢◢憭唳敶梢踹敺撠瘚脩頂澆箇嚗剖辣撘琿剁隞嚗嚗嚗嚗交啣撣獢撣撅勗摰剔腦撅勗箔葉撣撅勗撅典之冽鞊芷函潛嚗憭扯箏獢啁姘梯柴箏擃啣撅勗(憟撅勗)撅典之函潛璈嚗隢瘜冽瑟撘琿憸典皞芣偌湔撞嚗撅勗隢瘜冽賜喳嫘 + + https://www.cwb.gov.tw/V8/C/P/Warning/FIFOWS.html + + alert_title + 憭折函孵 + + + severity_level + 憭折 + + + alert_color + + + + website_color + 255,255,0 + + + + 擃撣啗 + + Taiwan_Geocode_103 + 6400600 + + + 擃撣桀 + + Taiwan_Geocode_103 + 6400900 + + + 獢撣憭扳漯 + + Taiwan_Geocode_103 + 6800300 + + + 獢撣銝剖ㄑ + + Taiwan_Geocode_103 + 6800200 + + + 擃撣曌撅勗 + + Taiwan_Geocode_103 + 6400200 + + + 箏撣銝剖控 + + Taiwan_Geocode_103 + 6300400 + + + 箏撣摰啣 + + Taiwan_Geocode_103 + 6701000 + + + 箏撣 + + Taiwan_Geocode_103 + 6701900 + + + 箏撣啣 + + Taiwan_Geocode_103 + 6701800 + + + 箏撣摮貊脣 + + Taiwan_Geocode_103 + 6701300 + + + 箏撣雿喲 + + Taiwan_Geocode_103 + 6701200 + + + 箏撣憭批批 + + Taiwan_Geocode_103 + 6701100 + + + 獢撣憭批 + + Taiwan_Geocode_103 + 6800600 + + + 箏撣 + + Taiwan_Geocode_103 + 6701700 + + + 箏撣撠頠 + + Taiwan_Geocode_103 + 6701600 + + + 箏撣銝∪ + + Taiwan_Geocode_103 + 6701500 + + + 箏撣镼踵葛 + + Taiwan_Geocode_103 + 6701400 + + + 擃撣撠皜臬 + + Taiwan_Geocode_103 + 6401100 + + + 箏撣銝剜迤 + + Taiwan_Geocode_103 + 6300500 + + + 箏撣 + + Taiwan_Geocode_103 + 6301200 + + + 擃撣銝瘞 + + Taiwan_Geocode_103 + 6400500 + + + 箏撣銝 + + Taiwan_Geocode_103 + 6700800 + + + 箏撣剔脣 + + Taiwan_Geocode_103 + 6700900 + + + 箏撣啁 + + Taiwan_Geocode_103 + 6700100 + + + 箏撣暽賣偌 + + Taiwan_Geocode_103 + 6700200 + + + 箏撣賣眾 + + Taiwan_Geocode_103 + 6700300 + + + 箏撣喟 + + Taiwan_Geocode_103 + 6700400 + + + 箏撣敺憯 + + Taiwan_Geocode_103 + 6700500 + + + 箏撣勗控 + + Taiwan_Geocode_103 + 6700600 + + + 箏撣暻餉 + + Taiwan_Geocode_103 + 6700700 + + + 箏撣曉控 + + Taiwan_Geocode_103 + 6300100 + + + 梯桃腦皞芷 + + Taiwan_Geocode_103 + 1001513 + + + 梯桃腦祆旨 + + Taiwan_Geocode_103 + 1001512 + + + 梯桃腦蝘 + + Taiwan_Geocode_103 + 1001511 + + + 梯桃腦撖 + + Taiwan_Geocode_103 + 1001510 + + + 擃撣暽賢 + + Taiwan_Geocode_103 + 6400100 + + + 箏撣摰 + + Taiwan_Geocode_103 + 6703500 + + + 箏撣 + + Taiwan_Geocode_103 + 6703400 + + + 箏撣銝剛正 + + Taiwan_Geocode_103 + 6703700 + + + 擃撣敶 + + Taiwan_Geocode_103 + 6402800 + + + 箏撣瘞詨熒 + + Taiwan_Geocode_103 + 6703100 + + + 箏撣樴撏 + + Taiwan_Geocode_103 + 6703000 + + + 箏撣 + + Taiwan_Geocode_103 + 6703300 + + + 箏撣勗 + + Taiwan_Geocode_103 + 6703200 + + + 擃撣輯桀 + + Taiwan_Geocode_103 + 6402300 + + + 擃撣啣祚 + + Taiwan_Geocode_103 + 6402200 + + + 擃撣撌W + + Taiwan_Geocode_103 + 6402100 + + + 擃撣璈剖 + + Taiwan_Geocode_103 + 6402000 + + + 擃撣瘞詨 + + Taiwan_Geocode_103 + 6402700 + + + 擃撣 + + Taiwan_Geocode_103 + 6402600 + + + 擃撣皝批 + + Taiwan_Geocode_103 + 6402500 + + + 擃撣頝舐姘 + + Taiwan_Geocode_103 + 6402400 + + + 箏撣憭批 + + Taiwan_Geocode_103 + 6300600 + + + 擃撣 + + Taiwan_Geocode_103 + 6403400 + + + 箏撣憯急 + + Taiwan_Geocode_103 + 6301100 + + + 梯桃腦啣 + + Taiwan_Geocode_103 + 1001504 + + + 擃撣璆璇 + + Taiwan_Geocode_103 + 6400400 + + + 梯桃腦憯質 + + Taiwan_Geocode_103 + 1001506 + + + 梯桃腦敺拚 + + Taiwan_Geocode_103 + 1001507 + + + 梯桃腦梯桀 + + Taiwan_Geocode_103 + 1001501 + + + 梯桃腦曈單 + + Taiwan_Geocode_103 + 1001502 + + + 梯桃腦 + + Taiwan_Geocode_103 + 1001503 + + + 梯桃腦鞊瞈梢 + + Taiwan_Geocode_103 + 1001508 + + + 梯桃腦蝛 + + Taiwan_Geocode_103 + 1001509 + + + 擃撣芸 + + Taiwan_Geocode_103 + 6403800 + + + 箏撣鈭 + + Taiwan_Geocode_103 + 6702300 + + + 箏撣啣 + + Taiwan_Geocode_103 + 6702000 + + + 箏撣摰摰 + + Taiwan_Geocode_103 + 6702100 + + + 箏撣撌阡桀 + + Taiwan_Geocode_103 + 6702600 + + + 箏撣隞敺瑕 + + Taiwan_Geocode_103 + 6702700 + + + 箏撣璆镼踹 + + Taiwan_Geocode_103 + 6702400 + + + 箏撣 + + Taiwan_Geocode_103 + 6702500 + + + 擃撣撅勗 + + Taiwan_Geocode_103 + 6403000 + + + 擃撣蝢瞈 + + Taiwan_Geocode_103 + 6403100 + + + 擃撣剝 + + Taiwan_Geocode_103 + 6403200 + + + 箏撣撱 + + Taiwan_Geocode_103 + 6702900 + + + 箏撣撅勗 + + Taiwan_Geocode_103 + 6300800 + + + 擃撣折 + + Taiwan_Geocode_103 + 6403500 + + + 擃撣 + + Taiwan_Geocode_103 + 6403600 + + + 擃撣獢皞 + + Taiwan_Geocode_103 + 6403700 + + + 箏撣靽∠儔 + + Taiwan_Geocode_103 + 6300200 + + + 蝮瘞湧 + + Taiwan_Geocode_103 + 1000811 + + + 蝮憪 + + Taiwan_Geocode_103 + 1000810 + + + 蝮隞 + + Taiwan_Geocode_103 + 1000813 + + + 蝮靽∠儔 + + Taiwan_Geocode_103 + 1000812 + + + 啁姘蝮 + + Taiwan_Geocode_103 + 1000409 + + + 擃撣 + + Taiwan_Geocode_103 + 6400800 + + + 箏撣撅曹 + + Taiwan_Geocode_103 + 6702200 + + + 啁姘蝮撜函 + + Taiwan_Geocode_103 + 1000411 + + + 啁姘蝮撖嗅控 + + Taiwan_Geocode_103 + 1000410 + + + 啁姘蝮鈭撜圈 + + Taiwan_Geocode_103 + 1000413 + + + 啁姘蝮撠喲 + + Taiwan_Geocode_103 + 1000412 + + + 獢撣樴瞏剖 + + Taiwan_Geocode_103 + 6800900 + + + 擃撣 + + Taiwan_Geocode_103 + 6401300 + + + 擃撣憭抒冗 + + Taiwan_Geocode_103 + 6401600 + + + 擃撣隞甇血 + + Taiwan_Geocode_103 + 6401700 + + + 擃撣憭批祚 + + Taiwan_Geocode_103 + 6401400 + + + 擃撣憭扳邦 + + Taiwan_Geocode_103 + 6401500 + + + 獢撣獢 + + Taiwan_Geocode_103 + 6800100 + + + 擃撣曈交曉 + + Taiwan_Geocode_103 + 6401800 + + + 擃撣撗∪控 + + Taiwan_Geocode_103 + 6401900 + + + 獢撣蝡孵 + + Taiwan_Geocode_103 + 6800500 + + + 獢撣璆璇 + + Taiwan_Geocode_103 + 6800400 + + + 獢撣樴撅勗 + + Taiwan_Geocode_103 + 6800700 + + + 箏撣扳 + + Taiwan_Geocode_103 + 6301000 + + + 箏撣皜臬 + + Taiwan_Geocode_103 + 6300900 + + + 箏撣甇訾 + + Taiwan_Geocode_103 + 6702800 + + + 啁姘蝮璈怠控 + + Taiwan_Geocode_103 + 1000408 + + + 擃撣脖 + + Taiwan_Geocode_103 + 6403300 + + + 獢撣閫喳 + + Taiwan_Geocode_103 + 6801200 + + + 獢撣撟喲桀 + + Taiwan_Geocode_103 + 6801000 + + + 獢撣啣 + + Taiwan_Geocode_103 + 6801100 + + + 啁姘蝮蝡寞梢 + + Taiwan_Geocode_103 + 1000402 + + + 啁姘蝮啣 + + Taiwan_Geocode_103 + 1000403 + + + 擃撣 + + Taiwan_Geocode_103 + 6400700 + + + 啁姘蝮蝡孵撣 + + Taiwan_Geocode_103 + 1000401 + + + 啁姘蝮啗 + + Taiwan_Geocode_103 + 1000406 + + + 啁姘蝮 + + Taiwan_Geocode_103 + 1000407 + + + 啁姘蝮镼輸 + + Taiwan_Geocode_103 + 1000404 + + + 啁姘蝮皝 + + Taiwan_Geocode_103 + 1000405 + + + 箏撣祈臬 + + Taiwan_Geocode_103 + 6300700 + + + 箏撣憭批 + + Taiwan_Geocode_103 + 6300300 + + + 擃撣撌衣 + + Taiwan_Geocode_103 + 6400300 + + + 蝮暽輯健 + + Taiwan_Geocode_103 + 1000807 + + + 蝮蝡孵控 + + Taiwan_Geocode_103 + 1000804 + + + + + Taiwan_Geocode_103 + 1000802 + + + 蝮擳瘙 + + Taiwan_Geocode_103 + 1000809 + + + 擃撣瘣亙 + + Taiwan_Geocode_103 + 6401000 + + + 擃撣璇摰 + + Taiwan_Geocode_103 + 6402900 + + + 箏撣摰撟喳 + + Taiwan_Geocode_103 + 6703600 + + + 擃撣曈喳控 + + Taiwan_Geocode_103 + 6401200 + + + 獢撣怠噸 + + Taiwan_Geocode_103 + 6800800 + + + 梯桃腦摰 + + Taiwan_Geocode_103 + 1001505 + + + + + \ No newline at end of file diff --git a/BackendWorkerService/root/Typhoon.xml b/BackendWorkerService/root/Typhoon.xml new file mode 100644 index 0000000..02bdb86 --- /dev/null +++ b/BackendWorkerService/root/Typhoon.xml @@ -0,0 +1,64 @@ + + + + CWB-Weather_typhoon-warning_202305311430001 + weather@cwb.gov.tw + 2023-05-31T14:22:22+08:00 + Actual + Update + Public + weather@cwb.gov.tw,CWB-Weather_typhoon-warning_202305311130001,2023-05-31T11:24:11+08:00 + + zh-TW + Met + 憸梢◢ + Monitor + Future + Moderate + Likely + + profile:CAP-TWP:Event:1.0 + typhoon + + 2023-05-31T14:30:00+08:00 + 2023-05-31T14:30:00+08:00 + 2023-05-31T18:30:00+08:00 + 銝剖亢瘞鞊∪ + 瘚瑚憸梢◢霅血 + +
15
SEA
2
MAWAR22.20,125.203343970300銝剖漲憸梢◢TYPHOON24.80,126.203038975250
銝剖漲憸梢◢ 芸嚗賢 MAWAR嚗3114銝剖雿蝵桀典蝺 22.2 摨佗梁 125.2 摨佗喳券暸撒望寧 440 祇銋瘚琿V
銝剖瘞憯 970 曉嚗餈銝剖憭折◢瘥蝘 33 砍偕嚗蝝瘥撠 119 祇嚗嚗貊嗆 12 蝝憸剁祇憭折憸冽蝘 43 砍偕嚗蝝瘥撠 155 祇嚗嚗貊嗆 14 蝝憸剁銝蝝憸冽湧◢敺 300 祇嚗蝝憸冽湧◢敺 100 祇
隞交撠14祇摨佗梢脰嚗皜114銝剖雿蝵桀典蝺 24.8 摨佗梁 126.2 摨佗喳典剔望寧 450 祇銋瘚琿V
寞啗憿舐內嚗蝚2憸梢◢銝剖桀券暸撒望寞絲g梁宏嚗嗆湧◢甇箇勗刻瘚瘀撠撌游ㄚ瘚瑕魚箇勗冽絲X憡閮甇日2憸冽芯撘瑕漲蝔皜撘曹湧◢鈭行蝮桀頞典U
撌游ㄚ瘚瑕魚箇勗冽絲(怨剖飲蝬撜)箇勗冽絲Z芾雿璆剛寥餅游
憸梢◢憭唳敶梢選剖辣撘琿剁隞(31)亙剔腦啣撣箔葉撣撅勗撅典之冽鞊芷函潛嚗憭扯箏獢啁姘梯桀啣撅勗嚗憟撅勗嚗撅典之函潛璈嚗隢瘜冽撘琿憸剁撅勗隢瘜冽賜喳嫘
嚗撌游ㄚ瘚瑕魚箇餈瘚琿a◢瘚芣憿臬憭改粹瘚瑕硫具勗(怨剖飲蝬撜)亙撜嗆窒瘚瑕瞉皝擐祉瑟答潛嚗撠文嗆勗(怨剖飲蝬撜)粹瘚瑕硫亙撜嗆窒瘚瑟45蝐單答擃嚗隢踹敺瘚琿瘣餃嚗訾撘琿◢孵梧隞(31)亥箏唾瘝踵絲蝛箸啣瞉皝剖飲蝬撜嗆910蝝撘琿憸剁啁姘隞亙粹瘚瑕硫勗冽窒瘚瑞征啣箏唾啣亙撜嗚擐祉鈭行頛撘琿憸剁隢孵交釣嚗憸梢◢憭瘝敶梢選隞(31)賢予箏擃撅勗撅36摨虫誑銝擃皞怠箇曄璈嚗隢瘜冽嚗3003114箇曇憭抒敞蝛券憒銝嚗摰剔腦蝧撜唳316.0瘥怎掖嚗箔葉撣皝靚232.0瘥怎掖嚗祈郎勗桐憸梢◢敺箏像敺嚗蝚2憸梢◢銋7蝝憸冽湧◢敺餈隡潭迤嚗撟喳敺蝝300祇憸梢◢閰喟敦寞扯砍憸梯抵牧(https://www.cwb.gov.tw/Data/typhoon/TY_PDF.pdf)嚗交迨憸梢◢銵敺∠寞霈嚗砍閮潔(31)1730閫斗絲銝憸梢◢霅血晞
+
+ https://www.cwb.gov.tw/V8/C/P/Warning/FIFOWS.html + + alert_title + 憸梢◢霅血 + + + severity_level + 瘚瑚憸梢◢霅血 + + + alert_color + + + + website_color + 255,0,0 + + + + + 撌游ㄚ瘚瑕魚梢 + 20.00,121.50 20.00,121.00 20.50,121.00 21.00,121.00 21.50,121.00 22.00,121.00 22.00,121.50 22.00,122.00 22.00,122.50 22.00,123.00 21.50,123.00 21.00,123.00 20.50,123.00 20.00,123.00 20.00,122.50 20.00,122.00 20.00,121.50 + + + 箇勗冽絲 + 23.50,122.00 23.50,121.50 23.70,121.54 23.90,121.60 23.98,121.61 24.00,121.61 24.03,121.62 24.04,121.61 24.06,121.60 24.08,121.61 24.18,121.66 24.21,121.68 24.29,121.74 24.29,121.75 24.30,121.77 24.33,121.76 24.41,121.78 24.43,121.78 24.45,121.80 24.46,121.80 24.46,121.82 24.47,121.83 24.48,121.84 24.50,121.85 24.53,121.85 24.56,121.85 24.59,121.85 24.61,121.84 24.61,121.83 24.62,121.82 24.64,121.82 24.75,121.80 24.76,121.80 24.79,121.81 24.84,121.81 24.85,121.82 24.87,121.83 24.93,121.88 24.96,121.91 24.98,121.95 24.99,121.97 24.99,121.98 25.00,121.99 25.00,122.00 25.00,122.00 25.00,122.50 25.00,123.00 24.50,123.00 24.00,123.00 23.50,123.00 23.50,122.50 23.50,122.00 + + + 箇勗冽絲 + 22.00,121.50 22.00,121.00 22.00,120.86 22.04,120.88 22.10,120.88 22.23,120.88 22.28,120.87 22.29,120.87 22.32,120.87 22.34,120.88 22.50,120.94 22.54,120.96 22.57,120.97 22.61,121.00 22.64,121.01 22.66,121.03 22.71,121.08 22.72,121.11 22.72,121.12 22.73,121.13 22.74,121.14 22.76,121.17 22.90,121.26 23.00,121.31 23.09,121.36 23.33,121.45 23.40,121.47 23.41,121.48 23.42,121.48 23.49,121.50 23.50,121.50 23.50,122.00 23.50,122.50 23.50,123.00 23.00,123.00 22.50,123.00 22.00,123.00 22.00,122.50 22.00,122.00 22.00,121.50 + +
+ +
\ No newline at end of file