CloudbusStop.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class CloudbusStop(object):
  6. def __init__(self):
  7. self._latitude = None
  8. self._longitude = None
  9. self._station_id = None
  10. self._station_name = None
  11. self._station_num = None
  12. self._station_space = None
  13. self._station_volume = None
  14. @property
  15. def latitude(self):
  16. return self._latitude
  17. @latitude.setter
  18. def latitude(self, value):
  19. self._latitude = value
  20. @property
  21. def longitude(self):
  22. return self._longitude
  23. @longitude.setter
  24. def longitude(self, value):
  25. self._longitude = value
  26. @property
  27. def station_id(self):
  28. return self._station_id
  29. @station_id.setter
  30. def station_id(self, value):
  31. self._station_id = value
  32. @property
  33. def station_name(self):
  34. return self._station_name
  35. @station_name.setter
  36. def station_name(self, value):
  37. self._station_name = value
  38. @property
  39. def station_num(self):
  40. return self._station_num
  41. @station_num.setter
  42. def station_num(self, value):
  43. self._station_num = value
  44. @property
  45. def station_space(self):
  46. return self._station_space
  47. @station_space.setter
  48. def station_space(self, value):
  49. self._station_space = value
  50. @property
  51. def station_volume(self):
  52. return self._station_volume
  53. @station_volume.setter
  54. def station_volume(self, value):
  55. self._station_volume = value
  56. def to_alipay_dict(self):
  57. params = dict()
  58. if self.latitude:
  59. if hasattr(self.latitude, 'to_alipay_dict'):
  60. params['latitude'] = self.latitude.to_alipay_dict()
  61. else:
  62. params['latitude'] = self.latitude
  63. if self.longitude:
  64. if hasattr(self.longitude, 'to_alipay_dict'):
  65. params['longitude'] = self.longitude.to_alipay_dict()
  66. else:
  67. params['longitude'] = self.longitude
  68. if self.station_id:
  69. if hasattr(self.station_id, 'to_alipay_dict'):
  70. params['station_id'] = self.station_id.to_alipay_dict()
  71. else:
  72. params['station_id'] = self.station_id
  73. if self.station_name:
  74. if hasattr(self.station_name, 'to_alipay_dict'):
  75. params['station_name'] = self.station_name.to_alipay_dict()
  76. else:
  77. params['station_name'] = self.station_name
  78. if self.station_num:
  79. if hasattr(self.station_num, 'to_alipay_dict'):
  80. params['station_num'] = self.station_num.to_alipay_dict()
  81. else:
  82. params['station_num'] = self.station_num
  83. if self.station_space:
  84. if hasattr(self.station_space, 'to_alipay_dict'):
  85. params['station_space'] = self.station_space.to_alipay_dict()
  86. else:
  87. params['station_space'] = self.station_space
  88. if self.station_volume:
  89. if hasattr(self.station_volume, 'to_alipay_dict'):
  90. params['station_volume'] = self.station_volume.to_alipay_dict()
  91. else:
  92. params['station_volume'] = self.station_volume
  93. return params
  94. @staticmethod
  95. def from_alipay_dict(d):
  96. if not d:
  97. return None
  98. o = CloudbusStop()
  99. if 'latitude' in d:
  100. o.latitude = d['latitude']
  101. if 'longitude' in d:
  102. o.longitude = d['longitude']
  103. if 'station_id' in d:
  104. o.station_id = d['station_id']
  105. if 'station_name' in d:
  106. o.station_name = d['station_name']
  107. if 'station_num' in d:
  108. o.station_num = d['station_num']
  109. if 'station_space' in d:
  110. o.station_space = d['station_space']
  111. if 'station_volume' in d:
  112. o.station_volume = d['station_volume']
  113. return o