device.m.dart 4.2 KB

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