identityApply.m.dart 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. import 'device.m.dart';
  2. import 'authentication.m.dart';
  3. enum ApplyStateEnum {
  4. NotApply,
  5. Applying,
  6. Refused,
  7. Passed,
  8. }
  9. class IdentityApplyDTO extends BaseDTO{
  10. String? identityApplyCode;
  11. String? userCode;
  12. String? applyPosition;
  13. List<String>? identityCard;
  14. List<String>? licenseCard;
  15. ApplyStateEnum applyState;
  16. String? applyNote;
  17. IdentityApplyDTO({
  18. this.identityApplyCode,
  19. this.userCode,
  20. this.applyPosition,
  21. this.identityCard,
  22. this.licenseCard,
  23. this.applyState = ApplyStateEnum.NotApply,
  24. this.applyNote,
  25. DateTime? createTime,
  26. DateTime? updateTime,
  27. }) : super(
  28. createTime: createTime,
  29. updateTime: updateTime,
  30. );
  31. factory IdentityApplyDTO.fromJson(Map<String, dynamic> map) {
  32. final identityCardData = map['IdentityCard'];
  33. final licenseCardData = map['LicenseCard'];
  34. return IdentityApplyDTO(
  35. identityApplyCode: map['IdentityApplyCode'],
  36. userCode: map['UserCode'],
  37. applyPosition: map['ApplyPosition'],
  38. identityCard: identityCardData != null ? (identityCardData as List).map((e) => e as String).toList(): null,
  39. licenseCard: licenseCardData != null ? (licenseCardData as List).map((e) => e as String).toList(): null,
  40. applyState: ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']),
  41. applyNote: map['ApplyNote'],
  42. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  43. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  44. );
  45. }
  46. Map<String, dynamic> toJson() {
  47. final map = super.toJson();
  48. if(identityApplyCode != null)
  49. map['IdentityApplyCode'] = identityApplyCode;
  50. if(userCode != null)
  51. map['UserCode'] = userCode;
  52. if(applyPosition != null)
  53. map['ApplyPosition'] = applyPosition;
  54. if(identityCard != null)
  55. map['IdentityCard'] = identityCard;
  56. if(licenseCard != null)
  57. map['LicenseCard'] = licenseCard;
  58. map['ApplyState'] = applyState.index;
  59. if(applyNote != null)
  60. map['ApplyNote'] = applyNote;
  61. return map;
  62. }
  63. }
  64. class GetLastIdentityApplyRequest extends TokenRequest{
  65. String? applyPosition;
  66. GetLastIdentityApplyRequest({
  67. this.applyPosition,
  68. String? token,
  69. }) : super(
  70. token: token,
  71. );
  72. factory GetLastIdentityApplyRequest.fromJson(Map<String, dynamic> map) {
  73. return GetLastIdentityApplyRequest(
  74. applyPosition: map['ApplyPosition'],
  75. token: map['Token'],
  76. );
  77. }
  78. Map<String, dynamic> toJson() {
  79. final map = super.toJson();
  80. if(applyPosition != null)
  81. map['ApplyPosition'] = applyPosition;
  82. return map;
  83. }
  84. }
  85. class ApplyForRequest extends IdentityApplyDTO{
  86. String? token;
  87. String? extensionData;
  88. ApplyForRequest({
  89. this.token,
  90. this.extensionData,
  91. String? identityApplyCode,
  92. String? userCode,
  93. String? applyPosition,
  94. List<String>? identityCard,
  95. List<String>? licenseCard,
  96. ApplyStateEnum applyState = ApplyStateEnum.NotApply,
  97. String? applyNote,
  98. DateTime? createTime,
  99. DateTime? updateTime,
  100. }) : super(
  101. identityApplyCode: identityApplyCode,
  102. userCode: userCode,
  103. applyPosition: applyPosition,
  104. identityCard: identityCard,
  105. licenseCard: licenseCard,
  106. applyState: applyState,
  107. applyNote: applyNote,
  108. createTime: createTime,
  109. updateTime: updateTime,
  110. );
  111. factory ApplyForRequest.fromJson(Map<String, dynamic> map) {
  112. final identityCardData = map['IdentityCard'];
  113. final licenseCardData = map['LicenseCard'];
  114. return ApplyForRequest(
  115. token: map['Token'],
  116. extensionData: map['ExtensionData'],
  117. identityApplyCode: map['IdentityApplyCode'],
  118. userCode: map['UserCode'],
  119. applyPosition: map['ApplyPosition'],
  120. identityCard: identityCardData != null ? (identityCardData as List).map((e) => e as String).toList(): null,
  121. licenseCard: licenseCardData != null ? (licenseCardData as List).map((e) => e as String).toList(): null,
  122. applyState: ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']),
  123. applyNote: map['ApplyNote'],
  124. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  125. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  126. );
  127. }
  128. Map<String, dynamic> toJson() {
  129. final map = super.toJson();
  130. if(token != null)
  131. map['Token'] = token;
  132. if(extensionData != null)
  133. map['ExtensionData'] = extensionData;
  134. return map;
  135. }
  136. }