StationInfoInput.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System.Numerics;
  2. namespace Edge.Core.Domain.FccStationInfo.Input
  3. {
  4. public class StationInfoInput
  5. {
  6. /// <summary>
  7. /// id
  8. /// </summary>
  9. public long? Id { get; set; }
  10. /// <summary>
  11. /// 云端站点 id
  12. /// </summary>
  13. public string? BuildId { get; set; }
  14. /// <summary>
  15. /// 站点名称
  16. /// </summary>
  17. public string? Name { get; set; }
  18. /// <summary>
  19. /// 客户端id
  20. /// </summary>
  21. public string SecretId { get; set; }
  22. /// <summary>
  23. /// 与云端加密的 key
  24. /// </summary>
  25. public string AcessKey { get; set; }
  26. /// <summary>
  27. /// 经度
  28. /// </summary>
  29. public decimal? Longitude { get; set; }
  30. /// <summary>
  31. /// 纬度
  32. /// </summary>
  33. public decimal? Latitude { get; set; }
  34. /// <summary>
  35. /// 小程序链接地址
  36. /// </summary>
  37. public string? SmallProgram { get; set; }
  38. /// <summary>
  39. /// 云端地址
  40. /// </summary>
  41. public string? CloudService { get; set; }
  42. /// <summary>
  43. /// 云端 MQTT 地址
  44. /// </summary>
  45. public string? MqttService { get; set; }
  46. /// <summary>
  47. /// icard 数据库连接地址
  48. /// </summary>
  49. public string? IcardService { get; set; }
  50. /// <summary>
  51. /// 本地 fcc 与油机 socket 通讯端口
  52. /// </summary>
  53. public string? ServicePort { get; set; }
  54. /// <summary>
  55. /// 本地 fcc 与 fcc 页面 webSocket 端口
  56. /// </summary>
  57. public string? WebSocketPort { get; set; }
  58. public FccStationInfo? ToComponent()
  59. {
  60. if (IsNotNorm()) return null;
  61. return new FccStationInfo()
  62. {
  63. BuildId = this.BuildId,
  64. Name = this.Name != null ? this.Name : "",
  65. SecretId = this.SecretId,
  66. AcessKey = this.AcessKey,
  67. Longitude = (decimal)(this.Longitude != null ? this.Longitude : new decimal(0)),
  68. Latitude = (decimal)(this.Latitude != null ? this.Latitude : new decimal(0)),
  69. SmallProgram = this.SmallProgram,
  70. CloudService = this.CloudService,
  71. MqttService = this.MqttService,
  72. IcardService = this.IcardService != null ? this.IcardService : "",
  73. ServicePort = this.ServicePort,
  74. WebSocketPort = this.WebSocketPort
  75. };
  76. }
  77. public bool IsNotNorm()
  78. {
  79. return string.IsNullOrEmpty(BuildId) || !Longitude.HasValue || !Latitude.HasValue || string.IsNullOrEmpty(SmallProgram) || string.IsNullOrEmpty(CloudService)
  80. || string.IsNullOrEmpty(MqttService) || string.IsNullOrEmpty(ServicePort) || string.IsNullOrEmpty(WebSocketPort);
  81. }
  82. }
  83. }