VehicleInfo.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class VehicleInfo(object):
  6. def __init__(self):
  7. self._company_id = None
  8. self._vehicle_code = None
  9. self._vehicle_subject_code = None
  10. @property
  11. def company_id(self):
  12. return self._company_id
  13. @company_id.setter
  14. def company_id(self, value):
  15. self._company_id = value
  16. @property
  17. def vehicle_code(self):
  18. return self._vehicle_code
  19. @vehicle_code.setter
  20. def vehicle_code(self, value):
  21. self._vehicle_code = value
  22. @property
  23. def vehicle_subject_code(self):
  24. return self._vehicle_subject_code
  25. @vehicle_subject_code.setter
  26. def vehicle_subject_code(self, value):
  27. self._vehicle_subject_code = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.company_id:
  31. if hasattr(self.company_id, 'to_alipay_dict'):
  32. params['company_id'] = self.company_id.to_alipay_dict()
  33. else:
  34. params['company_id'] = self.company_id
  35. if self.vehicle_code:
  36. if hasattr(self.vehicle_code, 'to_alipay_dict'):
  37. params['vehicle_code'] = self.vehicle_code.to_alipay_dict()
  38. else:
  39. params['vehicle_code'] = self.vehicle_code
  40. if self.vehicle_subject_code:
  41. if hasattr(self.vehicle_subject_code, 'to_alipay_dict'):
  42. params['vehicle_subject_code'] = self.vehicle_subject_code.to_alipay_dict()
  43. else:
  44. params['vehicle_subject_code'] = self.vehicle_subject_code
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = VehicleInfo()
  51. if 'company_id' in d:
  52. o.company_id = d['company_id']
  53. if 'vehicle_code' in d:
  54. o.vehicle_code = d['vehicle_code']
  55. if 'vehicle_subject_code' in d:
  56. o.vehicle_subject_code = d['vehicle_subject_code']
  57. return o