Roadinter.py 3.7 KB

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