POIinfo.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class POIinfo(object):
  6. def __init__(self):
  7. self._address = None
  8. self._businessarea = None
  9. self._direction = None
  10. self._distance = None
  11. self._id = None
  12. self._location = None
  13. self._name = None
  14. self._tel = None
  15. self._type = None
  16. @property
  17. def address(self):
  18. return self._address
  19. @address.setter
  20. def address(self, value):
  21. self._address = value
  22. @property
  23. def businessarea(self):
  24. return self._businessarea
  25. @businessarea.setter
  26. def businessarea(self, value):
  27. self._businessarea = value
  28. @property
  29. def direction(self):
  30. return self._direction
  31. @direction.setter
  32. def direction(self, value):
  33. self._direction = value
  34. @property
  35. def distance(self):
  36. return self._distance
  37. @distance.setter
  38. def distance(self, value):
  39. self._distance = value
  40. @property
  41. def id(self):
  42. return self._id
  43. @id.setter
  44. def id(self, value):
  45. self._id = value
  46. @property
  47. def location(self):
  48. return self._location
  49. @location.setter
  50. def location(self, value):
  51. self._location = value
  52. @property
  53. def name(self):
  54. return self._name
  55. @name.setter
  56. def name(self, value):
  57. self._name = value
  58. @property
  59. def tel(self):
  60. return self._tel
  61. @tel.setter
  62. def tel(self, value):
  63. self._tel = value
  64. @property
  65. def type(self):
  66. return self._type
  67. @type.setter
  68. def type(self, value):
  69. self._type = value
  70. def to_alipay_dict(self):
  71. params = dict()
  72. if self.address:
  73. if hasattr(self.address, 'to_alipay_dict'):
  74. params['address'] = self.address.to_alipay_dict()
  75. else:
  76. params['address'] = self.address
  77. if self.businessarea:
  78. if hasattr(self.businessarea, 'to_alipay_dict'):
  79. params['businessarea'] = self.businessarea.to_alipay_dict()
  80. else:
  81. params['businessarea'] = self.businessarea
  82. if self.direction:
  83. if hasattr(self.direction, 'to_alipay_dict'):
  84. params['direction'] = self.direction.to_alipay_dict()
  85. else:
  86. params['direction'] = self.direction
  87. if self.distance:
  88. if hasattr(self.distance, 'to_alipay_dict'):
  89. params['distance'] = self.distance.to_alipay_dict()
  90. else:
  91. params['distance'] = self.distance
  92. if self.id:
  93. if hasattr(self.id, 'to_alipay_dict'):
  94. params['id'] = self.id.to_alipay_dict()
  95. else:
  96. params['id'] = self.id
  97. if self.location:
  98. if hasattr(self.location, 'to_alipay_dict'):
  99. params['location'] = self.location.to_alipay_dict()
  100. else:
  101. params['location'] = self.location
  102. if self.name:
  103. if hasattr(self.name, 'to_alipay_dict'):
  104. params['name'] = self.name.to_alipay_dict()
  105. else:
  106. params['name'] = self.name
  107. if self.tel:
  108. if hasattr(self.tel, 'to_alipay_dict'):
  109. params['tel'] = self.tel.to_alipay_dict()
  110. else:
  111. params['tel'] = self.tel
  112. if self.type:
  113. if hasattr(self.type, 'to_alipay_dict'):
  114. params['type'] = self.type.to_alipay_dict()
  115. else:
  116. params['type'] = self.type
  117. return params
  118. @staticmethod
  119. def from_alipay_dict(d):
  120. if not d:
  121. return None
  122. o = POIinfo()
  123. if 'address' in d:
  124. o.address = d['address']
  125. if 'businessarea' in d:
  126. o.businessarea = d['businessarea']
  127. if 'direction' in d:
  128. o.direction = d['direction']
  129. if 'distance' in d:
  130. o.distance = d['distance']
  131. if 'id' in d:
  132. o.id = d['id']
  133. if 'location' in d:
  134. o.location = d['location']
  135. if 'name' in d:
  136. o.name = d['name']
  137. if 'tel' in d:
  138. o.tel = d['tel']
  139. if 'type' in d:
  140. o.type = d['type']
  141. return o