repair_detail_response_entity_helper.dart 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. import 'package:deus_app/model/repair_detail_response_entity.dart';
  2. repairDetailResponseEntityFromJson(RepairDetailResponseEntity 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 = RepairDetailResponseData().fromJson(json['data']);
  10. }
  11. if (json['msg'] != null) {
  12. data.msg = json['msg'].toString();
  13. }
  14. return data;
  15. }
  16. Map<String, dynamic> repairDetailResponseEntityToJson(RepairDetailResponseEntity 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. repairDetailResponseDataFromJson(RepairDetailResponseData 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['repNum'] != null) {
  30. data.repNum = json['repNum'].toString();
  31. }
  32. if (json['theme'] != null) {
  33. data.theme = json['theme'].toString();
  34. }
  35. if (json['urg'] != null) {
  36. data.urg = json['urg'] is String
  37. ? int.tryParse(json['urg'])
  38. : json['urg'].toInt();
  39. }
  40. if (json['deviceName'] != null) {
  41. data.deviceName = json['deviceName'];
  42. }
  43. if (json['deviceKey'] != null) {
  44. data.deviceKey = json['deviceKey'];
  45. }
  46. if (json['treatment'] != null) {
  47. data.treatment = json['treatment'] is String
  48. ? int.tryParse(json['treatment'])
  49. : json['treatment'].toInt();
  50. }
  51. if (json['customerName'] != null) {
  52. data.customerName = json['customerName'];
  53. }
  54. if (json['channelName'] != null) {
  55. data.channelName = json['channelName'];
  56. }
  57. if (json['submitter'] != null) {
  58. data.submitter = json['submitter'];
  59. }
  60. if (json['receiver'] != null) {
  61. data.receiver = json['receiver'].toString();
  62. }
  63. if (json['maintainer'] != null) {
  64. data.maintainer = json['maintainer'].toString();
  65. }
  66. if (json['orderRecTime'] != null) {
  67. data.orderRecTime = json['orderRecTime'].toString();
  68. }
  69. if (json['applicant'] != null) {
  70. data.applicant = json['applicant'].toString();
  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['deviceId'] != null) {
  78. data.deviceId = json['deviceId'] is String
  79. ? int.tryParse(json['deviceId'])
  80. : json['deviceId'].toInt();
  81. }
  82. if (json['instructions'] != null) {
  83. data.instructions = json['instructions'].toString();
  84. }
  85. if (json['repResRemarks'] != null) {
  86. data.repResRemarks = json['repResRemarks'].toString();
  87. }
  88. if (json['applicationTime'] != null) {
  89. data.applicationTime = json['applicationTime'].toString();
  90. }
  91. if (json['completeTime'] != null) {
  92. data.completeTime = json['completeTime'].toString();
  93. }
  94. if (json['repairImgUrls'] != null) {
  95. data.repairImgUrls = (json['repairImgUrls'] as List).map((v) => v).toList().cast<String>();
  96. }else{
  97. data.repairImgUrls =[];
  98. }
  99. if (json['repairResUrls'] != null) {
  100. data.repairResUrls = (json['repairResUrls'] as List).map((v) => v).toList().cast<String>();
  101. }else{
  102. data.repairResUrls =[];
  103. }
  104. if (json['logs'] != null) {
  105. data.logs = (json['logs'] as List).map((v) => RepairDetailResponseDataLogs().fromJson(v)).toList();
  106. }
  107. if (json['device'] != null) {
  108. data.device = RepairDetailResponseDataDevice().fromJson(json['device']);
  109. }
  110. return data;
  111. }
  112. Map<String, dynamic> repairDetailResponseDataToJson(RepairDetailResponseData entity) {
  113. final Map<String, dynamic> data = new Map<String, dynamic>();
  114. data['id'] = entity.id;
  115. data['repNum'] = entity.repNum;
  116. data['theme'] = entity.theme;
  117. data['urg'] = entity.urg;
  118. data['deviceName'] = entity.deviceName;
  119. data['deviceKey'] = entity.deviceKey;
  120. data['treatment'] = entity.treatment;
  121. data['customerName'] = entity.customerName;
  122. data['channelName'] = entity.channelName;
  123. data['submitter'] = entity.submitter;
  124. data['receiver'] = entity.receiver;
  125. data['maintainer'] = entity.maintainer;
  126. data['orderRecTime'] = entity.orderRecTime;
  127. data['applicant'] = entity.applicant;
  128. data['status'] = entity.status;
  129. data['deviceId'] = entity.deviceId;
  130. data['instructions'] = entity.instructions;
  131. data['applicationTime'] = entity.applicationTime;
  132. data['completeTime'] = entity.completeTime;
  133. data['repairImgUrls'] = entity.repairImgUrls;
  134. data['repResRemarks'] = entity.repResRemarks;
  135. data['repairResUrls'] = entity.repairResUrls;
  136. data['logs'] = entity.logs.map((v) => v.toJson()).toList();
  137. data['device'] = entity.device!.toJson();
  138. return data;
  139. }
  140. repairDetailResponseDataLogsFromJson(RepairDetailResponseDataLogs data, Map<String, dynamic> json) {
  141. if (json['createTime'] != null) {
  142. data.createTime = json['createTime'].toString();
  143. }
  144. if (json['updateTime'] != null) {
  145. data.updateTime = json['updateTime'].toString();
  146. }
  147. if (json['creator'] != null) {
  148. data.creator = json['creator'] is String
  149. ? int.tryParse(json['creator'])
  150. : json['creator'].toInt();
  151. }
  152. if (json['updater'] != null) {
  153. data.updater = json['updater'] is String
  154. ? int.tryParse(json['updater'])
  155. : json['updater'].toInt();
  156. }
  157. if (json['id'] != null) {
  158. data.id = json['id'] is String
  159. ? int.tryParse(json['id'])
  160. : json['id'].toInt();
  161. }
  162. if (json['userName'] != null) {
  163. data.userName = json['userName'].toString();
  164. }
  165. if (json['description'] != null) {
  166. data.description = json['description'].toString();
  167. }
  168. if (json['repairBillId'] != null) {
  169. data.repairBillId = json['repairBillId'] is String
  170. ? int.tryParse(json['repairBillId'])
  171. : json['repairBillId'].toInt();
  172. }
  173. return data;
  174. }
  175. Map<String, dynamic> repairDetailResponseDataLogsToJson(RepairDetailResponseDataLogs entity) {
  176. final Map<String, dynamic> data = new Map<String, dynamic>();
  177. data['createTime'] = entity.createTime;
  178. data['updateTime'] = entity.updateTime;
  179. data['creator'] = entity.creator;
  180. data['updater'] = entity.updater;
  181. data['id'] = entity.id;
  182. data['userName'] = entity.userName;
  183. data['description'] = entity.description;
  184. data['repairBillId'] = entity.repairBillId;
  185. return data;
  186. }
  187. repairDetailResponseDataDeviceFromJson(RepairDetailResponseDataDevice data, Map<String, dynamic> json) {
  188. if (json['id'] != null) {
  189. data.id = json['id'] is String
  190. ? int.tryParse(json['id'])
  191. : json['id'].toInt();
  192. }
  193. if (json['showName'] != null) {
  194. data.showName = json['showName'].toString();
  195. }
  196. if (json['deviceName'] != null) {
  197. data.deviceName = json['deviceName'].toString();
  198. }
  199. if (json['deviceKey'] != null) {
  200. data.deviceKey = json['deviceKey'].toString();
  201. }
  202. if (json['repairBillId'] != null) {
  203. data.repairBillId = json['repairBillId'];
  204. }
  205. if (json['prodName'] != null) {
  206. data.prodName = json['prodName'].toString();
  207. }
  208. if (json['isRepaired'] != null) {
  209. data.isRepaired = json['isRepaired'] is String
  210. ? int.tryParse(json['isRepaired'])
  211. : json['isRepaired'].toInt();
  212. }
  213. if (json['completeTime'] != null) {
  214. data.completeTime = json['completeTime'].toString();
  215. }
  216. return data;
  217. }
  218. Map<String, dynamic> repairDetailResponseDataDeviceToJson(RepairDetailResponseDataDevice entity) {
  219. final Map<String, dynamic> data = new Map<String, dynamic>();
  220. data['id'] = entity.id;
  221. data['showName'] = entity.showName;
  222. data['deviceName'] = entity.deviceName;
  223. data['deviceKey'] = entity.deviceKey;
  224. data['repairBillId'] = entity.repairBillId;
  225. data['prodName'] = entity.prodName;
  226. data['isRepaired'] = entity.isRepaired;
  227. data['completeTime'] = entity.completeTime;
  228. return data;
  229. }