ExercisePlanOpenModel.py 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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.ExerciseCourseOpenModel import ExerciseCourseOpenModel
  6. from alipay.aop.api.domain.ExerciseItemOpenModel import ExerciseItemOpenModel
  7. class ExercisePlanOpenModel(object):
  8. def __init__(self):
  9. self._biz_type = None
  10. self._course_list = None
  11. self._item_list = None
  12. self._time_dimension_type = None
  13. self._values = None
  14. @property
  15. def biz_type(self):
  16. return self._biz_type
  17. @biz_type.setter
  18. def biz_type(self, value):
  19. self._biz_type = value
  20. @property
  21. def course_list(self):
  22. return self._course_list
  23. @course_list.setter
  24. def course_list(self, value):
  25. if isinstance(value, list):
  26. self._course_list = list()
  27. for i in value:
  28. if isinstance(i, ExerciseCourseOpenModel):
  29. self._course_list.append(i)
  30. else:
  31. self._course_list.append(ExerciseCourseOpenModel.from_alipay_dict(i))
  32. @property
  33. def item_list(self):
  34. return self._item_list
  35. @item_list.setter
  36. def item_list(self, value):
  37. if isinstance(value, list):
  38. self._item_list = list()
  39. for i in value:
  40. if isinstance(i, ExerciseItemOpenModel):
  41. self._item_list.append(i)
  42. else:
  43. self._item_list.append(ExerciseItemOpenModel.from_alipay_dict(i))
  44. @property
  45. def time_dimension_type(self):
  46. return self._time_dimension_type
  47. @time_dimension_type.setter
  48. def time_dimension_type(self, value):
  49. self._time_dimension_type = value
  50. @property
  51. def values(self):
  52. return self._values
  53. @values.setter
  54. def values(self, value):
  55. self._values = value
  56. def to_alipay_dict(self):
  57. params = dict()
  58. if self.biz_type:
  59. if hasattr(self.biz_type, 'to_alipay_dict'):
  60. params['biz_type'] = self.biz_type.to_alipay_dict()
  61. else:
  62. params['biz_type'] = self.biz_type
  63. if self.course_list:
  64. if isinstance(self.course_list, list):
  65. for i in range(0, len(self.course_list)):
  66. element = self.course_list[i]
  67. if hasattr(element, 'to_alipay_dict'):
  68. self.course_list[i] = element.to_alipay_dict()
  69. if hasattr(self.course_list, 'to_alipay_dict'):
  70. params['course_list'] = self.course_list.to_alipay_dict()
  71. else:
  72. params['course_list'] = self.course_list
  73. if self.item_list:
  74. if isinstance(self.item_list, list):
  75. for i in range(0, len(self.item_list)):
  76. element = self.item_list[i]
  77. if hasattr(element, 'to_alipay_dict'):
  78. self.item_list[i] = element.to_alipay_dict()
  79. if hasattr(self.item_list, 'to_alipay_dict'):
  80. params['item_list'] = self.item_list.to_alipay_dict()
  81. else:
  82. params['item_list'] = self.item_list
  83. if self.time_dimension_type:
  84. if hasattr(self.time_dimension_type, 'to_alipay_dict'):
  85. params['time_dimension_type'] = self.time_dimension_type.to_alipay_dict()
  86. else:
  87. params['time_dimension_type'] = self.time_dimension_type
  88. if self.values:
  89. if hasattr(self.values, 'to_alipay_dict'):
  90. params['values'] = self.values.to_alipay_dict()
  91. else:
  92. params['values'] = self.values
  93. return params
  94. @staticmethod
  95. def from_alipay_dict(d):
  96. if not d:
  97. return None
  98. o = ExercisePlanOpenModel()
  99. if 'biz_type' in d:
  100. o.biz_type = d['biz_type']
  101. if 'course_list' in d:
  102. o.course_list = d['course_list']
  103. if 'item_list' in d:
  104. o.item_list = d['item_list']
  105. if 'time_dimension_type' in d:
  106. o.time_dimension_type = d['time_dimension_type']
  107. if 'values' in d:
  108. o.values = d['values']
  109. return o