device.m.dart 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. import 'package:fis_common/json_convert.dart';
  2. class DeviceInfo {
  3. String? deviceCode;
  4. String? serialNumber;
  5. String? description;
  6. String? deviceModel;
  7. String? deviceType;
  8. String? headPicUrl;
  9. String? deviceSoftwareVersion;
  10. String? sDKSoftwareVersion;
  11. String? organizationCode;
  12. String? shortCode;
  13. String? id;
  14. DateTime? createTime;
  15. DateTime? updateTime;
  16. bool isDelete;
  17. DeviceInfo({
  18. this.deviceCode,
  19. this.serialNumber,
  20. this.description,
  21. this.deviceModel,
  22. this.deviceType,
  23. this.headPicUrl,
  24. this.deviceSoftwareVersion,
  25. this.sDKSoftwareVersion,
  26. this.organizationCode,
  27. this.shortCode,
  28. this.id,
  29. this.createTime,
  30. this.updateTime,
  31. this.isDelete=false,
  32. });
  33. factory DeviceInfo.fromJson(Map<String, dynamic> map) {
  34. return DeviceInfo(
  35. deviceCode: map['DeviceCode'],
  36. serialNumber: map['SerialNumber'],
  37. description: map['Description'],
  38. deviceModel: map['DeviceModel'],
  39. deviceType: map['DeviceType'],
  40. headPicUrl: map['HeadPicUrl'],
  41. deviceSoftwareVersion: map['DeviceSoftwareVersion'],
  42. sDKSoftwareVersion: map['SDKSoftwareVersion'],
  43. organizationCode: map['OrganizationCode'],
  44. shortCode: map['ShortCode'],
  45. id: map['Id'],
  46. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  47. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  48. isDelete: map['IsDelete'],
  49. );
  50. }
  51. Map<String, dynamic> toJson() {
  52. final map = Map<String, dynamic>();
  53. if(deviceCode != null)
  54. map['DeviceCode'] = deviceCode;
  55. if(serialNumber != null)
  56. map['SerialNumber'] = serialNumber;
  57. if(description != null)
  58. map['Description'] = description;
  59. if(deviceModel != null)
  60. map['DeviceModel'] = deviceModel;
  61. if(deviceType != null)
  62. map['DeviceType'] = deviceType;
  63. if(headPicUrl != null)
  64. map['HeadPicUrl'] = headPicUrl;
  65. if(deviceSoftwareVersion != null)
  66. map['DeviceSoftwareVersion'] = deviceSoftwareVersion;
  67. if(sDKSoftwareVersion != null)
  68. map['SDKSoftwareVersion'] = sDKSoftwareVersion;
  69. if(organizationCode != null)
  70. map['OrganizationCode'] = organizationCode;
  71. if(shortCode != null)
  72. map['ShortCode'] = shortCode;
  73. if(id != null)
  74. map['Id'] = id;
  75. if(createTime != null)
  76. map['CreateTime'] = createTime;
  77. if(updateTime != null)
  78. map['UpdateTime'] = updateTime;
  79. map['IsDelete'] = isDelete;
  80. return map;
  81. }
  82. }
  83. class CreateDeviceInfoRequest {
  84. DeviceInfo? info;
  85. String? sessionId;
  86. CreateDeviceInfoRequest({
  87. this.info,
  88. this.sessionId,
  89. });
  90. factory CreateDeviceInfoRequest.fromJson(Map<String, dynamic> map) {
  91. return CreateDeviceInfoRequest(
  92. info: map['Info'],
  93. sessionId: map['SessionId'],
  94. );
  95. }
  96. Map<String, dynamic> toJson() {
  97. final map = Map<String, dynamic>();
  98. if(info != null)
  99. map['Info'] = info;
  100. if(sessionId != null)
  101. map['SessionId'] = sessionId;
  102. return map;
  103. }
  104. }
  105. class PageCollection<T> {
  106. int currentPage;
  107. int pageSize;
  108. int dataCount;
  109. List<T>? pageData;
  110. PageCollection({
  111. this.currentPage=0,
  112. this.pageSize=0,
  113. this.dataCount=0,
  114. this.pageData,
  115. });
  116. factory PageCollection.fromJson(Map<String, dynamic> map) {
  117. List<T> pageDataList = [];
  118. if (map['PageData'] != null) {
  119. pageDataList.addAll(
  120. (map['PageData'] as List).map((e) => FJsonConvert.fromJson<T>(e)!));
  121. }
  122. return PageCollection(
  123. currentPage: map['CurrentPage'],
  124. pageSize: map['PageSize'],
  125. dataCount: map['DataCount'],
  126. pageData: pageDataList,
  127. );
  128. }
  129. Map<String, dynamic> toJson() {
  130. final map = Map<String, dynamic>();
  131. map['CurrentPage'] = currentPage;
  132. map['PageSize'] = pageSize;
  133. map['DataCount'] = dataCount;
  134. if(pageData != null)
  135. map['PageData'] = pageData;
  136. return map;
  137. }
  138. }
  139. class PageRequest {
  140. int currentPage;
  141. int pageSize;
  142. Map<String,String>? filter;
  143. String? sessionId;
  144. PageRequest({
  145. this.currentPage=0,
  146. this.pageSize=0,
  147. this.filter,
  148. this.sessionId,
  149. });
  150. factory PageRequest.fromJson(Map<String, dynamic> map) {
  151. return PageRequest(
  152. currentPage: map['CurrentPage'],
  153. pageSize: map['PageSize'],
  154. filter: map['Filter'].cast<String,String>(),
  155. sessionId: map['SessionId'],
  156. );
  157. }
  158. Map<String, dynamic> toJson() {
  159. final map = Map<String, dynamic>();
  160. map['CurrentPage'] = currentPage;
  161. map['PageSize'] = pageSize;
  162. if(filter != null)
  163. map['Filter'] = filter;
  164. if(sessionId != null)
  165. map['SessionId'] = sessionId;
  166. return map;
  167. }
  168. }