identityApply.m.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. enum ApplyStateEnum {
  2. Applying,
  3. Refused,
  4. Passed,
  5. }
  6. class IdentityApplyInfo {
  7. String? identityApplyCode;
  8. String? userCode;
  9. String? realName;
  10. String? emailAddress;
  11. String? organizationCode;
  12. String? departmentCode;
  13. String? applyPosition;
  14. List<String>? identityCard;
  15. List<String>? licenseCard;
  16. ApplyStateEnum applyState;
  17. String? applyNote;
  18. IdentityApplyInfo({
  19. this.identityApplyCode,
  20. this.userCode,
  21. this.realName,
  22. this.emailAddress,
  23. this.organizationCode,
  24. this.departmentCode,
  25. this.applyPosition,
  26. this.identityCard,
  27. this.licenseCard,
  28. this.applyState=ApplyStateEnum.Applying,
  29. this.applyNote,
  30. });
  31. factory IdentityApplyInfo.fromJson(Map<String, dynamic> map) {
  32. final identityCardData = map['IdentityCard'];
  33. final licenseCardData = map['LicenseCard'];
  34. return IdentityApplyInfo(
  35. identityApplyCode: map['IdentityApplyCode'],
  36. userCode: map['UserCode'],
  37. realName: map['RealName'],
  38. emailAddress: map['EmailAddress'],
  39. organizationCode: map['OrganizationCode'],
  40. departmentCode: map['DepartmentCode'],
  41. applyPosition: map['ApplyPosition'],
  42. identityCard: identityCardData != null ? (identityCardData as List).map((e) => e as String).toList(): const [],
  43. licenseCard: licenseCardData != null ? (licenseCardData as List).map((e) => e as String).toList(): const [],
  44. applyState: ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']),
  45. applyNote: map['ApplyNote'],
  46. );
  47. }
  48. Map<String, dynamic> toJson() {
  49. final map = Map<String, dynamic>();
  50. if(identityApplyCode != null)
  51. map['IdentityApplyCode'] = identityApplyCode;
  52. if(userCode != null)
  53. map['UserCode'] = userCode;
  54. if(realName != null)
  55. map['RealName'] = realName;
  56. if(emailAddress != null)
  57. map['EmailAddress'] = emailAddress;
  58. if(organizationCode != null)
  59. map['OrganizationCode'] = organizationCode;
  60. if(departmentCode != null)
  61. map['DepartmentCode'] = departmentCode;
  62. if(applyPosition != null)
  63. map['ApplyPosition'] = applyPosition;
  64. if(identityCard != null)
  65. map['IdentityCard'] = identityCard;
  66. if(licenseCard != null)
  67. map['LicenseCard'] = licenseCard;
  68. map['ApplyState'] = applyState.index;
  69. if(applyNote != null)
  70. map['ApplyNote'] = applyNote;
  71. return map;
  72. }
  73. }