ShopRec.py 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. from alipay.aop.api.domain.VoucherRec import VoucherRec
  6. class ShopRec(object):
  7. def __init__(self):
  8. self._address = None
  9. self._brand_name = None
  10. self._busi_area = None
  11. self._city_id = None
  12. self._cuisine = None
  13. self._distance = None
  14. self._ext_info = None
  15. self._has_hui = None
  16. self._head_shop_name = None
  17. self._latitude = None
  18. self._longitude = None
  19. self._popularity = None
  20. self._popularity_level = None
  21. self._price_average = None
  22. self._root_display_category_info = None
  23. self._shop_detail_url = None
  24. self._shop_id = None
  25. self._shop_logo_url = None
  26. self._shop_name = None
  27. self._shop_recommend_one_tag_compose = None
  28. self._voucher_list = None
  29. @property
  30. def address(self):
  31. return self._address
  32. @address.setter
  33. def address(self, value):
  34. self._address = value
  35. @property
  36. def brand_name(self):
  37. return self._brand_name
  38. @brand_name.setter
  39. def brand_name(self, value):
  40. self._brand_name = value
  41. @property
  42. def busi_area(self):
  43. return self._busi_area
  44. @busi_area.setter
  45. def busi_area(self, value):
  46. self._busi_area = value
  47. @property
  48. def city_id(self):
  49. return self._city_id
  50. @city_id.setter
  51. def city_id(self, value):
  52. self._city_id = value
  53. @property
  54. def cuisine(self):
  55. return self._cuisine
  56. @cuisine.setter
  57. def cuisine(self, value):
  58. self._cuisine = value
  59. @property
  60. def distance(self):
  61. return self._distance
  62. @distance.setter
  63. def distance(self, value):
  64. self._distance = value
  65. @property
  66. def ext_info(self):
  67. return self._ext_info
  68. @ext_info.setter
  69. def ext_info(self, value):
  70. self._ext_info = value
  71. @property
  72. def has_hui(self):
  73. return self._has_hui
  74. @has_hui.setter
  75. def has_hui(self, value):
  76. self._has_hui = value
  77. @property
  78. def head_shop_name(self):
  79. return self._head_shop_name
  80. @head_shop_name.setter
  81. def head_shop_name(self, value):
  82. self._head_shop_name = value
  83. @property
  84. def latitude(self):
  85. return self._latitude
  86. @latitude.setter
  87. def latitude(self, value):
  88. self._latitude = value
  89. @property
  90. def longitude(self):
  91. return self._longitude
  92. @longitude.setter
  93. def longitude(self, value):
  94. self._longitude = value
  95. @property
  96. def popularity(self):
  97. return self._popularity
  98. @popularity.setter
  99. def popularity(self, value):
  100. self._popularity = value
  101. @property
  102. def popularity_level(self):
  103. return self._popularity_level
  104. @popularity_level.setter
  105. def popularity_level(self, value):
  106. self._popularity_level = value
  107. @property
  108. def price_average(self):
  109. return self._price_average
  110. @price_average.setter
  111. def price_average(self, value):
  112. self._price_average = value
  113. @property
  114. def root_display_category_info(self):
  115. return self._root_display_category_info
  116. @root_display_category_info.setter
  117. def root_display_category_info(self, value):
  118. self._root_display_category_info = value
  119. @property
  120. def shop_detail_url(self):
  121. return self._shop_detail_url
  122. @shop_detail_url.setter
  123. def shop_detail_url(self, value):
  124. self._shop_detail_url = value
  125. @property
  126. def shop_id(self):
  127. return self._shop_id
  128. @shop_id.setter
  129. def shop_id(self, value):
  130. self._shop_id = value
  131. @property
  132. def shop_logo_url(self):
  133. return self._shop_logo_url
  134. @shop_logo_url.setter
  135. def shop_logo_url(self, value):
  136. self._shop_logo_url = value
  137. @property
  138. def shop_name(self):
  139. return self._shop_name
  140. @shop_name.setter
  141. def shop_name(self, value):
  142. self._shop_name = value
  143. @property
  144. def shop_recommend_one_tag_compose(self):
  145. return self._shop_recommend_one_tag_compose
  146. @shop_recommend_one_tag_compose.setter
  147. def shop_recommend_one_tag_compose(self, value):
  148. self._shop_recommend_one_tag_compose = value
  149. @property
  150. def voucher_list(self):
  151. return self._voucher_list
  152. @voucher_list.setter
  153. def voucher_list(self, value):
  154. if isinstance(value, list):
  155. self._voucher_list = list()
  156. for i in value:
  157. if isinstance(i, VoucherRec):
  158. self._voucher_list.append(i)
  159. else:
  160. self._voucher_list.append(VoucherRec.from_alipay_dict(i))
  161. def to_alipay_dict(self):
  162. params = dict()
  163. if self.address:
  164. if hasattr(self.address, 'to_alipay_dict'):
  165. params['address'] = self.address.to_alipay_dict()
  166. else:
  167. params['address'] = self.address
  168. if self.brand_name:
  169. if hasattr(self.brand_name, 'to_alipay_dict'):
  170. params['brand_name'] = self.brand_name.to_alipay_dict()
  171. else:
  172. params['brand_name'] = self.brand_name
  173. if self.busi_area:
  174. if hasattr(self.busi_area, 'to_alipay_dict'):
  175. params['busi_area'] = self.busi_area.to_alipay_dict()
  176. else:
  177. params['busi_area'] = self.busi_area
  178. if self.city_id:
  179. if hasattr(self.city_id, 'to_alipay_dict'):
  180. params['city_id'] = self.city_id.to_alipay_dict()
  181. else:
  182. params['city_id'] = self.city_id
  183. if self.cuisine:
  184. if hasattr(self.cuisine, 'to_alipay_dict'):
  185. params['cuisine'] = self.cuisine.to_alipay_dict()
  186. else:
  187. params['cuisine'] = self.cuisine
  188. if self.distance:
  189. if hasattr(self.distance, 'to_alipay_dict'):
  190. params['distance'] = self.distance.to_alipay_dict()
  191. else:
  192. params['distance'] = self.distance
  193. if self.ext_info:
  194. if hasattr(self.ext_info, 'to_alipay_dict'):
  195. params['ext_info'] = self.ext_info.to_alipay_dict()
  196. else:
  197. params['ext_info'] = self.ext_info
  198. if self.has_hui:
  199. if hasattr(self.has_hui, 'to_alipay_dict'):
  200. params['has_hui'] = self.has_hui.to_alipay_dict()
  201. else:
  202. params['has_hui'] = self.has_hui
  203. if self.head_shop_name:
  204. if hasattr(self.head_shop_name, 'to_alipay_dict'):
  205. params['head_shop_name'] = self.head_shop_name.to_alipay_dict()
  206. else:
  207. params['head_shop_name'] = self.head_shop_name
  208. if self.latitude:
  209. if hasattr(self.latitude, 'to_alipay_dict'):
  210. params['latitude'] = self.latitude.to_alipay_dict()
  211. else:
  212. params['latitude'] = self.latitude
  213. if self.longitude:
  214. if hasattr(self.longitude, 'to_alipay_dict'):
  215. params['longitude'] = self.longitude.to_alipay_dict()
  216. else:
  217. params['longitude'] = self.longitude
  218. if self.popularity:
  219. if hasattr(self.popularity, 'to_alipay_dict'):
  220. params['popularity'] = self.popularity.to_alipay_dict()
  221. else:
  222. params['popularity'] = self.popularity
  223. if self.popularity_level:
  224. if hasattr(self.popularity_level, 'to_alipay_dict'):
  225. params['popularity_level'] = self.popularity_level.to_alipay_dict()
  226. else:
  227. params['popularity_level'] = self.popularity_level
  228. if self.price_average:
  229. if hasattr(self.price_average, 'to_alipay_dict'):
  230. params['price_average'] = self.price_average.to_alipay_dict()
  231. else:
  232. params['price_average'] = self.price_average
  233. if self.root_display_category_info:
  234. if hasattr(self.root_display_category_info, 'to_alipay_dict'):
  235. params['root_display_category_info'] = self.root_display_category_info.to_alipay_dict()
  236. else:
  237. params['root_display_category_info'] = self.root_display_category_info
  238. if self.shop_detail_url:
  239. if hasattr(self.shop_detail_url, 'to_alipay_dict'):
  240. params['shop_detail_url'] = self.shop_detail_url.to_alipay_dict()
  241. else:
  242. params['shop_detail_url'] = self.shop_detail_url
  243. if self.shop_id:
  244. if hasattr(self.shop_id, 'to_alipay_dict'):
  245. params['shop_id'] = self.shop_id.to_alipay_dict()
  246. else:
  247. params['shop_id'] = self.shop_id
  248. if self.shop_logo_url:
  249. if hasattr(self.shop_logo_url, 'to_alipay_dict'):
  250. params['shop_logo_url'] = self.shop_logo_url.to_alipay_dict()
  251. else:
  252. params['shop_logo_url'] = self.shop_logo_url
  253. if self.shop_name:
  254. if hasattr(self.shop_name, 'to_alipay_dict'):
  255. params['shop_name'] = self.shop_name.to_alipay_dict()
  256. else:
  257. params['shop_name'] = self.shop_name
  258. if self.shop_recommend_one_tag_compose:
  259. if hasattr(self.shop_recommend_one_tag_compose, 'to_alipay_dict'):
  260. params['shop_recommend_one_tag_compose'] = self.shop_recommend_one_tag_compose.to_alipay_dict()
  261. else:
  262. params['shop_recommend_one_tag_compose'] = self.shop_recommend_one_tag_compose
  263. if self.voucher_list:
  264. if isinstance(self.voucher_list, list):
  265. for i in range(0, len(self.voucher_list)):
  266. element = self.voucher_list[i]
  267. if hasattr(element, 'to_alipay_dict'):
  268. self.voucher_list[i] = element.to_alipay_dict()
  269. if hasattr(self.voucher_list, 'to_alipay_dict'):
  270. params['voucher_list'] = self.voucher_list.to_alipay_dict()
  271. else:
  272. params['voucher_list'] = self.voucher_list
  273. return params
  274. @staticmethod
  275. def from_alipay_dict(d):
  276. if not d:
  277. return None
  278. o = ShopRec()
  279. if 'address' in d:
  280. o.address = d['address']
  281. if 'brand_name' in d:
  282. o.brand_name = d['brand_name']
  283. if 'busi_area' in d:
  284. o.busi_area = d['busi_area']
  285. if 'city_id' in d:
  286. o.city_id = d['city_id']
  287. if 'cuisine' in d:
  288. o.cuisine = d['cuisine']
  289. if 'distance' in d:
  290. o.distance = d['distance']
  291. if 'ext_info' in d:
  292. o.ext_info = d['ext_info']
  293. if 'has_hui' in d:
  294. o.has_hui = d['has_hui']
  295. if 'head_shop_name' in d:
  296. o.head_shop_name = d['head_shop_name']
  297. if 'latitude' in d:
  298. o.latitude = d['latitude']
  299. if 'longitude' in d:
  300. o.longitude = d['longitude']
  301. if 'popularity' in d:
  302. o.popularity = d['popularity']
  303. if 'popularity_level' in d:
  304. o.popularity_level = d['popularity_level']
  305. if 'price_average' in d:
  306. o.price_average = d['price_average']
  307. if 'root_display_category_info' in d:
  308. o.root_display_category_info = d['root_display_category_info']
  309. if 'shop_detail_url' in d:
  310. o.shop_detail_url = d['shop_detail_url']
  311. if 'shop_id' in d:
  312. o.shop_id = d['shop_id']
  313. if 'shop_logo_url' in d:
  314. o.shop_logo_url = d['shop_logo_url']
  315. if 'shop_name' in d:
  316. o.shop_name = d['shop_name']
  317. if 'shop_recommend_one_tag_compose' in d:
  318. o.shop_recommend_one_tag_compose = d['shop_recommend_one_tag_compose']
  319. if 'voucher_list' in d:
  320. o.voucher_list = d['voucher_list']
  321. return o