equipment_list_entity_helper.dart 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. import 'package:deus_app/model/equipment_list_entity.dart';
  2. equipmentListEntityFromJson(EquipmentListEntity data, Map<String, dynamic> json) {
  3. if (json['code'] != null) {
  4. data.code = json['code'] is String
  5. ? int.tryParse(json['code'])
  6. : json['code'].toInt();
  7. }
  8. if (json['data'] != null) {
  9. data.data = EquipmentListData().fromJson(json['data']);
  10. }
  11. if (json['msg'] != null) {
  12. data.msg = json['msg'].toString();
  13. }
  14. return data;
  15. }
  16. Map<String, dynamic> equipmentListEntityToJson(EquipmentListEntity entity) {
  17. final Map<String, dynamic> data = new Map<String, dynamic>();
  18. data['code'] = entity.code;
  19. data['data'] = entity.data.toJson();
  20. data['msg'] = entity.msg;
  21. return data;
  22. }
  23. equipmentListDataFromJson(EquipmentListData data, Map<String, dynamic> json) {
  24. if (json['total'] != null) {
  25. data.total = json['total'] is String
  26. ? int.tryParse(json['total'])
  27. : json['total'].toInt();
  28. }
  29. if (json['index'] != null) {
  30. data.index = json['index'] is String
  31. ? int.tryParse(json['index'])
  32. : json['index'].toInt();
  33. }
  34. if (json['size'] != null) {
  35. data.size = json['size'] is String
  36. ? int.tryParse(json['size'])
  37. : json['size'].toInt();
  38. }
  39. if (json['sortBy'] != null) {
  40. data.sortBy = json['sortBy'];
  41. }
  42. if (json['sort'] != null) {
  43. data.sort = json['sort'];
  44. }
  45. if (json['query'] != null) {
  46. data.query = json['query'];
  47. }
  48. if (json['equipmentVOS'] != null) {
  49. data.equipmentVOS = (json['equipmentVOS'] as List).map((v) => EquipmentListDataEquipmentVOS().fromJson(v)).toList();
  50. }
  51. if (json['countDTO'] != null) {
  52. data.countDTO = EquipmentListDataCountDTO().fromJson(json['countDTO']);
  53. }
  54. return data;
  55. }
  56. Map<String, dynamic> equipmentListDataToJson(EquipmentListData entity) {
  57. final Map<String, dynamic> data = new Map<String, dynamic>();
  58. data['total'] = entity.total;
  59. data['index'] = entity.index;
  60. data['size'] = entity.size;
  61. data['sortBy'] = entity.sortBy;
  62. data['sort'] = entity.sort;
  63. data['query'] = entity.query;
  64. data['equipmentVOS'] = entity.equipmentVOS.map((v) => v.toJson()).toList();
  65. data['countDTO'] = entity.countDTO.toJson();
  66. return data;
  67. }
  68. equipmentListDataEquipmentVOSFromJson(EquipmentListDataEquipmentVOS data, Map<String, dynamic> json) {
  69. if (json['id'] != null) {
  70. data.id = json['id'] is String
  71. ? int.tryParse(json['id'])
  72. : json['id'].toInt();
  73. }
  74. if (json['name'] != null) {
  75. data.name = json['name'].toString();
  76. }
  77. if (json['showName'] != null) {
  78. data.showName = json['showName'].toString();
  79. }else{
  80. data.showName =data.name;
  81. }
  82. if (json['deviceKey'] != null) {
  83. data.deviceKey = json['deviceKey'].toString();
  84. }
  85. if (json['authType'] != null) {
  86. data.authType = json['authType'] is String
  87. ? int.tryParse(json['authType'])
  88. : json['authType'].toInt();
  89. }
  90. if (json['isEnable'] != null) {
  91. data.isEnable = json['isEnable'] is String
  92. ? int.tryParse(json['isEnable'])
  93. : json['isEnable'].toInt();
  94. }
  95. if (json['isActive'] != null) {
  96. data.isActive = json['isActive'];
  97. }
  98. if (json['deviceSecret'] != null) {
  99. data.deviceSecret = json['deviceSecret'].toString();
  100. }
  101. if (json['deviceId'] != null) {
  102. data.deviceId = json['deviceId'].toString();
  103. }
  104. if (json['productName'] != null) {
  105. data.productName = json['productName'].toString();
  106. }
  107. if (json['productKey'] != null) {
  108. data.productKey = json['productKey'].toString();
  109. }
  110. if (json['productId'] != null) {
  111. data.productId = json['productId'] is String
  112. ? int.tryParse(json['productId'])
  113. : json['productId'].toInt();
  114. }
  115. if (json['status'] != null) {
  116. data.status = json['status'] is String
  117. ? int.tryParse(json['status'])
  118. : json['status'].toInt();
  119. }
  120. if (json['nodeType'] != null) {
  121. data.nodeType = json['nodeType'] is String
  122. ? int.tryParse(json['nodeType'])
  123. : json['nodeType'].toInt();
  124. }
  125. if (json['connectionProtocol'] != null) {
  126. data.connectionProtocol = json['connectionProtocol'];
  127. }
  128. if (json['ip'] != null) {
  129. data.ip = json['ip'];
  130. }
  131. if (json['lastUpdateOn'] != null) {
  132. data.lastUpdateOn = json['lastUpdateOn'];
  133. }
  134. if (json['activationOn'] != null) {
  135. data.activationOn = json['activationOn'];
  136. }
  137. if (json['positionId'] != null) {
  138. data.positionId = json['positionId'];
  139. }
  140. if (json['number'] != null) {
  141. data.number = json['number'];
  142. }
  143. if (json['speedA'] != null) {
  144. data.speedA = json['speedA'].toString();
  145. }
  146. if (json['speedB'] != null) {
  147. data.speedB = json['speedB'].toString();
  148. }
  149. if (json['finenessA'] != null) {
  150. data.finenessA = json['finenessA'].toString();
  151. }
  152. if (json['finenessB'] != null) {
  153. data.finenessB = json['finenessB'].toString();
  154. }
  155. if (json['holeCountA'] != null) {
  156. data.holeCountA = json['holeCountA'].toString();
  157. }
  158. if (json['holeCountB'] != null) {
  159. data.holeCountB = json['holeCountB'].toString();
  160. }
  161. if (json['activePeriod'] != null) {
  162. data.activePeriod = json['activePeriod'];
  163. }
  164. if (json['createdOn'] != null) {
  165. data.createdOn = json['createdOn'].toString();
  166. }
  167. if (json['lastOnlineOn'] != null) {
  168. data.lastOnlineOn = json['lastOnlineOn'];
  169. }
  170. if (json['iotId'] != null) {
  171. data.iotId = json['iotId'].toString();
  172. }
  173. if (json['description'] != null) {
  174. data.description = json['description'].toString();
  175. }
  176. if (json['customerId'] != null) {
  177. data.customerId = json['customerId'].toString();
  178. }
  179. if (json['channelId'] != null) {
  180. data.channelId = json['channelId'];
  181. }
  182. if (json['imei'] != null) {
  183. data.imei = json['imei'];
  184. }
  185. return data;
  186. }
  187. Map<String, dynamic> equipmentListDataEquipmentVOSToJson(EquipmentListDataEquipmentVOS entity) {
  188. final Map<String, dynamic> data = new Map<String, dynamic>();
  189. data['id'] = entity.id;
  190. data['name'] = entity.name;
  191. data['showName'] = entity.showName;
  192. data['deviceKey'] = entity.deviceKey;
  193. data['authType'] = entity.authType;
  194. data['isEnable'] = entity.isEnable;
  195. data['isActive'] = entity.isActive;
  196. data['deviceSecret'] = entity.deviceSecret;
  197. data['deviceId'] = entity.deviceId;
  198. data['productName'] = entity.productName;
  199. data['productKey'] = entity.productKey;
  200. data['productId'] = entity.productId;
  201. data['status'] = entity.status;
  202. data['nodeType'] = entity.nodeType;
  203. data['connectionProtocol'] = entity.connectionProtocol;
  204. data['ip'] = entity.ip;
  205. data['lastUpdateOn'] = entity.lastUpdateOn;
  206. data['activationOn'] = entity.activationOn;
  207. data['positionId'] = entity.positionId;
  208. data['number'] = entity.number;
  209. data['speedA'] = entity.speedA;
  210. data['speedB'] = entity.speedB;
  211. data['finenessA'] = entity.finenessA;
  212. data['finenessB'] = entity.finenessB;
  213. data['holeCountA'] = entity.holeCountA;
  214. data['holeCountB'] = entity.holeCountB;
  215. data['activePeriod'] = entity.activePeriod;
  216. data['createdOn'] = entity.createdOn;
  217. data['lastOnlineOn'] = entity.lastOnlineOn;
  218. data['iotId'] = entity.iotId;
  219. data['description'] = entity.description;
  220. data['customerId'] = entity.customerId;
  221. data['channelId'] = entity.channelId;
  222. data['imei'] = entity.imei;
  223. return data;
  224. }
  225. equipmentListDataCountDTOFromJson(EquipmentListDataCountDTO data, Map<String, dynamic> json) {
  226. if (json['count'] != null) {
  227. data.count = json['count'] is String
  228. ? int.tryParse(json['count'])
  229. : json['count'].toInt();
  230. }
  231. if (json['active'] != null) {
  232. data.active = json['active'] is String
  233. ? int.tryParse(json['active'])
  234. : json['active'].toInt();
  235. }
  236. if (json['online'] != null) {
  237. data.online = json['online'] is String
  238. ? int.tryParse(json['online'])
  239. : json['online'].toInt();
  240. }
  241. if (json['offline'] != null) {
  242. data.offline = json['offline'] is String
  243. ? int.tryParse(json['offline'])
  244. : json['offline'].toInt();
  245. }
  246. return data;
  247. }
  248. Map<String, dynamic> equipmentListDataCountDTOToJson(EquipmentListDataCountDTO entity) {
  249. final Map<String, dynamic> data = new Map<String, dynamic>();
  250. data['count'] = entity.count;
  251. data['active'] = entity.active;
  252. data['online'] = entity.online;
  253. data['offline'] = entity.offline;
  254. return data;
  255. }