RegionState.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class RegionState(object):
  6. def __init__(self):
  7. self._floor = None
  8. self._left_max = None
  9. self._left_min = None
  10. self._left_push = None
  11. @property
  12. def floor(self):
  13. return self._floor
  14. @floor.setter
  15. def floor(self, value):
  16. self._floor = value
  17. @property
  18. def left_max(self):
  19. return self._left_max
  20. @left_max.setter
  21. def left_max(self, value):
  22. self._left_max = value
  23. @property
  24. def left_min(self):
  25. return self._left_min
  26. @left_min.setter
  27. def left_min(self, value):
  28. self._left_min = value
  29. @property
  30. def left_push(self):
  31. return self._left_push
  32. @left_push.setter
  33. def left_push(self, value):
  34. self._left_push = value
  35. def to_alipay_dict(self):
  36. params = dict()
  37. if self.floor:
  38. if hasattr(self.floor, 'to_alipay_dict'):
  39. params['floor'] = self.floor.to_alipay_dict()
  40. else:
  41. params['floor'] = self.floor
  42. if self.left_max:
  43. if hasattr(self.left_max, 'to_alipay_dict'):
  44. params['left_max'] = self.left_max.to_alipay_dict()
  45. else:
  46. params['left_max'] = self.left_max
  47. if self.left_min:
  48. if hasattr(self.left_min, 'to_alipay_dict'):
  49. params['left_min'] = self.left_min.to_alipay_dict()
  50. else:
  51. params['left_min'] = self.left_min
  52. if self.left_push:
  53. if hasattr(self.left_push, 'to_alipay_dict'):
  54. params['left_push'] = self.left_push.to_alipay_dict()
  55. else:
  56. params['left_push'] = self.left_push
  57. return params
  58. @staticmethod
  59. def from_alipay_dict(d):
  60. if not d:
  61. return None
  62. o = RegionState()
  63. if 'floor' in d:
  64. o.floor = d['floor']
  65. if 'left_max' in d:
  66. o.left_max = d['left_max']
  67. if 'left_min' in d:
  68. o.left_min = d['left_min']
  69. if 'left_push' in d:
  70. o.left_push = d['left_push']
  71. return o