StallModel.py 5.5 KB

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