123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468 |
- import 'package:fis_jsonrpc/utils.dart';
- class BaseDTO {
- DateTime? createTime;
- DateTime? updateTime;
- BaseDTO({
- this.createTime,
- this.updateTime,
- });
- factory BaseDTO.fromJson(Map<String, dynamic> map) {
- return BaseDTO(
- createTime:
- map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
- updateTime:
- map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
- );
- }
- Map<String, dynamic> toJson() {
- final map = Map<String, dynamic>();
- if (createTime != null)
- map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
- if (updateTime != null)
- map['UpdateTime'] = JsonRpcUtils.dateFormat(updateTime!);
- return map;
- }
- }
- enum UserInfoStateEnum {
- Nonactivated,
- Activated,
- }
- enum ApplyStateEnum {
- NotApply,
- Applying,
- Refused,
- Passed,
- }
- class UserDTO extends BaseDTO {
- String? userCode;
- String? userName;
- String? phone;
- String? email;
- String? nickName;
- String? fullName;
- String? headImageUrl;
- String? organizationCode;
- String? rootOrganizationCode;
- List<String>? authorityGroups;
- List<String>? bindDevices;
- String? lastIP;
- int logintimes;
- UserInfoStateEnum userState;
- List<String>? roleCodes;
- List<String>? rankCodes;
- List<String>? positionCodes;
- ApplyStateEnum applyState;
- UserDTO({
- this.userCode,
- this.userName,
- this.phone,
- this.email,
- this.nickName,
- this.fullName,
- this.headImageUrl,
- this.organizationCode,
- this.rootOrganizationCode,
- this.authorityGroups,
- this.bindDevices,
- this.lastIP,
- this.logintimes = 0,
- this.userState = UserInfoStateEnum.Nonactivated,
- this.roleCodes,
- this.rankCodes,
- this.positionCodes,
- this.applyState = ApplyStateEnum.NotApply,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- createTime: createTime,
- updateTime: updateTime,
- );
- factory UserDTO.fromJson(Map<String, dynamic> map) {
- return UserDTO(
- userCode: map['UserCode'],
- userName: map['UserName'],
- phone: map['Phone'],
- email: map['Email'],
- nickName: map['NickName'],
- fullName: map['FullName'],
- headImageUrl: map['HeadImageUrl'],
- organizationCode: map['OrganizationCode'],
- rootOrganizationCode: map['RootOrganizationCode'],
- authorityGroups: map['AuthorityGroups'].cast<String>().toList(),
- bindDevices: map['BindDevices'].cast<String>().toList(),
- lastIP: map['LastIP'],
- logintimes: map['Logintimes'],
- userState: UserInfoStateEnum.values
- .firstWhere((e) => e.index == map['UserState']),
- roleCodes: map['RoleCodes'].cast<String>().toList(),
- rankCodes: map['RankCodes'].cast<String>().toList(),
- positionCodes: map['PositionCodes'].cast<String>().toList(),
- applyState:
- ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']),
- 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 (userCode != null) map['UserCode'] = userCode;
- if (userName != null) map['UserName'] = userName;
- if (phone != null) map['Phone'] = phone;
- if (email != null) map['Email'] = email;
- if (nickName != null) map['NickName'] = nickName;
- if (fullName != null) map['FullName'] = fullName;
- if (headImageUrl != null) map['HeadImageUrl'] = headImageUrl;
- if (organizationCode != null) map['OrganizationCode'] = organizationCode;
- if (rootOrganizationCode != null)
- map['RootOrganizationCode'] = rootOrganizationCode;
- if (authorityGroups != null) map['AuthorityGroups'] = authorityGroups;
- if (bindDevices != null) map['BindDevices'] = bindDevices;
- if (lastIP != null) map['LastIP'] = lastIP;
- map['Logintimes'] = logintimes;
- map['UserState'] = userState.index;
- if (roleCodes != null) map['RoleCodes'] = roleCodes;
- if (rankCodes != null) map['RankCodes'] = rankCodes;
- if (positionCodes != null) map['PositionCodes'] = positionCodes;
- map['ApplyState'] = applyState.index;
- return map;
- }
- }
- class BaseRequest {
- BaseRequest();
- factory BaseRequest.fromJson(Map<String, dynamic> map) {
- return BaseRequest();
- }
- Map<String, dynamic> toJson() {
- final map = Map<String, dynamic>();
- return map;
- }
- }
- class TokenRequest extends BaseRequest {
- String? token;
- TokenRequest({
- this.token,
- }) : super();
- factory TokenRequest.fromJson(Map<String, dynamic> map) {
- return TokenRequest(
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (token != null) map['Token'] = token;
- return map;
- }
- }
- class GetUserInfoRequest extends TokenRequest {
- GetUserInfoRequest({
- String? token,
- }) : super(
- token: token,
- );
- factory GetUserInfoRequest.fromJson(Map<String, dynamic> map) {
- return GetUserInfoRequest(
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- return map;
- }
- }
- class AlterUserInfoRequest extends UserDTO {
- String? token;
- String? extensionData;
- AlterUserInfoRequest({
- this.token,
- this.extensionData,
- String? userCode,
- String? userName,
- String? phone,
- String? email,
- String? nickName,
- String? fullName,
- String? headImageUrl,
- String? organizationCode,
- String? rootOrganizationCode,
- List<String>? authorityGroups,
- List<String>? bindDevices,
- String? lastIP,
- int logintimes = 0,
- UserInfoStateEnum userState = UserInfoStateEnum.Nonactivated,
- List<String>? roleCodes,
- List<String>? rankCodes,
- List<String>? positionCodes,
- ApplyStateEnum applyState = ApplyStateEnum.NotApply,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- userCode: userCode,
- userName: userName,
- phone: phone,
- email: email,
- nickName: nickName,
- fullName: fullName,
- headImageUrl: headImageUrl,
- organizationCode: organizationCode,
- rootOrganizationCode: rootOrganizationCode,
- authorityGroups: authorityGroups,
- bindDevices: bindDevices,
- lastIP: lastIP,
- logintimes: logintimes,
- userState: userState,
- roleCodes: roleCodes,
- rankCodes: rankCodes,
- positionCodes: positionCodes,
- applyState: applyState,
- createTime: createTime,
- updateTime: updateTime,
- );
- factory AlterUserInfoRequest.fromJson(Map<String, dynamic> map) {
- return AlterUserInfoRequest(
- token: map['Token'],
- extensionData: map['ExtensionData'],
- userCode: map['UserCode'],
- userName: map['UserName'],
- phone: map['Phone'],
- email: map['Email'],
- nickName: map['NickName'],
- fullName: map['FullName'],
- headImageUrl: map['HeadImageUrl'],
- organizationCode: map['OrganizationCode'],
- rootOrganizationCode: map['RootOrganizationCode'],
- authorityGroups: map['AuthorityGroups'].cast<String>().toList(),
- bindDevices: map['BindDevices'].cast<String>().toList(),
- lastIP: map['LastIP'],
- logintimes: map['Logintimes'],
- userState: UserInfoStateEnum.values
- .firstWhere((e) => e.index == map['UserState']),
- roleCodes: map['RoleCodes'].cast<String>().toList(),
- rankCodes: map['RankCodes'].cast<String>().toList(),
- positionCodes: map['PositionCodes'].cast<String>().toList(),
- applyState:
- ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']),
- 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;
- }
- }
- class GetUserListRequest extends TokenRequest {
- String? roleCode;
- String? rankCode;
- String? positionCode;
- String? organizationCode;
- GetUserListRequest({
- this.roleCode,
- this.rankCode,
- this.positionCode,
- this.organizationCode,
- String? token,
- }) : super(
- token: token,
- );
- factory GetUserListRequest.fromJson(Map<String, dynamic> map) {
- return GetUserListRequest(
- roleCode: map['RoleCode'],
- rankCode: map['RankCode'],
- positionCode: map['PositionCode'],
- organizationCode: map['OrganizationCode'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (roleCode != null) map['RoleCode'] = roleCode;
- if (rankCode != null) map['RankCode'] = rankCode;
- if (positionCode != null) map['PositionCode'] = positionCode;
- if (organizationCode != null) map['OrganizationCode'] = organizationCode;
- return map;
- }
- }
- class RemoveUsersFromOrganizationRequest extends TokenRequest {
- List<String>? userCodes;
- RemoveUsersFromOrganizationRequest({
- this.userCodes,
- String? token,
- }) : super(
- token: token,
- );
- factory RemoveUsersFromOrganizationRequest.fromJson(
- Map<String, dynamic> map) {
- return RemoveUsersFromOrganizationRequest(
- userCodes: map['UserCodes'].cast<String>().toList(),
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (userCodes != null) map['UserCodes'] = userCodes;
- return map;
- }
- }
- class SetUserOrganizationInfoRequest extends TokenRequest {
- String? userCode;
- List<String>? roleCodes;
- List<String>? rankCodes;
- List<String>? positionCodes;
- String? organizationCode;
- SetUserOrganizationInfoRequest({
- this.userCode,
- this.roleCodes,
- this.rankCodes,
- this.positionCodes,
- this.organizationCode,
- String? token,
- }) : super(
- token: token,
- );
- factory SetUserOrganizationInfoRequest.fromJson(Map<String, dynamic> map) {
- return SetUserOrganizationInfoRequest(
- userCode: map['UserCode'],
- roleCodes: map['RoleCodes'].cast<String>().toList(),
- rankCodes: map['RankCodes'].cast<String>().toList(),
- positionCodes: map['PositionCodes'].cast<String>().toList(),
- organizationCode: map['OrganizationCode'],
- token: map['Token'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = super.toJson();
- if (userCode != null) map['UserCode'] = userCode;
- if (roleCodes != null) map['RoleCodes'] = roleCodes;
- if (rankCodes != null) map['RankCodes'] = rankCodes;
- if (positionCodes != null) map['PositionCodes'] = positionCodes;
- if (organizationCode != null) map['OrganizationCode'] = organizationCode;
- return map;
- }
- }
- class AlterPersonInfoRequest extends UserDTO {
- String? token;
- AlterPersonInfoRequest({
- this.token,
- String? userCode,
- String? userName,
- String? phone,
- String? email,
- String? nickName,
- String? fullName,
- String? headImageUrl,
- String? organizationCode,
- String? rootOrganizationCode,
- List<String>? authorityGroups,
- List<String>? bindDevices,
- String? lastIP,
- int logintimes = 0,
- UserInfoStateEnum userState = UserInfoStateEnum.Nonactivated,
- List<String>? roleCodes,
- List<String>? rankCodes,
- List<String>? positionCodes,
- ApplyStateEnum applyState = ApplyStateEnum.NotApply,
- DateTime? createTime,
- DateTime? updateTime,
- }) : super(
- userCode: userCode,
- userName: userName,
- phone: phone,
- email: email,
- nickName: nickName,
- fullName: fullName,
- headImageUrl: headImageUrl,
- organizationCode: organizationCode,
- rootOrganizationCode: rootOrganizationCode,
- authorityGroups: authorityGroups,
- bindDevices: bindDevices,
- lastIP: lastIP,
- logintimes: logintimes,
- userState: userState,
- roleCodes: roleCodes,
- rankCodes: rankCodes,
- positionCodes: positionCodes,
- applyState: applyState,
- createTime: createTime,
- updateTime: updateTime,
- );
- factory AlterPersonInfoRequest.fromJson(Map<String, dynamic> map) {
- return AlterPersonInfoRequest(
- token: map['Token'],
- userCode: map['UserCode'],
- userName: map['UserName'],
- phone: map['Phone'],
- email: map['Email'],
- nickName: map['NickName'],
- fullName: map['FullName'],
- headImageUrl: map['HeadImageUrl'],
- organizationCode: map['OrganizationCode'],
- rootOrganizationCode: map['RootOrganizationCode'],
- authorityGroups: map['AuthorityGroups'].cast<String>().toList(),
- bindDevices: map['BindDevices'].cast<String>().toList(),
- lastIP: map['LastIP'],
- logintimes: map['Logintimes'],
- userState: UserInfoStateEnum.values
- .firstWhere((e) => e.index == map['UserState']),
- roleCodes: map['RoleCodes'].cast<String>().toList(),
- rankCodes: map['RankCodes'].cast<String>().toList(),
- positionCodes: map['PositionCodes'].cast<String>().toList(),
- applyState:
- ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']),
- 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;
- return map;
- }
- }
|