DeviceApplyOrderItemDto.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class DeviceApplyOrderItemDto(object):
  6. def __init__(self):
  7. self._apply_amount = None
  8. self._item_id = None
  9. self._item_name = None
  10. self._model_number = None
  11. self._sn_list = None
  12. self._supplier_id = None
  13. @property
  14. def apply_amount(self):
  15. return self._apply_amount
  16. @apply_amount.setter
  17. def apply_amount(self, value):
  18. self._apply_amount = value
  19. @property
  20. def item_id(self):
  21. return self._item_id
  22. @item_id.setter
  23. def item_id(self, value):
  24. self._item_id = value
  25. @property
  26. def item_name(self):
  27. return self._item_name
  28. @item_name.setter
  29. def item_name(self, value):
  30. self._item_name = value
  31. @property
  32. def model_number(self):
  33. return self._model_number
  34. @model_number.setter
  35. def model_number(self, value):
  36. self._model_number = value
  37. @property
  38. def sn_list(self):
  39. return self._sn_list
  40. @sn_list.setter
  41. def sn_list(self, value):
  42. if isinstance(value, list):
  43. self._sn_list = list()
  44. for i in value:
  45. self._sn_list.append(i)
  46. @property
  47. def supplier_id(self):
  48. return self._supplier_id
  49. @supplier_id.setter
  50. def supplier_id(self, value):
  51. self._supplier_id = value
  52. def to_alipay_dict(self):
  53. params = dict()
  54. if self.apply_amount:
  55. if hasattr(self.apply_amount, 'to_alipay_dict'):
  56. params['apply_amount'] = self.apply_amount.to_alipay_dict()
  57. else:
  58. params['apply_amount'] = self.apply_amount
  59. if self.item_id:
  60. if hasattr(self.item_id, 'to_alipay_dict'):
  61. params['item_id'] = self.item_id.to_alipay_dict()
  62. else:
  63. params['item_id'] = self.item_id
  64. if self.item_name:
  65. if hasattr(self.item_name, 'to_alipay_dict'):
  66. params['item_name'] = self.item_name.to_alipay_dict()
  67. else:
  68. params['item_name'] = self.item_name
  69. if self.model_number:
  70. if hasattr(self.model_number, 'to_alipay_dict'):
  71. params['model_number'] = self.model_number.to_alipay_dict()
  72. else:
  73. params['model_number'] = self.model_number
  74. if self.sn_list:
  75. if isinstance(self.sn_list, list):
  76. for i in range(0, len(self.sn_list)):
  77. element = self.sn_list[i]
  78. if hasattr(element, 'to_alipay_dict'):
  79. self.sn_list[i] = element.to_alipay_dict()
  80. if hasattr(self.sn_list, 'to_alipay_dict'):
  81. params['sn_list'] = self.sn_list.to_alipay_dict()
  82. else:
  83. params['sn_list'] = self.sn_list
  84. if self.supplier_id:
  85. if hasattr(self.supplier_id, 'to_alipay_dict'):
  86. params['supplier_id'] = self.supplier_id.to_alipay_dict()
  87. else:
  88. params['supplier_id'] = self.supplier_id
  89. return params
  90. @staticmethod
  91. def from_alipay_dict(d):
  92. if not d:
  93. return None
  94. o = DeviceApplyOrderItemDto()
  95. if 'apply_amount' in d:
  96. o.apply_amount = d['apply_amount']
  97. if 'item_id' in d:
  98. o.item_id = d['item_id']
  99. if 'item_name' in d:
  100. o.item_name = d['item_name']
  101. if 'model_number' in d:
  102. o.model_number = d['model_number']
  103. if 'sn_list' in d:
  104. o.sn_list = d['sn_list']
  105. if 'supplier_id' in d:
  106. o.supplier_id = d['supplier_id']
  107. return o