equipment_info_entity_helper.dart 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. }else{
  35. data.showName=json['name'].toString();
  36. }
  37. if (json['deviceKey'] != null) {
  38. data.deviceKey = json['deviceKey'].toString();
  39. }
  40. if (json['authType'] != null) {
  41. data.authType = json['authType'] is String
  42. ? int.tryParse(json['authType'])
  43. : json['authType'].toInt();
  44. }
  45. if (json['isEnable'] != null) {
  46. data.isEnable = json['isEnable'] is String
  47. ? int.tryParse(json['isEnable'])
  48. : json['isEnable'].toInt();
  49. }
  50. if (json['isActive'] != null) {
  51. data.isActive = json['isActive'] is String
  52. ? int.tryParse(json['isActive'])
  53. : json['isActive'].toInt();
  54. }
  55. if (json['deviceSecret'] != null) {
  56. data.deviceSecret = json['deviceSecret'].toString();
  57. }
  58. if (json['deviceId'] != null) {
  59. data.deviceId = json['deviceId'].toString();
  60. }
  61. if (json['productName'] != null) {
  62. data.productName = json['productName'].toString();
  63. }
  64. if (json['productKey'] != null) {
  65. data.productKey = json['productKey'].toString();
  66. }
  67. if (json['productId'] != null) {
  68. data.productId = json['productId'] is String
  69. ? int.tryParse(json['productId'])
  70. : json['productId'].toInt();
  71. }
  72. if (json['status'] != null) {
  73. data.status = json['status'] is String
  74. ? int.tryParse(json['status'])
  75. : json['status'].toInt();
  76. }
  77. if (json['nodeType'] != null) {
  78. data.nodeType = json['nodeType'] is String
  79. ? int.tryParse(json['nodeType'])
  80. : json['nodeType'].toInt();
  81. }
  82. if (json['connectionProtocol'] != null) {
  83. data.connectionProtocol = json['connectionProtocol'] is String
  84. ? int.tryParse(json['connectionProtocol'])
  85. : json['connectionProtocol'].toInt();
  86. }
  87. if (json['ip'] != null) {
  88. data.ip = json['ip'].toString();
  89. }
  90. if (json['lastUpdateOn'] != null) {
  91. data.lastUpdateOn = json['lastUpdateOn'];
  92. }
  93. if (json['activationOn'] != null) {
  94. data.activationOn = json['activationOn'];
  95. }else{
  96. data.activationOn ="暂无";
  97. }
  98. if (json['positionId'] != null) {
  99. data.positionId = json['positionId'];
  100. }
  101. if (json['number'] != null) {
  102. data.number = json['number'];
  103. }
  104. if (json['speedA'] != null) {
  105. data.speedA = json['speedA'].toString();
  106. }else{
  107. data.speedA="暂无";
  108. }
  109. if (json['speedB'] != null) {
  110. data.speedB = json['speedB'].toString();
  111. }else{
  112. data.speedB="暂无";
  113. }
  114. if (json['finenessA'] != null) {
  115. data.finenessA = json['finenessA'].toString();
  116. }else{
  117. data.finenessA="暂无";
  118. }
  119. if (json['finenessB'] != null) {
  120. data.finenessB = json['finenessB'].toString();
  121. }else{
  122. data.finenessB="暂无";
  123. }
  124. if (json['holeCountA'] != null) {
  125. data.holeCountA = json['holeCountA'].toString();
  126. }else{
  127. data.holeCountA="暂无";
  128. }
  129. if (json['holeCountB'] != null) {
  130. data.holeCountB = json['holeCountB'].toString();
  131. }else{
  132. data.holeCountB="暂无";
  133. }
  134. if (json['activePeriod'] != null) {
  135. data.activePeriod = json['activePeriod'];
  136. }
  137. if (json['createdOn'] != null) {
  138. data.createdOn = json['createdOn'].toString();
  139. }
  140. if (json['lastOnlineOn'] != null) {
  141. data.lastOnlineOn = json['lastOnlineOn'].toString();
  142. }else{
  143. data.lastOnlineOn ="未知";
  144. }
  145. if (json['iotId'] != null) {
  146. data.iotId = json['iotId'].toString();
  147. }
  148. if (json['description'] != null) {
  149. data.description = json['description'];
  150. }
  151. if (json['customerId'] != null) {
  152. data.customerId = json['customerId'].toString();
  153. }
  154. if (json['channelId'] != null) {
  155. data.channelId = json['channelId'].toString();
  156. }
  157. if (json['imei'] != null) {
  158. data.imei = json['imei'];
  159. }
  160. return data;
  161. }
  162. Map<String, dynamic> equipmentInfoDataToJson(EquipmentInfoData entity) {
  163. final Map<String, dynamic> data = new Map<String, dynamic>();
  164. data['id'] = entity.id;
  165. data['name'] = entity.name;
  166. data['showName'] = entity.showName;
  167. data['deviceKey'] = entity.deviceKey;
  168. data['authType'] = entity.authType;
  169. data['isEnable'] = entity.isEnable;
  170. data['isActive'] = entity.isActive;
  171. data['deviceSecret'] = entity.deviceSecret;
  172. data['deviceId'] = entity.deviceId;
  173. data['productName'] = entity.productName;
  174. data['productKey'] = entity.productKey;
  175. data['productId'] = entity.productId;
  176. data['status'] = entity.status;
  177. data['nodeType'] = entity.nodeType;
  178. data['connectionProtocol'] = entity.connectionProtocol;
  179. data['ip'] = entity.ip;
  180. data['lastUpdateOn'] = entity.lastUpdateOn;
  181. data['activationOn'] = entity.activationOn;
  182. data['positionId'] = entity.positionId;
  183. data['number'] = entity.number;
  184. data['speedA'] = entity.speedA;
  185. data['speedB'] = entity.speedB;
  186. data['finenessA'] = entity.finenessA;
  187. data['finenessB'] = entity.finenessB;
  188. data['holeCountA'] = entity.holeCountA;
  189. data['holeCountB'] = entity.holeCountB;
  190. data['activePeriod'] = entity.activePeriod;
  191. data['createdOn'] = entity.createdOn;
  192. data['lastOnlineOn'] = entity.lastOnlineOn;
  193. data['iotId'] = entity.iotId;
  194. data['description'] = entity.description;
  195. data['customerId'] = entity.customerId;
  196. data['channelId'] = entity.channelId;
  197. data['imei'] = entity.imei;
  198. return data;
  199. }