Browse Source

resolve issue

melon.yin 3 years ago
parent
commit
d6ee98b7af
1 changed files with 306 additions and 340 deletions
  1. 306 340
      lib/services/device.m.dart

+ 306 - 340
lib/services/device.m.dart

@@ -3,364 +3,330 @@ import 'package:fis_jsonrpc/utils.dart';
 import 'package:fis_common/json_convert.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;
-	}
+  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;
+  }
 }
 
-class DeviceInfoDTO extends BaseDTO{
-	String? deviceCode;
-	String? serialNumber;
-	String? name;
-	String? description;
-	String? deviceModel;
-	String? deviceType;
-	String? headPicUrl;
-	String? deviceSoftwareVersion;
-	String? sDKSoftwareVersion;
-	String? organizationCode;
-	String? shortCode;
-
-	DeviceInfoDTO({
-		this.deviceCode,
-		this.serialNumber,
-		this.name,
-		this.description,
-		this.deviceModel,
-		this.deviceType,
-		this.headPicUrl,
-		this.deviceSoftwareVersion,
-		this.sDKSoftwareVersion,
-		this.organizationCode,
-		this.shortCode,
-		DateTime? createTime,
-		DateTime? updateTime,
-	}) : super(
-			createTime: createTime,
-			updateTime: updateTime,
-		);
-
-	factory DeviceInfoDTO.fromJson(Map<String, dynamic> map) {
-		return DeviceInfoDTO( 
-			deviceCode: map['DeviceCode'],
-			serialNumber: map['SerialNumber'],
-			name: map['Name'],
-			description: map['Description'],
-			deviceModel: map['DeviceModel'],
-			deviceType: map['DeviceType'],
-			headPicUrl: map['HeadPicUrl'],
-			deviceSoftwareVersion: map['DeviceSoftwareVersion'],
-			sDKSoftwareVersion: map['SDKSoftwareVersion'],
-			organizationCode: map['OrganizationCode'],
-			shortCode: map['ShortCode'],
-			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(deviceCode != null)
-			map['DeviceCode'] = deviceCode;
-		if(serialNumber != null)
-			map['SerialNumber'] = serialNumber;
-		if(name != null)
-			map['Name'] = name;
-		if(description != null)
-			map['Description'] = description;
-		if(deviceModel != null)
-			map['DeviceModel'] = deviceModel;
-		if(deviceType != null)
-			map['DeviceType'] = deviceType;
-		if(headPicUrl != null)
-			map['HeadPicUrl'] = headPicUrl;
-		if(deviceSoftwareVersion != null)
-			map['DeviceSoftwareVersion'] = deviceSoftwareVersion;
-		if(sDKSoftwareVersion != null)
-			map['SDKSoftwareVersion'] = sDKSoftwareVersion;
-		if(organizationCode != null)
-			map['OrganizationCode'] = organizationCode;
-		if(shortCode != null)
-			map['ShortCode'] = shortCode;
-		return map;
-	}
+class DeviceInfoDTO extends BaseDTO {
+  String? deviceCode;
+  String? serialNumber;
+  String? name;
+  String? description;
+  String? deviceModel;
+  String? deviceType;
+  String? headPicUrl;
+  String? deviceSoftwareVersion;
+  String? sDKSoftwareVersion;
+  String? organizationCode;
+  String? shortCode;
+
+  DeviceInfoDTO({
+    this.deviceCode,
+    this.serialNumber,
+    this.name,
+    this.description,
+    this.deviceModel,
+    this.deviceType,
+    this.headPicUrl,
+    this.deviceSoftwareVersion,
+    this.sDKSoftwareVersion,
+    this.organizationCode,
+    this.shortCode,
+    DateTime? createTime,
+    DateTime? updateTime,
+  }) : super(
+          createTime: createTime,
+          updateTime: updateTime,
+        );
+
+  factory DeviceInfoDTO.fromJson(Map<String, dynamic> map) {
+    return DeviceInfoDTO(
+      deviceCode: map['DeviceCode'],
+      serialNumber: map['SerialNumber'],
+      name: map['Name'],
+      description: map['Description'],
+      deviceModel: map['DeviceModel'],
+      deviceType: map['DeviceType'],
+      headPicUrl: map['HeadPicUrl'],
+      deviceSoftwareVersion: map['DeviceSoftwareVersion'],
+      sDKSoftwareVersion: map['SDKSoftwareVersion'],
+      organizationCode: map['OrganizationCode'],
+      shortCode: map['ShortCode'],
+      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 (deviceCode != null) map['DeviceCode'] = deviceCode;
+    if (serialNumber != null) map['SerialNumber'] = serialNumber;
+    if (name != null) map['Name'] = name;
+    if (description != null) map['Description'] = description;
+    if (deviceModel != null) map['DeviceModel'] = deviceModel;
+    if (deviceType != null) map['DeviceType'] = deviceType;
+    if (headPicUrl != null) map['HeadPicUrl'] = headPicUrl;
+    if (deviceSoftwareVersion != null)
+      map['DeviceSoftwareVersion'] = deviceSoftwareVersion;
+    if (sDKSoftwareVersion != null)
+      map['SDKSoftwareVersion'] = sDKSoftwareVersion;
+    if (organizationCode != null) map['OrganizationCode'] = organizationCode;
+    if (shortCode != null) map['ShortCode'] = shortCode;
+    return map;
+  }
 }
 
-class CreateDeviceRequest extends DeviceInfoDTO{
-	String? token;
-
-	CreateDeviceRequest({
-		this.token,
-		String? deviceCode,
-		String? serialNumber,
-		String? name,
-		String? description,
-		String? deviceModel,
-		String? deviceType,
-		String? headPicUrl,
-		String? deviceSoftwareVersion,
-		String? sDKSoftwareVersion,
-		String? organizationCode,
-		String? shortCode,
-		DateTime? createTime,
-		DateTime? updateTime,
-	}) : super(
-			deviceCode: deviceCode,
-			serialNumber: serialNumber,
-			name: name,
-			description: description,
-			deviceModel: deviceModel,
-			deviceType: deviceType,
-			headPicUrl: headPicUrl,
-			deviceSoftwareVersion: deviceSoftwareVersion,
-			sDKSoftwareVersion: sDKSoftwareVersion,
-			organizationCode: organizationCode,
-			shortCode: shortCode,
-			createTime: createTime,
-			updateTime: updateTime,
-		);
-
-	factory CreateDeviceRequest.fromJson(Map<String, dynamic> map) {
-		return CreateDeviceRequest( 
-			token: map['Token'],
-			deviceCode: map['DeviceCode'],
-			serialNumber: map['SerialNumber'],
-			name: map['Name'],
-			description: map['Description'],
-			deviceModel: map['DeviceModel'],
-			deviceType: map['DeviceType'],
-			headPicUrl: map['HeadPicUrl'],
-			deviceSoftwareVersion: map['DeviceSoftwareVersion'],
-			sDKSoftwareVersion: map['SDKSoftwareVersion'],
-			organizationCode: map['OrganizationCode'],
-			shortCode: map['ShortCode'],
-			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;
-	}
+class CreateDeviceRequest extends DeviceInfoDTO {
+  String? token;
+
+  CreateDeviceRequest({
+    this.token,
+    String? deviceCode,
+    String? serialNumber,
+    String? name,
+    String? description,
+    String? deviceModel,
+    String? deviceType,
+    String? headPicUrl,
+    String? deviceSoftwareVersion,
+    String? sDKSoftwareVersion,
+    String? organizationCode,
+    String? shortCode,
+    DateTime? createTime,
+    DateTime? updateTime,
+  }) : super(
+          deviceCode: deviceCode,
+          serialNumber: serialNumber,
+          name: name,
+          description: description,
+          deviceModel: deviceModel,
+          deviceType: deviceType,
+          headPicUrl: headPicUrl,
+          deviceSoftwareVersion: deviceSoftwareVersion,
+          sDKSoftwareVersion: sDKSoftwareVersion,
+          organizationCode: organizationCode,
+          shortCode: shortCode,
+          createTime: createTime,
+          updateTime: updateTime,
+        );
+
+  factory CreateDeviceRequest.fromJson(Map<String, dynamic> map) {
+    return CreateDeviceRequest(
+      token: map['Token'],
+      deviceCode: map['DeviceCode'],
+      serialNumber: map['SerialNumber'],
+      name: map['Name'],
+      description: map['Description'],
+      deviceModel: map['DeviceModel'],
+      deviceType: map['DeviceType'],
+      headPicUrl: map['HeadPicUrl'],
+      deviceSoftwareVersion: map['DeviceSoftwareVersion'],
+      sDKSoftwareVersion: map['SDKSoftwareVersion'],
+      organizationCode: map['OrganizationCode'],
+      shortCode: map['ShortCode'],
+      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;
+  }
 }
 
 class PageCollection<T> {
-	int currentPage;
-	int pageSize;
-	int dataCount;
-	List<T>? pageData;
-
-	PageCollection({
-		this.currentPage = 0,
-		this.pageSize = 0,
-		this.dataCount = 0,
-		this.pageData,
-	});
-
-	factory PageCollection.fromJson(Map<String, dynamic> map) {
-		List<T> pageDataList = [];
-		if (map['PageData'] != null) {
-			pageDataList.addAll(
-					(map['PageData'] as List).map((e) => FJsonConvert.fromJson<T>(e)!));
-		}
-		return PageCollection( 
-			currentPage: map['CurrentPage'],
-			pageSize: map['PageSize'],
-			dataCount: map['DataCount'],
-			pageData: pageDataList,
-		);
-	}
-
-	Map<String, dynamic> toJson() {
-		final map = Map<String, dynamic>();
-		map['CurrentPage'] = currentPage;
-		map['PageSize'] = pageSize;
-		map['DataCount'] = dataCount;
-		if(pageData != null)
-			map['PageData'] = pageData;
-		return map;
-	}
+  int currentPage;
+  int pageSize;
+  int dataCount;
+  List<T>? pageData;
+
+  PageCollection({
+    this.currentPage = 0,
+    this.pageSize = 0,
+    this.dataCount = 0,
+    this.pageData,
+  });
+
+  factory PageCollection.fromJson(Map<String, dynamic> map) {
+    List<T> pageDataList = [];
+    if (map['PageData'] != null) {
+      pageDataList.addAll(
+          (map['PageData'] as List).map((e) => FJsonConvert.fromJson<T>(e)!));
+    }
+    return PageCollection(
+      currentPage: map['CurrentPage'],
+      pageSize: map['PageSize'],
+      dataCount: map['DataCount'],
+      pageData: pageDataList,
+    );
+  }
+
+  Map<String, dynamic> toJson() {
+    final map = Map<String, dynamic>();
+    map['CurrentPage'] = currentPage;
+    map['PageSize'] = pageSize;
+    map['DataCount'] = dataCount;
+    if (pageData != null) map['PageData'] = pageData;
+    return map;
+  }
 }
 
-class BaseRequest {
-	String? token;
-
-	BaseRequest({
-		this.token,
-	});
-
-	factory BaseRequest.fromJson(Map<String, dynamic> map) {
-		return BaseRequest( 
-			token: map['Token'],
-		);
-	}
-
-	Map<String, dynamic> toJson() {
-		final map = Map<String, dynamic>();
-		if(token != null)
-			map['Token'] = token;
-		return map;
-	}
-}
-
-class PageRequest extends BaseRequest{
-	int currentPage;
-	int pageSize;
-	Map<String,String>? filter;
-	bool isFuzzy;
-
-	PageRequest({
-		this.currentPage = 0,
-		this.pageSize = 0,
-		this.filter,
-		this.isFuzzy = false,
-		String? token,
-	}) : super(
-			token: token,
-		);
-
-	factory PageRequest.fromJson(Map<String, dynamic> map) {
-		return PageRequest( 
-			currentPage: map['CurrentPage'],
-			pageSize: map['PageSize'],
-			filter: map['Filter'].cast<String,String>(),
-			isFuzzy: map['IsFuzzy'],
-			token: map['Token'],
-		);
-	}
-
-	Map<String, dynamic> toJson() {
-		final map = super.toJson();
-		map['CurrentPage'] = currentPage;
-		map['PageSize'] = pageSize;
-		if(filter != null)
-			map['Filter'] = filter;
-		map['IsFuzzy'] = isFuzzy;
-		return map;
-	}
+class PageRequest extends TokenRequest {
+  int currentPage;
+  int pageSize;
+  Map<String, String>? filter;
+  bool isFuzzy;
+
+  PageRequest({
+    this.currentPage = 0,
+    this.pageSize = 0,
+    this.filter,
+    this.isFuzzy = false,
+    String? token,
+  }) : super(
+          token: token,
+        );
+
+  factory PageRequest.fromJson(Map<String, dynamic> map) {
+    return PageRequest(
+      currentPage: map['CurrentPage'],
+      pageSize: map['PageSize'],
+      filter: map['Filter'].cast<String, String>(),
+      isFuzzy: map['IsFuzzy'],
+      token: map['Token'],
+    );
+  }
+
+  Map<String, dynamic> toJson() {
+    final map = super.toJson();
+    map['CurrentPage'] = currentPage;
+    map['PageSize'] = pageSize;
+    if (filter != null) map['Filter'] = filter;
+    map['IsFuzzy'] = isFuzzy;
+    return map;
+  }
 }
 
 class BaseRequest {
+  BaseRequest();
 
-	BaseRequest();
+  factory BaseRequest.fromJson(Map<String, dynamic> map) {
+    return BaseRequest();
+  }
 
-	factory BaseRequest.fromJson(Map<String, dynamic> map) {
-		return BaseRequest( 
-		);
-	}
-
-	Map<String, dynamic> toJson() {
-		final map = Map<String, dynamic>();
-		return map;
-	}
+  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 TokenRequest extends BaseRequest {
+  String? token;
 
-class CreateShareDeviceToUserRequest extends TokenRequest{
-	List<String>? userCodes;
-	String? deviceCode;
-
-	CreateShareDeviceToUserRequest({
-		this.userCodes,
-		this.deviceCode,
-		String? token,
-	}) : super(
-			token: token,
-		);
-
-	factory CreateShareDeviceToUserRequest.fromJson(Map<String, dynamic> map) {
-		final userCodesData = map['UserCodes'];
-		return CreateShareDeviceToUserRequest( 
-			userCodes: userCodesData != null ? (userCodesData as List).map((e) => e as String).toList(): null,
-			deviceCode: map['DeviceCode'],
-			token: map['Token'],
-		);
-	}
-
-	Map<String, dynamic> toJson() {
-		final map = super.toJson();
-		if(userCodes != null)
-			map['UserCodes'] = userCodes;
-		if(deviceCode != null)
-			map['DeviceCode'] = deviceCode;
-		return map;
-	}
-}
+  TokenRequest({
+    this.token,
+  }) : super();
 
-class DeleteShareDeviceToUserRequest extends TokenRequest{
-	List<String>? userCodes;
-	String? deviceCode;
-
-	DeleteShareDeviceToUserRequest({
-		this.userCodes,
-		this.deviceCode,
-		String? token,
-	}) : super(
-			token: token,
-		);
-
-	factory DeleteShareDeviceToUserRequest.fromJson(Map<String, dynamic> map) {
-		final userCodesData = map['UserCodes'];
-		return DeleteShareDeviceToUserRequest( 
-			userCodes: userCodesData != null ? (userCodesData as List).map((e) => e as String).toList(): null,
-			deviceCode: map['DeviceCode'],
-			token: map['Token'],
-		);
-	}
-
-	Map<String, dynamic> toJson() {
-		final map = super.toJson();
-		if(userCodes != null)
-			map['UserCodes'] = userCodes;
-		if(deviceCode != null)
-			map['DeviceCode'] = deviceCode;
-		return map;
-	}
-}
+  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 CreateShareDeviceToUserRequest extends TokenRequest {
+  List<String>? userCodes;
+  String? deviceCode;
+
+  CreateShareDeviceToUserRequest({
+    this.userCodes,
+    this.deviceCode,
+    String? token,
+  }) : super(
+          token: token,
+        );
+
+  factory CreateShareDeviceToUserRequest.fromJson(Map<String, dynamic> map) {
+    final userCodesData = map['UserCodes'];
+    return CreateShareDeviceToUserRequest(
+      userCodes: userCodesData != null
+          ? (userCodesData as List).map((e) => e as String).toList()
+          : null,
+      deviceCode: map['DeviceCode'],
+      token: map['Token'],
+    );
+  }
+
+  Map<String, dynamic> toJson() {
+    final map = super.toJson();
+    if (userCodes != null) map['UserCodes'] = userCodes;
+    if (deviceCode != null) map['DeviceCode'] = deviceCode;
+    return map;
+  }
+}
 
+class DeleteShareDeviceToUserRequest extends TokenRequest {
+  List<String>? userCodes;
+  String? deviceCode;
+
+  DeleteShareDeviceToUserRequest({
+    this.userCodes,
+    this.deviceCode,
+    String? token,
+  }) : super(
+          token: token,
+        );
+
+  factory DeleteShareDeviceToUserRequest.fromJson(Map<String, dynamic> map) {
+    final userCodesData = map['UserCodes'];
+    return DeleteShareDeviceToUserRequest(
+      userCodes: userCodesData != null
+          ? (userCodesData as List).map((e) => e as String).toList()
+          : null,
+      deviceCode: map['DeviceCode'],
+      token: map['Token'],
+    );
+  }
+
+  Map<String, dynamic> toJson() {
+    final map = super.toJson();
+    if (userCodes != null) map['UserCodes'] = userCodes;
+    if (deviceCode != null) map['DeviceCode'] = deviceCode;
+    return map;
+  }
+}