EntityBasicInfo.py 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class EntityBasicInfo(object):
  6. def __init__(self):
  7. self._address_desc = None
  8. self._category_code = None
  9. self._city = None
  10. self._contact_number = None
  11. self._entity_code = None
  12. self._entity_name = None
  13. self._latitude = None
  14. self._longitude = None
  15. self._office_hours_desc = None
  16. self._open_day = None
  17. self._province = None
  18. self._rent_free_time = None
  19. self._rent_max_price = None
  20. self._rent_price = None
  21. self._rent_price_unit = None
  22. self._rent_price_unit_cnt = None
  23. self._suburb = None
  24. @property
  25. def address_desc(self):
  26. return self._address_desc
  27. @address_desc.setter
  28. def address_desc(self, value):
  29. self._address_desc = value
  30. @property
  31. def category_code(self):
  32. return self._category_code
  33. @category_code.setter
  34. def category_code(self, value):
  35. self._category_code = value
  36. @property
  37. def city(self):
  38. return self._city
  39. @city.setter
  40. def city(self, value):
  41. self._city = value
  42. @property
  43. def contact_number(self):
  44. return self._contact_number
  45. @contact_number.setter
  46. def contact_number(self, value):
  47. self._contact_number = value
  48. @property
  49. def entity_code(self):
  50. return self._entity_code
  51. @entity_code.setter
  52. def entity_code(self, value):
  53. self._entity_code = value
  54. @property
  55. def entity_name(self):
  56. return self._entity_name
  57. @entity_name.setter
  58. def entity_name(self, value):
  59. self._entity_name = value
  60. @property
  61. def latitude(self):
  62. return self._latitude
  63. @latitude.setter
  64. def latitude(self, value):
  65. self._latitude = value
  66. @property
  67. def longitude(self):
  68. return self._longitude
  69. @longitude.setter
  70. def longitude(self, value):
  71. self._longitude = value
  72. @property
  73. def office_hours_desc(self):
  74. return self._office_hours_desc
  75. @office_hours_desc.setter
  76. def office_hours_desc(self, value):
  77. self._office_hours_desc = value
  78. @property
  79. def open_day(self):
  80. return self._open_day
  81. @open_day.setter
  82. def open_day(self, value):
  83. if isinstance(value, list):
  84. self._open_day = list()
  85. for i in value:
  86. self._open_day.append(i)
  87. @property
  88. def province(self):
  89. return self._province
  90. @province.setter
  91. def province(self, value):
  92. self._province = value
  93. @property
  94. def rent_free_time(self):
  95. return self._rent_free_time
  96. @rent_free_time.setter
  97. def rent_free_time(self, value):
  98. self._rent_free_time = value
  99. @property
  100. def rent_max_price(self):
  101. return self._rent_max_price
  102. @rent_max_price.setter
  103. def rent_max_price(self, value):
  104. self._rent_max_price = value
  105. @property
  106. def rent_price(self):
  107. return self._rent_price
  108. @rent_price.setter
  109. def rent_price(self, value):
  110. self._rent_price = value
  111. @property
  112. def rent_price_unit(self):
  113. return self._rent_price_unit
  114. @rent_price_unit.setter
  115. def rent_price_unit(self, value):
  116. self._rent_price_unit = value
  117. @property
  118. def rent_price_unit_cnt(self):
  119. return self._rent_price_unit_cnt
  120. @rent_price_unit_cnt.setter
  121. def rent_price_unit_cnt(self, value):
  122. self._rent_price_unit_cnt = value
  123. @property
  124. def suburb(self):
  125. return self._suburb
  126. @suburb.setter
  127. def suburb(self, value):
  128. self._suburb = value
  129. def to_alipay_dict(self):
  130. params = dict()
  131. if self.address_desc:
  132. if hasattr(self.address_desc, 'to_alipay_dict'):
  133. params['address_desc'] = self.address_desc.to_alipay_dict()
  134. else:
  135. params['address_desc'] = self.address_desc
  136. if self.category_code:
  137. if hasattr(self.category_code, 'to_alipay_dict'):
  138. params['category_code'] = self.category_code.to_alipay_dict()
  139. else:
  140. params['category_code'] = self.category_code
  141. if self.city:
  142. if hasattr(self.city, 'to_alipay_dict'):
  143. params['city'] = self.city.to_alipay_dict()
  144. else:
  145. params['city'] = self.city
  146. if self.contact_number:
  147. if hasattr(self.contact_number, 'to_alipay_dict'):
  148. params['contact_number'] = self.contact_number.to_alipay_dict()
  149. else:
  150. params['contact_number'] = self.contact_number
  151. if self.entity_code:
  152. if hasattr(self.entity_code, 'to_alipay_dict'):
  153. params['entity_code'] = self.entity_code.to_alipay_dict()
  154. else:
  155. params['entity_code'] = self.entity_code
  156. if self.entity_name:
  157. if hasattr(self.entity_name, 'to_alipay_dict'):
  158. params['entity_name'] = self.entity_name.to_alipay_dict()
  159. else:
  160. params['entity_name'] = self.entity_name
  161. if self.latitude:
  162. if hasattr(self.latitude, 'to_alipay_dict'):
  163. params['latitude'] = self.latitude.to_alipay_dict()
  164. else:
  165. params['latitude'] = self.latitude
  166. if self.longitude:
  167. if hasattr(self.longitude, 'to_alipay_dict'):
  168. params['longitude'] = self.longitude.to_alipay_dict()
  169. else:
  170. params['longitude'] = self.longitude
  171. if self.office_hours_desc:
  172. if hasattr(self.office_hours_desc, 'to_alipay_dict'):
  173. params['office_hours_desc'] = self.office_hours_desc.to_alipay_dict()
  174. else:
  175. params['office_hours_desc'] = self.office_hours_desc
  176. if self.open_day:
  177. if isinstance(self.open_day, list):
  178. for i in range(0, len(self.open_day)):
  179. element = self.open_day[i]
  180. if hasattr(element, 'to_alipay_dict'):
  181. self.open_day[i] = element.to_alipay_dict()
  182. if hasattr(self.open_day, 'to_alipay_dict'):
  183. params['open_day'] = self.open_day.to_alipay_dict()
  184. else:
  185. params['open_day'] = self.open_day
  186. if self.province:
  187. if hasattr(self.province, 'to_alipay_dict'):
  188. params['province'] = self.province.to_alipay_dict()
  189. else:
  190. params['province'] = self.province
  191. if self.rent_free_time:
  192. if hasattr(self.rent_free_time, 'to_alipay_dict'):
  193. params['rent_free_time'] = self.rent_free_time.to_alipay_dict()
  194. else:
  195. params['rent_free_time'] = self.rent_free_time
  196. if self.rent_max_price:
  197. if hasattr(self.rent_max_price, 'to_alipay_dict'):
  198. params['rent_max_price'] = self.rent_max_price.to_alipay_dict()
  199. else:
  200. params['rent_max_price'] = self.rent_max_price
  201. if self.rent_price:
  202. if hasattr(self.rent_price, 'to_alipay_dict'):
  203. params['rent_price'] = self.rent_price.to_alipay_dict()
  204. else:
  205. params['rent_price'] = self.rent_price
  206. if self.rent_price_unit:
  207. if hasattr(self.rent_price_unit, 'to_alipay_dict'):
  208. params['rent_price_unit'] = self.rent_price_unit.to_alipay_dict()
  209. else:
  210. params['rent_price_unit'] = self.rent_price_unit
  211. if self.rent_price_unit_cnt:
  212. if hasattr(self.rent_price_unit_cnt, 'to_alipay_dict'):
  213. params['rent_price_unit_cnt'] = self.rent_price_unit_cnt.to_alipay_dict()
  214. else:
  215. params['rent_price_unit_cnt'] = self.rent_price_unit_cnt
  216. if self.suburb:
  217. if hasattr(self.suburb, 'to_alipay_dict'):
  218. params['suburb'] = self.suburb.to_alipay_dict()
  219. else:
  220. params['suburb'] = self.suburb
  221. return params
  222. @staticmethod
  223. def from_alipay_dict(d):
  224. if not d:
  225. return None
  226. o = EntityBasicInfo()
  227. if 'address_desc' in d:
  228. o.address_desc = d['address_desc']
  229. if 'category_code' in d:
  230. o.category_code = d['category_code']
  231. if 'city' in d:
  232. o.city = d['city']
  233. if 'contact_number' in d:
  234. o.contact_number = d['contact_number']
  235. if 'entity_code' in d:
  236. o.entity_code = d['entity_code']
  237. if 'entity_name' in d:
  238. o.entity_name = d['entity_name']
  239. if 'latitude' in d:
  240. o.latitude = d['latitude']
  241. if 'longitude' in d:
  242. o.longitude = d['longitude']
  243. if 'office_hours_desc' in d:
  244. o.office_hours_desc = d['office_hours_desc']
  245. if 'open_day' in d:
  246. o.open_day = d['open_day']
  247. if 'province' in d:
  248. o.province = d['province']
  249. if 'rent_free_time' in d:
  250. o.rent_free_time = d['rent_free_time']
  251. if 'rent_max_price' in d:
  252. o.rent_max_price = d['rent_max_price']
  253. if 'rent_price' in d:
  254. o.rent_price = d['rent_price']
  255. if 'rent_price_unit' in d:
  256. o.rent_price_unit = d['rent_price_unit']
  257. if 'rent_price_unit_cnt' in d:
  258. o.rent_price_unit_cnt = d['rent_price_unit_cnt']
  259. if 'suburb' in d:
  260. o.suburb = d['suburb']
  261. return o