StallEntity.py 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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.StallKdsEntity import StallKdsEntity
  6. class StallEntity(object):
  7. def __init__(self):
  8. self._dish_ids = None
  9. self._id = None
  10. self._kds_list = None
  11. self._merchant_id = None
  12. self._printer_id = None
  13. self._printer_name = None
  14. self._printer_type = None
  15. self._receipt_type = None
  16. self._shop_id = None
  17. self._stall_name = None
  18. self._use = None
  19. @property
  20. def dish_ids(self):
  21. return self._dish_ids
  22. @dish_ids.setter
  23. def dish_ids(self, value):
  24. if isinstance(value, list):
  25. self._dish_ids = list()
  26. for i in value:
  27. self._dish_ids.append(i)
  28. @property
  29. def id(self):
  30. return self._id
  31. @id.setter
  32. def id(self, value):
  33. self._id = value
  34. @property
  35. def kds_list(self):
  36. return self._kds_list
  37. @kds_list.setter
  38. def kds_list(self, value):
  39. if isinstance(value, list):
  40. self._kds_list = list()
  41. for i in value:
  42. if isinstance(i, StallKdsEntity):
  43. self._kds_list.append(i)
  44. else:
  45. self._kds_list.append(StallKdsEntity.from_alipay_dict(i))
  46. @property
  47. def merchant_id(self):
  48. return self._merchant_id
  49. @merchant_id.setter
  50. def merchant_id(self, value):
  51. self._merchant_id = value
  52. @property
  53. def printer_id(self):
  54. return self._printer_id
  55. @printer_id.setter
  56. def printer_id(self, value):
  57. self._printer_id = value
  58. @property
  59. def printer_name(self):
  60. return self._printer_name
  61. @printer_name.setter
  62. def printer_name(self, value):
  63. self._printer_name = value
  64. @property
  65. def printer_type(self):
  66. return self._printer_type
  67. @printer_type.setter
  68. def printer_type(self, value):
  69. self._printer_type = value
  70. @property
  71. def receipt_type(self):
  72. return self._receipt_type
  73. @receipt_type.setter
  74. def receipt_type(self, value):
  75. self._receipt_type = value
  76. @property
  77. def shop_id(self):
  78. return self._shop_id
  79. @shop_id.setter
  80. def shop_id(self, value):
  81. self._shop_id = value
  82. @property
  83. def stall_name(self):
  84. return self._stall_name
  85. @stall_name.setter
  86. def stall_name(self, value):
  87. self._stall_name = value
  88. @property
  89. def use(self):
  90. return self._use
  91. @use.setter
  92. def use(self, value):
  93. self._use = value
  94. def to_alipay_dict(self):
  95. params = dict()
  96. if self.dish_ids:
  97. if isinstance(self.dish_ids, list):
  98. for i in range(0, len(self.dish_ids)):
  99. element = self.dish_ids[i]
  100. if hasattr(element, 'to_alipay_dict'):
  101. self.dish_ids[i] = element.to_alipay_dict()
  102. if hasattr(self.dish_ids, 'to_alipay_dict'):
  103. params['dish_ids'] = self.dish_ids.to_alipay_dict()
  104. else:
  105. params['dish_ids'] = self.dish_ids
  106. if self.id:
  107. if hasattr(self.id, 'to_alipay_dict'):
  108. params['id'] = self.id.to_alipay_dict()
  109. else:
  110. params['id'] = self.id
  111. if self.kds_list:
  112. if isinstance(self.kds_list, list):
  113. for i in range(0, len(self.kds_list)):
  114. element = self.kds_list[i]
  115. if hasattr(element, 'to_alipay_dict'):
  116. self.kds_list[i] = element.to_alipay_dict()
  117. if hasattr(self.kds_list, 'to_alipay_dict'):
  118. params['kds_list'] = self.kds_list.to_alipay_dict()
  119. else:
  120. params['kds_list'] = self.kds_list
  121. if self.merchant_id:
  122. if hasattr(self.merchant_id, 'to_alipay_dict'):
  123. params['merchant_id'] = self.merchant_id.to_alipay_dict()
  124. else:
  125. params['merchant_id'] = self.merchant_id
  126. if self.printer_id:
  127. if hasattr(self.printer_id, 'to_alipay_dict'):
  128. params['printer_id'] = self.printer_id.to_alipay_dict()
  129. else:
  130. params['printer_id'] = self.printer_id
  131. if self.printer_name:
  132. if hasattr(self.printer_name, 'to_alipay_dict'):
  133. params['printer_name'] = self.printer_name.to_alipay_dict()
  134. else:
  135. params['printer_name'] = self.printer_name
  136. if self.printer_type:
  137. if hasattr(self.printer_type, 'to_alipay_dict'):
  138. params['printer_type'] = self.printer_type.to_alipay_dict()
  139. else:
  140. params['printer_type'] = self.printer_type
  141. if self.receipt_type:
  142. if hasattr(self.receipt_type, 'to_alipay_dict'):
  143. params['receipt_type'] = self.receipt_type.to_alipay_dict()
  144. else:
  145. params['receipt_type'] = self.receipt_type
  146. if self.shop_id:
  147. if hasattr(self.shop_id, 'to_alipay_dict'):
  148. params['shop_id'] = self.shop_id.to_alipay_dict()
  149. else:
  150. params['shop_id'] = self.shop_id
  151. if self.stall_name:
  152. if hasattr(self.stall_name, 'to_alipay_dict'):
  153. params['stall_name'] = self.stall_name.to_alipay_dict()
  154. else:
  155. params['stall_name'] = self.stall_name
  156. if self.use:
  157. if hasattr(self.use, 'to_alipay_dict'):
  158. params['use'] = self.use.to_alipay_dict()
  159. else:
  160. params['use'] = self.use
  161. return params
  162. @staticmethod
  163. def from_alipay_dict(d):
  164. if not d:
  165. return None
  166. o = StallEntity()
  167. if 'dish_ids' in d:
  168. o.dish_ids = d['dish_ids']
  169. if 'id' in d:
  170. o.id = d['id']
  171. if 'kds_list' in d:
  172. o.kds_list = d['kds_list']
  173. if 'merchant_id' in d:
  174. o.merchant_id = d['merchant_id']
  175. if 'printer_id' in d:
  176. o.printer_id = d['printer_id']
  177. if 'printer_name' in d:
  178. o.printer_name = d['printer_name']
  179. if 'printer_type' in d:
  180. o.printer_type = d['printer_type']
  181. if 'receipt_type' in d:
  182. o.receipt_type = d['receipt_type']
  183. if 'shop_id' in d:
  184. o.shop_id = d['shop_id']
  185. if 'stall_name' in d:
  186. o.stall_name = d['stall_name']
  187. if 'use' in d:
  188. o.use = d['use']
  189. return o