123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- import 'device.m.dart';
- import 'authentication.m.dart';
- enum ApplyStateEnum {
- NotApply,
- Applying,
- Refused,
- Passed,
- }
- class IdentityApplyDTO extends BaseDTO{
- String? identityApplyCode;
- String? userCode;
- String? applyPosition;
- List<String>? identityCard;
- List<String>? licenseCard;
- ApplyStateEnum applyState;
- String? applyNote;
- IdentityApplyDTO({
- this.identityApplyCode,
- this.userCode,
- this.applyPosition,
- this.identityCard,
- this.licenseCard,
- this.applyState = ApplyStateEnum.NotApply,
- this.applyNote,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- createTime: createTime,
- updateTime: updateTime,
- );
- factory IdentityApplyDTO.fromJson(Map<String, dynamic> map) {
- final identityCardData = map['IdentityCard'];
- final licenseCardData = map['LicenseCard'];
- return IdentityApplyDTO(
- identityApplyCode: map['IdentityApplyCode'],
- userCode: map['UserCode'],
- applyPosition: map['ApplyPosition'],
- identityCard: identityCardData != null ? (identityCardData as List).map((e) => e as String).toList(): null,
- licenseCard: licenseCardData != null ? (licenseCardData as List).map((e) => e as String).toList(): null,
- applyState: ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']),
- applyNote: map['ApplyNote'],
- createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
- updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if(identityApplyCode != null)
- map['IdentityApplyCode'] = identityApplyCode;
- if(userCode != null)
- map['UserCode'] = userCode;
- if(applyPosition != null)
- map['ApplyPosition'] = applyPosition;
- if(identityCard != null)
- map['IdentityCard'] = identityCard;
- if(licenseCard != null)
- map['LicenseCard'] = licenseCard;
- map['ApplyState'] = applyState.index;
- if(applyNote != null)
- map['ApplyNote'] = applyNote;
- return map;
- }
- }
- class GetLastIdentityApplyRequest extends TokenRequest{
- String? applyPosition;
- GetLastIdentityApplyRequest({
- this.applyPosition,
- String? token,
- }) : super(
- token: token,
- );
- factory GetLastIdentityApplyRequest.fromJson(Map<String, dynamic> map) {
- return GetLastIdentityApplyRequest(
- applyPosition: map['ApplyPosition'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if(applyPosition != null)
- map['ApplyPosition'] = applyPosition;
- return map;
- }
- }
- class ApplyForRequest extends IdentityApplyDTO{
- String? token;
- String? extensionData;
- ApplyForRequest({
- this.token,
- this.extensionData,
- String? identityApplyCode,
- String? userCode,
- String? applyPosition,
- List<String>? identityCard,
- List<String>? licenseCard,
- ApplyStateEnum applyState = ApplyStateEnum.NotApply,
- String? applyNote,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- identityApplyCode: identityApplyCode,
- userCode: userCode,
- applyPosition: applyPosition,
- identityCard: identityCard,
- licenseCard: licenseCard,
- applyState: applyState,
- applyNote: applyNote,
- createTime: createTime,
- updateTime: updateTime,
- );
- factory ApplyForRequest.fromJson(Map<String, dynamic> map) {
- final identityCardData = map['IdentityCard'];
- final licenseCardData = map['LicenseCard'];
- return ApplyForRequest(
- token: map['Token'],
- extensionData: map['ExtensionData'],
- identityApplyCode: map['IdentityApplyCode'],
- userCode: map['UserCode'],
- applyPosition: map['ApplyPosition'],
- identityCard: identityCardData != null ? (identityCardData as List).map((e) => e as String).toList(): null,
- licenseCard: licenseCardData != null ? (licenseCardData as List).map((e) => e as String).toList(): null,
- applyState: ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']),
- applyNote: map['ApplyNote'],
- createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
- updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if(token != null)
- map['Token'] = token;
- if(extensionData != null)
- map['ExtensionData'] = extensionData;
- return map;
- }
- }
|