import 'dart:core';
import 'package:json_annotation/json_annotation.dart';
/// 任务单完整版数据类
@JsonSerializable()
class FrequentInspectionTaskCompleteDataClass extends Object{
/// ID
@JsonKey()
String? id;
/// 负责人
@JsonKey()
String? principal;
/// 对应毫秒时间
@JsonKey()
int? taskDate;
/// 任务名
@JsonKey()
String? taskDescribe;
/// 任务单号
@JsonKey()
String? taskNo;
/// 任务状态
@JsonKey()
String? taskStatus;
/// 任务类型预选
@JsonKey()
String? taskType;
/// 检查人
@JsonKey()
String? taskUser;
/// 天气
@JsonKey()
String? weather;
/// 更新时间
@JsonKey()
int? updateTime;
/// 版本号
@JsonKey()
int? version;
/// 桥梁细节
@JsonKey()
List<BridgeDetailClass?>? bridgeDetails;
/// 桥梁ID列表
@JsonKey()
List<String?>? bridgeIdList;
/// 检查项目ID列表
@JsonKey()
List<String?>? configIdList;
/// 涵洞通道检查
@JsonKey()
CulvertCheckClass? culvertCheck;
/// 路基路面检查
@JsonKey()
RoadbedCheckClass? roadbedCheck;
/// 任务桥梁任务完成情况
@JsonKey()
List<TaskBridgeClass?>? taskBridgeList;
FrequentInspectionTaskCompleteDataClass(
this.id,
this.principal,
this.taskDate,
this.taskDescribe,
this.taskNo,
this.taskStatus,
this.taskType,
this.taskUser,
this.weather,
this.updateTime,
this.version,
this.bridgeDetails,
this.bridgeIdList,
this.configIdList,
this.culvertCheck,
this.roadbedCheck,
this.taskBridgeList);
factory FrequentInspectionTaskCompleteDataClass.fromJson(Map<String,dynamic> json)=> _$FrequentInspectionTaskCompleteDataClassFromJson(json);
Map<String,dynamic> toJson() => _$FrequentInspectionTaskCompleteDataClassToJson(this);
}
FrequentInspectionTaskCompleteDataClass _$FrequentInspectionTaskCompleteDataClassFromJson(Map<String, dynamic> json) {
/// 处理收到的数据中configIdList不存在的情况
List<String?>? _configIdList;
if(json['configIdList'] == null){
_configIdList = [];
}
else{
_configIdList = (json['configIdList'] as List).map((e) => e == null ? null: e as String).toList();
}
/// 处理收到的数据中bridgeIdList不存在的情况
List<String?>? _bridgeIdList;
if(json['bridgeIdList'] == null){
_bridgeIdList = [];
}
else{
_bridgeIdList = (json['bridgeIdList'] as List).map((e) => e == null ? null: e as String).toList();
}
return FrequentInspectionTaskCompleteDataClass(
json['id'],
json['principal'] ?? "-",
json['taskDate'] ?? 0,
json['taskDescribe'] ?? "-",
json['taskNo'] ?? "-",
json['taskStatus'] ?? "-",
json['taskType'] ?? "-",
json['taskUser'] ?? "-",
json['weather'] ?? "-",
json['updateTime'] ?? 0,
json['version'] ?? 0,
(json['bridgeDetails'] as List).map((e) => e == null?null:BridgeDetailClass.fromJson(e as Map<String,dynamic>)).toList(),
_bridgeIdList,
_configIdList,
CulvertCheckClass.fromJson(json['culvertCheck']),
RoadbedCheckClass.fromJson(json['roadbedCheck']),
(json['taskBridgeList'] as List).map((e) => e == null?null:TaskBridgeClass.fromJson(e as Map<String,dynamic>)).toList(),
);
}
Map<String, dynamic> _$FrequentInspectionTaskCompleteDataClassToJson(FrequentInspectionTaskCompleteDataClass instance) =>
<String, dynamic>{
'id': instance.id,
'principal': instance.principal,
'taskDate': instance.taskDate,
'taskDescribe': instance.taskDescribe,
'taskNo': instance.taskNo,
'taskStatus': instance.taskStatus,
'taskType': instance.taskType,
'taskUser': instance.taskUser,
'weather': instance.weather,
'updateTime': instance.updateTime,
'version': instance.version,
'bridgeDetails': instance.bridgeDetails,
'bridgeIdList': instance.bridgeIdList,
'configIdList': instance.configIdList,
'culvertCheck': instance.culvertCheck,
'roadbedCheck': instance.roadbedCheck,
'taskBridgeList': instance.taskBridgeList,
};
/// 桥梁详情类
@JsonSerializable()
class BridgeDetailClass extends Object{
/// 桥梁编码
@JsonKey()
String? bridgeCode;
/// 桥梁ID
@JsonKey()
String? bridgeId;
/// 桥梁名称
@JsonKey()
String? bridgeName;
/// 桥梁尺寸
@JsonKey()
String? bridgeScale;
/// 是否完成
@JsonKey()
bool? completed;
/// 路线名
@JsonKey()
String? routeName;
/// 路线号
@JsonKey()
String? routeNo;
/// 桩号
@JsonKey()
double? stakeNo;
/// 上部结构
@JsonKey()
List<SuperstructureClass?>? superstructureTypes;
BridgeDetailClass(
this.bridgeCode,
this.bridgeId,
this.bridgeName,
this.bridgeScale,
this.completed,
this.routeName,
this.routeNo,
this.stakeNo,
this.superstructureTypes);
factory BridgeDetailClass.fromJson(Map<String,dynamic> json)=> _$BridgeDetailClassFromJson(json);
Map<String,dynamic> toJson() => _$BridgeDetailClassToJson(this);
}
BridgeDetailClass _$BridgeDetailClassFromJson(Map<String, dynamic> json) {
return BridgeDetailClass(
json['bridgeCode'],
json['bridgeId'],
json['bridgeName'],
json['bridgeScale'],
json['completed'],
json['routeName'],
json['routeNo'],
json['stakeNo'],
(json['superstructureTypes'] as List).map((e) => e == null?null:SuperstructureClass.fromJson(e as Map<String,dynamic>)).toList(),
);
}
Map<String, dynamic> _$BridgeDetailClassToJson(BridgeDetailClass instance) =>
<String, dynamic>{
'bridgeCode': instance.bridgeCode,
'bridgeId': instance.bridgeId,
'bridgeName': instance.bridgeName,
'bridgeScale': instance.bridgeScale,
'completed': instance.completed,
'routeName': instance.routeName,
'routeNo': instance.routeNo,
'stakeNo': instance.stakeNo,
'superstructureTypes': instance.superstructureTypes,
};
/// 涵洞通道检查类
@JsonSerializable()
class CulvertCheckClass extends Object{
/// 是否完成
@JsonKey()
bool? completed;
/// 是否包括
@JsonKey()
bool? include;
CulvertCheckClass(this.completed, this.include);
factory CulvertCheckClass.fromJson(Map<String,dynamic> json)=> _$CulvertCheckClassFromJson(json);
Map<String,dynamic> toJson() => _$CulvertCheckClassToJson(this);
}
CulvertCheckClass _$CulvertCheckClassFromJson(Map<String, dynamic> json) {
return CulvertCheckClass(
json['completed'],
json['include'],
);
}
Map<String, dynamic> _$CulvertCheckClassToJson(CulvertCheckClass instance) =>
<String, dynamic>{
'completed': instance.completed,
'include': instance.include,
};
/// 路基路面检查类
@JsonSerializable()
class RoadbedCheckClass extends Object{
/// 是否完成
@JsonKey()
bool? completed;
/// 是否包括
@JsonKey()
bool? include;
RoadbedCheckClass(this.completed, this.include);
factory RoadbedCheckClass.fromJson(Map<String,dynamic> json)=> _$RoadbedCheckClassFromJson(json);
Map<String,dynamic> toJson() => _$RoadbedCheckClassToJson(this);
}
RoadbedCheckClass _$RoadbedCheckClassFromJson(Map<String, dynamic> json) {
return RoadbedCheckClass(
json['completed'],
json['include'],
);
}
Map<String, dynamic> _$RoadbedCheckClassToJson(RoadbedCheckClass instance) =>
<String, dynamic>{
'completed': instance.completed,
'include': instance.include,
};
/// 上部结构类型
@JsonSerializable()
class SuperstructureClass extends Object{
@JsonKey()
String? superstructureTypeId;
@JsonKey()
String? superstructureTypeName;
SuperstructureClass(this.superstructureTypeId, this.superstructureTypeName);
factory SuperstructureClass.fromJson(Map<String,dynamic> json)=> _$SuperstructureClassFromJson(json);
Map<String,dynamic> toJson() => _$SuperstructureClassToJson(this);
}
SuperstructureClass _$SuperstructureClassFromJson(Map<String, dynamic> json) {
return SuperstructureClass(
json['superstructureTypeId'],
json['superstructureTypeName'],
);
}
Map<String, dynamic> _$SuperstructureClassToJson(SuperstructureClass instance) =>
<String, dynamic>{
'superstructureTypeId': instance.superstructureTypeId,
'superstructureTypeName': instance.superstructureTypeName,
};
/// 任务桥梁检查类
@JsonSerializable()
class TaskBridgeClass extends Object{
/// 是否完成
@JsonKey()
bool? completed;
/// 桥梁id
@JsonKey()
String? bridgeId;
TaskBridgeClass(this.completed, this.bridgeId);
factory TaskBridgeClass.fromJson(Map<String,dynamic> json)=> _$TaskBridgeClassFromJson(json);
Map<String,dynamic> toJson() => _$TaskBridgeClassToJson(this);
}
TaskBridgeClass _$TaskBridgeClassFromJson(Map<String, dynamic> json) {
return TaskBridgeClass(
json['completed'],
json['bridgeId'],
);
}
Map<String, dynamic> _$TaskBridgeClassToJson(TaskBridgeClass instance) =>
<String, dynamic>{
'completed': instance.completed,
'bridgeId': instance.bridgeId,
};
典型json解析示例——Flutter空安全版
最新推荐文章于 2023-12-08 10:57:26 发布
关键词由CSDN通过智能技术生成