equipment_info_entity_helper.dart 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. import 'package:deus_app/model/equipment_info_entity.dart';
  2. equipmentInfoEntityFromJson(EquipmentInfoEntity 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 = EquipmentInfoData().fromJson(json['data']);
  10. }
  11. if (json['msg'] != null) {
  12. data.msg = json['msg'].toString();
  13. }
  14. return data;
  15. }
  16. Map<String, dynamic> equipmentInfoEntityToJson(EquipmentInfoEntity 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. equipmentInfoDataFromJson(EquipmentInfoData data, Map<String, dynamic> json) {
  24. if (json['id'] != null) {
  25. data.id = json['id'] is String
  26. ? int.tryParse(json['id'])
  27. : json['id'].toInt();
  28. }
  29. if (json['name'] != null) {
  30. data.name = json['name'].toString();
  31. }
  32. if (json['showName'] != null) {
  33. data.showName = json['showName'].toString();
  34. }
  35. if (json['deviceKey'] != null) {
  36. data.deviceKey = json['deviceKey'].toString();
  37. }
  38. if (json['authType'] != null) {
  39. data.authType = json['authType'] is String
  40. ? int.tryParse(json['authType'])
  41. : json['authType'].toInt();
  42. }
  43. if (json['isEnable'] != null) {
  44. data.isEnable = json['isEnable'] is String
  45. ? int.tryParse(json['isEnable'])
  46. : json['isEnable'].toInt();
  47. }
  48. if (json['isActive'] != null) {
  49. data.isActive = json['isActive'] is String
  50. ? int.tryParse(json['isActive'])
  51. : json['isActive'].toInt();
  52. }
  53. if (json['deviceSecret'] != null) {
  54. data.deviceSecret = json['deviceSecret'].toString();
  55. }
  56. if (json['deviceId'] != null) {
  57. data.deviceId = json['deviceId'].toString();
  58. }
  59. if (json['productName'] != null) {
  60. data.productName = json['productName'].toString();
  61. }
  62. if (json['productKey'] != null) {
  63. data.productKey = json['productKey'].toString();
  64. }
  65. if (json['productId'] != null) {
  66. data.productId = json['productId'] is String
  67. ? int.tryParse(json['productId'])
  68. : json['productId'].toInt();
  69. }
  70. if (json['status'] != null) {
  71. data.status = json['status'] is String
  72. ? int.tryParse(json['status'])
  73. : json['status'].toInt();
  74. }
  75. if (json['nodeType'] != null) {
  76. data.nodeType = json['nodeType'] is String
  77. ? int.tryParse(json['nodeType'])
  78. : json['nodeType'].toInt();
  79. }
  80. if (json['connectionProtocol'] != null) {
  81. data.connectionProtocol = json['connectionProtocol'] is String
  82. ? int.tryParse(json['connectionProtocol'])
  83. : json['connectionProtocol'].toInt();
  84. }
  85. if (json['ip'] != null) {
  86. data.ip = json['ip'].toString();
  87. }
  88. if (json['lastUpdateOn'] != null) {
  89. data.lastUpdateOn = json['lastUpdateOn'];
  90. }
  91. if (json['activationOn'] != null) {
  92. data.activationOn = json['activationOn'].toString();
  93. }
  94. if (json['positionId'] != null) {
  95. data.positionId = json['positionId'];
  96. }
  97. if (json['number'] != null) {
  98. data.number = json['number'];
  99. }
  100. if (json['speedA'] != null) {
  101. data.speedA = json['speedA'].toString();
  102. }
  103. if (json['speedB'] != null) {
  104. data.speedB = json['speedB'].toString();
  105. }
  106. if (json['finenessA'] != null) {
  107. data.finenessA = json['finenessA'].toString();
  108. }
  109. if (json['finenessB'] != null) {
  110. data.finenessB = json['finenessB'].toString();
  111. }
  112. if (json['holeCountA'] != null) {
  113. data.holeCountA = json['holeCountA'].toString();
  114. }
  115. if (json['holeCountB'] != null) {
  116. data.holeCountB = json['holeCountB'].toString();
  117. }
  118. if (json['activePeriod'] != null) {
  119. data.activePeriod = json['activePeriod'];
  120. }
  121. if (json['createdOn'] != null) {
  122. data.createdOn = json['createdOn'].toString();
  123. }
  124. if (json['lastOnlineOn'] != null) {
  125. data.lastOnlineOn = json['lastOnlineOn'].toString();
  126. }
  127. if (json['iotId'] != null) {
  128. data.iotId = json['iotId'].toString();
  129. }
  130. if (json['description'] != null) {
  131. data.description = json['description'];
  132. }
  133. if (json['customerId'] != null) {
  134. data.customerId = json['customerId'].toString();
  135. }
  136. if (json['channelId'] != null) {
  137. data.channelId = json['channelId'].toString();
  138. }
  139. if (json['imei'] != null) {
  140. data.imei = json['imei'];
  141. }
  142. return data;
  143. }
  144. Map<String, dynamic> equipmentInfoDataToJson(EquipmentInfoData entity) {
  145. final Map<String, dynamic> data = new Map<String, dynamic>();
  146. data['id'] = entity.id;
  147. data['name'] = entity.name;
  148. data['showName'] = entity.showName;
  149. data['deviceKey'] = entity.deviceKey;
  150. data['authType'] = entity.authType;
  151. data['isEnable'] = entity.isEnable;
  152. data['isActive'] = entity.isActive;
  153. data['deviceSecret'] = entity.deviceSecret;
  154. data['deviceId'] = entity.deviceId;
  155. data['productName'] = entity.productName;
  156. data['productKey'] = entity.productKey;
  157. data['productId'] = entity.productId;
  158. data['status'] = entity.status;
  159. data['nodeType'] = entity.nodeType;
  160. data['connectionProtocol'] = entity.connectionProtocol;
  161. data['ip'] = entity.ip;
  162. data['lastUpdateOn'] = entity.lastUpdateOn;
  163. data['activationOn'] = entity.activationOn;
  164. data['positionId'] = entity.positionId;
  165. data['number'] = entity.number;
  166. data['speedA'] = entity.speedA;
  167. data['speedB'] = entity.speedB;
  168. data['finenessA'] = entity.finenessA;
  169. data['finenessB'] = entity.finenessB;
  170. data['holeCountA'] = entity.holeCountA;
  171. data['holeCountB'] = entity.holeCountB;
  172. data['activePeriod'] = entity.activePeriod;
  173. data['createdOn'] = entity.createdOn;
  174. data['lastOnlineOn'] = entity.lastOnlineOn;
  175. data['iotId'] = entity.iotId;
  176. data['description'] = entity.description;
  177. data['customerId'] = entity.customerId;
  178. data['channelId'] = entity.channelId;
  179. data['imei'] = entity.imei;
  180. return data;
  181. }