一次大的提交
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
class OrgEntity {
|
||||
final int id;
|
||||
final String name;
|
||||
|
||||
const OrgEntity({required this.id, required this.name});
|
||||
|
||||
static int _parseId(dynamic value) {
|
||||
if (value is int) return value;
|
||||
if (value is num) return value.toInt();
|
||||
if (value is String) return int.tryParse(value) ?? 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
factory OrgEntity.fromJson(Map<String, dynamic> json) {
|
||||
return OrgEntity(
|
||||
id: _parseId(json['id']),
|
||||
name: json['name'] ?? json['orgName'] ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SiteEntity {
|
||||
final int id;
|
||||
final String name;
|
||||
|
||||
const SiteEntity({required this.id, required this.name});
|
||||
|
||||
static int _parseId(dynamic value) {
|
||||
if (value is int) return value;
|
||||
if (value is num) return value.toInt();
|
||||
if (value is String) return int.tryParse(value) ?? 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
factory SiteEntity.fromJson(Map<String, dynamic> json) {
|
||||
return SiteEntity(
|
||||
id: _parseId(json['id']),
|
||||
name: json['name'] ?? json['siteName'] ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UserSimpleEntity {
|
||||
final int id;
|
||||
final String name;
|
||||
|
||||
const UserSimpleEntity({required this.id, required this.name});
|
||||
|
||||
static int _parseId(dynamic value) {
|
||||
if (value is int) return value;
|
||||
if (value is num) return value.toInt();
|
||||
if (value is String) return int.tryParse(value) ?? 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
factory UserSimpleEntity.fromJson(Map<String, dynamic> json) {
|
||||
return UserSimpleEntity(
|
||||
id: _parseId(json['userId'] ?? json['id']),
|
||||
name: json['nickName'] ?? json['name'] ?? json['username'] ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,8 @@ class UAVDetailEntity extends Equatable {
|
||||
final double? homeDistance;
|
||||
final double? liveCapacity;
|
||||
final String? rainfall;
|
||||
final String? airConditionerStatus;
|
||||
final String? hangarStatus;
|
||||
final List<CameraInfo>? gatewayCameraList;
|
||||
final List<CameraInfo>? droneCameraList;
|
||||
final int? orgId;
|
||||
@@ -117,6 +119,8 @@ class UAVDetailEntity extends Equatable {
|
||||
this.homeDistance,
|
||||
this.liveCapacity,
|
||||
this.rainfall,
|
||||
this.airConditionerStatus,
|
||||
this.hangarStatus,
|
||||
this.gatewayCameraList,
|
||||
this.droneCameraList,
|
||||
this.orgId,
|
||||
@@ -166,6 +170,8 @@ class UAVDetailEntity extends Equatable {
|
||||
? (json['live_capacity'] as num).toDouble()
|
||||
: null,
|
||||
rainfall: json['rainfall']?.toString(),
|
||||
airConditionerStatus: json['air_conditioner_status'] ?? '',
|
||||
hangarStatus: json['hangar_status'] ?? '',
|
||||
gatewayCameraList: json['gateway_camera_list'] != null
|
||||
? (json['gateway_camera_list'] as List)
|
||||
.map((item) => CameraInfo.fromJson(item))
|
||||
@@ -203,6 +209,8 @@ class UAVDetailEntity extends Equatable {
|
||||
'home_distance': homeDistance,
|
||||
'live_capacity': liveCapacity,
|
||||
'rainfall': rainfall,
|
||||
'air_conditioner_status': airConditionerStatus,
|
||||
'hangar_status': hangarStatus,
|
||||
'gateway_camera_list': gatewayCameraList?.map((c) => c.toJson()).toList(),
|
||||
'drone_camera_list': droneCameraList,
|
||||
'orgId': orgId,
|
||||
@@ -233,6 +241,8 @@ class UAVDetailEntity extends Equatable {
|
||||
homeDistance,
|
||||
liveCapacity,
|
||||
rainfall,
|
||||
airConditionerStatus,
|
||||
hangarStatus,
|
||||
gatewayCameraList,
|
||||
droneCameraList,
|
||||
orgId,
|
||||
@@ -260,6 +270,8 @@ class DroneStationEntity extends Equatable {
|
||||
final double? homeDistance; // 距离home点距离
|
||||
final double? liveCapacity; // 实时容量
|
||||
final double? rainfall; // 降雨量
|
||||
final String? airConditionerStatus; // 机场空调状态
|
||||
final String? hangarStatus; // 机库状态
|
||||
final List<CameraInfo>? gatewayCameraList; // 网关摄像头列表
|
||||
final List<dynamic>? droneCameraList; // 无人机摄像头列表
|
||||
final int orgId; // 组织ID
|
||||
@@ -284,6 +296,8 @@ class DroneStationEntity extends Equatable {
|
||||
this.homeDistance,
|
||||
this.liveCapacity,
|
||||
this.rainfall,
|
||||
this.airConditionerStatus,
|
||||
this.hangarStatus,
|
||||
this.gatewayCameraList,
|
||||
this.droneCameraList,
|
||||
required this.orgId,
|
||||
@@ -328,6 +342,8 @@ class DroneStationEntity extends Equatable {
|
||||
rainfall: json['rainfall'] != null
|
||||
? (json['rainfall'] as num).toDouble()
|
||||
: null,
|
||||
airConditionerStatus: json['air_conditioner_status'] ?? '',
|
||||
hangarStatus: json['hangar_status'] ?? '',
|
||||
gatewayCameraList: json['gateway_camera_list'] != null
|
||||
? (json['gateway_camera_list'] as List)
|
||||
.map((item) => CameraInfo.fromJson(item))
|
||||
@@ -398,6 +414,8 @@ class DroneStationEntity extends Equatable {
|
||||
homeDistance,
|
||||
liveCapacity,
|
||||
rainfall,
|
||||
airConditionerStatus,
|
||||
hangarStatus,
|
||||
gatewayCameraList,
|
||||
droneCameraList,
|
||||
orgId,
|
||||
|
||||
Reference in New Issue
Block a user