device.m.dart 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. import 'connect.m.dart';
  2. import 'authentication.m.dart';
  3. import 'package:fis_common/json_convert.dart';
  4. class UploadDeviceDTO extends BaseDTO{
  5. String? serialNumber;
  6. String? deviceModel;
  7. String? deviceType;
  8. String? deviceSoftwareVersion;
  9. String? sDKSoftwareVersion;
  10. UploadDeviceDTO({
  11. this.serialNumber,
  12. this.deviceModel,
  13. this.deviceType,
  14. this.deviceSoftwareVersion,
  15. this.sDKSoftwareVersion,
  16. DateTime? createTime,
  17. DateTime? updateTime,
  18. }) : super(
  19. createTime: createTime,
  20. updateTime: updateTime,
  21. );
  22. factory UploadDeviceDTO.fromJson(Map<String, dynamic> map) {
  23. return UploadDeviceDTO(
  24. serialNumber: map['SerialNumber'],
  25. deviceModel: map['DeviceModel'],
  26. deviceType: map['DeviceType'],
  27. deviceSoftwareVersion: map['DeviceSoftwareVersion'],
  28. sDKSoftwareVersion: map['SDKSoftwareVersion'],
  29. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  30. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  31. );
  32. }
  33. Map<String, dynamic> toJson() {
  34. final map = super.toJson();
  35. if(serialNumber != null)
  36. map['SerialNumber'] = serialNumber;
  37. if(deviceModel != null)
  38. map['DeviceModel'] = deviceModel;
  39. if(deviceType != null)
  40. map['DeviceType'] = deviceType;
  41. if(deviceSoftwareVersion != null)
  42. map['DeviceSoftwareVersion'] = deviceSoftwareVersion;
  43. if(sDKSoftwareVersion != null)
  44. map['SDKSoftwareVersion'] = sDKSoftwareVersion;
  45. return map;
  46. }
  47. }
  48. class CreateDeviceRequest extends UploadDeviceDTO{
  49. CreateDeviceRequest({
  50. String? serialNumber,
  51. String? deviceModel,
  52. String? deviceType,
  53. String? deviceSoftwareVersion,
  54. String? sDKSoftwareVersion,
  55. DateTime? createTime,
  56. DateTime? updateTime,
  57. }) : super(
  58. serialNumber: serialNumber,
  59. deviceModel: deviceModel,
  60. deviceType: deviceType,
  61. deviceSoftwareVersion: deviceSoftwareVersion,
  62. sDKSoftwareVersion: sDKSoftwareVersion,
  63. createTime: createTime,
  64. updateTime: updateTime,
  65. );
  66. factory CreateDeviceRequest.fromJson(Map<String, dynamic> map) {
  67. return CreateDeviceRequest(
  68. serialNumber: map['SerialNumber'],
  69. deviceModel: map['DeviceModel'],
  70. deviceType: map['DeviceType'],
  71. deviceSoftwareVersion: map['DeviceSoftwareVersion'],
  72. sDKSoftwareVersion: map['SDKSoftwareVersion'],
  73. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  74. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  75. );
  76. }
  77. Map<String, dynamic> toJson() {
  78. final map = super.toJson();
  79. return map;
  80. }
  81. }
  82. class DeviceExtendInfoDTO extends DeviceInfoDTO{
  83. String? organizationName;
  84. String? departmentName;
  85. bool isOnline;
  86. DeviceExtendInfoDTO({
  87. this.organizationName,
  88. this.departmentName,
  89. this.isOnline = false,
  90. String? deviceCode,
  91. String? serialNumber,
  92. String? password,
  93. String? name,
  94. String? description,
  95. String? deviceModel,
  96. String? deviceType,
  97. String? headPicUrl,
  98. String? deviceSoftwareVersion,
  99. String? sDKSoftwareVersion,
  100. String? organizationCode,
  101. String? departmentCode,
  102. String? shortCode,
  103. bool isAutoShared = false,
  104. DateTime? lastLoginTime,
  105. String? systemVersion,
  106. String? cPUModel,
  107. String? systemLanguage,
  108. DateTime? createTime,
  109. DateTime? updateTime,
  110. }) : super(
  111. deviceCode: deviceCode,
  112. serialNumber: serialNumber,
  113. password: password,
  114. name: name,
  115. description: description,
  116. deviceModel: deviceModel,
  117. deviceType: deviceType,
  118. headPicUrl: headPicUrl,
  119. deviceSoftwareVersion: deviceSoftwareVersion,
  120. sDKSoftwareVersion: sDKSoftwareVersion,
  121. organizationCode: organizationCode,
  122. departmentCode: departmentCode,
  123. shortCode: shortCode,
  124. isAutoShared: isAutoShared,
  125. lastLoginTime: lastLoginTime,
  126. systemVersion: systemVersion,
  127. cPUModel: cPUModel,
  128. systemLanguage: systemLanguage,
  129. createTime: createTime,
  130. updateTime: updateTime,
  131. );
  132. factory DeviceExtendInfoDTO.fromJson(Map<String, dynamic> map) {
  133. return DeviceExtendInfoDTO(
  134. organizationName: map['OrganizationName'],
  135. departmentName: map['DepartmentName'],
  136. isOnline: map['IsOnline'],
  137. deviceCode: map['DeviceCode'],
  138. serialNumber: map['SerialNumber'],
  139. password: map['Password'],
  140. name: map['Name'],
  141. description: map['Description'],
  142. deviceModel: map['DeviceModel'],
  143. deviceType: map['DeviceType'],
  144. headPicUrl: map['HeadPicUrl'],
  145. deviceSoftwareVersion: map['DeviceSoftwareVersion'],
  146. sDKSoftwareVersion: map['SDKSoftwareVersion'],
  147. organizationCode: map['OrganizationCode'],
  148. departmentCode: map['DepartmentCode'],
  149. shortCode: map['ShortCode'],
  150. isAutoShared: map['IsAutoShared'],
  151. lastLoginTime: map['LastLoginTime'] != null ? DateTime.parse(map['LastLoginTime']) : null,
  152. systemVersion: map['SystemVersion'],
  153. cPUModel: map['CPUModel'],
  154. systemLanguage: map['SystemLanguage'],
  155. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  156. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  157. );
  158. }
  159. Map<String, dynamic> toJson() {
  160. final map = super.toJson();
  161. if(organizationName != null)
  162. map['OrganizationName'] = organizationName;
  163. if(departmentName != null)
  164. map['DepartmentName'] = departmentName;
  165. map['IsOnline'] = isOnline;
  166. return map;
  167. }
  168. }
  169. class GetDeviceRequest extends TokenRequest{
  170. String? deviceCode;
  171. GetDeviceRequest({
  172. this.deviceCode,
  173. String? token,
  174. }) : super(
  175. token: token,
  176. );
  177. factory GetDeviceRequest.fromJson(Map<String, dynamic> map) {
  178. return GetDeviceRequest(
  179. deviceCode: map['DeviceCode'],
  180. token: map['Token'],
  181. );
  182. }
  183. Map<String, dynamic> toJson() {
  184. final map = super.toJson();
  185. if(deviceCode != null)
  186. map['DeviceCode'] = deviceCode;
  187. return map;
  188. }
  189. }
  190. class PageCollection<T> {
  191. int currentPage;
  192. int pageSize;
  193. int dataCount;
  194. List<T>? pageData;
  195. PageCollection({
  196. this.currentPage = 0,
  197. this.pageSize = 0,
  198. this.dataCount = 0,
  199. this.pageData,
  200. });
  201. factory PageCollection.fromJson(Map<String, dynamic> map) {
  202. List<T> pageDataList = [];
  203. if (map['PageData'] != null) {
  204. pageDataList.addAll(
  205. (map['PageData'] as List).map((e) => FJsonConvert.fromJson<T>(e)!));
  206. }
  207. return PageCollection(
  208. currentPage: map['CurrentPage'],
  209. pageSize: map['PageSize'],
  210. dataCount: map['DataCount'],
  211. pageData: pageDataList,
  212. );
  213. }
  214. Map<String, dynamic> toJson() {
  215. final map = Map<String, dynamic>();
  216. map['CurrentPage'] = currentPage;
  217. map['PageSize'] = pageSize;
  218. map['DataCount'] = dataCount;
  219. if(pageData != null)
  220. map['PageData'] = pageData;
  221. return map;
  222. }
  223. }
  224. class PageFilterRequest extends BaseRequest{
  225. int currentPage;
  226. int pageSize;
  227. Map<String,String>? filter;
  228. bool isFuzzy;
  229. PageFilterRequest({
  230. this.currentPage = 0,
  231. this.pageSize = 0,
  232. this.filter,
  233. this.isFuzzy = false,
  234. }) : super(
  235. );
  236. factory PageFilterRequest.fromJson(Map<String, dynamic> map) {
  237. return PageFilterRequest(
  238. currentPage: map['CurrentPage'],
  239. pageSize: map['PageSize'],
  240. filter: map['Filter'] != null ? map['Filter'].cast<String,String>() : null,
  241. isFuzzy: map['IsFuzzy'],
  242. );
  243. }
  244. Map<String, dynamic> toJson() {
  245. final map = super.toJson();
  246. map['CurrentPage'] = currentPage;
  247. map['PageSize'] = pageSize;
  248. if(filter != null)
  249. map['Filter'] = filter;
  250. map['IsFuzzy'] = isFuzzy;
  251. return map;
  252. }
  253. }
  254. class BindDeviceRequest extends TokenRequest{
  255. String? serialNumber;
  256. String? name;
  257. String? description;
  258. String? headPicUrl;
  259. String? organizationCode;
  260. String? departmentCode;
  261. String? shortCode;
  262. bool isAutoShared;
  263. BindDeviceRequest({
  264. this.serialNumber,
  265. this.name,
  266. this.description,
  267. this.headPicUrl,
  268. this.organizationCode,
  269. this.departmentCode,
  270. this.shortCode,
  271. this.isAutoShared = false,
  272. String? token,
  273. }) : super(
  274. token: token,
  275. );
  276. factory BindDeviceRequest.fromJson(Map<String, dynamic> map) {
  277. return BindDeviceRequest(
  278. serialNumber: map['SerialNumber'],
  279. name: map['Name'],
  280. description: map['Description'],
  281. headPicUrl: map['HeadPicUrl'],
  282. organizationCode: map['OrganizationCode'],
  283. departmentCode: map['DepartmentCode'],
  284. shortCode: map['ShortCode'],
  285. isAutoShared: map['IsAutoShared'],
  286. token: map['Token'],
  287. );
  288. }
  289. Map<String, dynamic> toJson() {
  290. final map = super.toJson();
  291. if(serialNumber != null)
  292. map['SerialNumber'] = serialNumber;
  293. if(name != null)
  294. map['Name'] = name;
  295. if(description != null)
  296. map['Description'] = description;
  297. if(headPicUrl != null)
  298. map['HeadPicUrl'] = headPicUrl;
  299. if(organizationCode != null)
  300. map['OrganizationCode'] = organizationCode;
  301. if(departmentCode != null)
  302. map['DepartmentCode'] = departmentCode;
  303. if(shortCode != null)
  304. map['ShortCode'] = shortCode;
  305. map['IsAutoShared'] = isAutoShared;
  306. return map;
  307. }
  308. }
  309. class AlterDeviceRequest extends TokenRequest{
  310. String? deviceCode;
  311. String? serialNumber;
  312. String? name;
  313. String? description;
  314. String? headPicUrl;
  315. String? organizationCode;
  316. String? departmentCode;
  317. bool isAutoShared;
  318. AlterDeviceRequest({
  319. this.deviceCode,
  320. this.serialNumber,
  321. this.name,
  322. this.description,
  323. this.headPicUrl,
  324. this.organizationCode,
  325. this.departmentCode,
  326. this.isAutoShared = false,
  327. String? token,
  328. }) : super(
  329. token: token,
  330. );
  331. factory AlterDeviceRequest.fromJson(Map<String, dynamic> map) {
  332. return AlterDeviceRequest(
  333. deviceCode: map['DeviceCode'],
  334. serialNumber: map['SerialNumber'],
  335. name: map['Name'],
  336. description: map['Description'],
  337. headPicUrl: map['HeadPicUrl'],
  338. organizationCode: map['OrganizationCode'],
  339. departmentCode: map['DepartmentCode'],
  340. isAutoShared: map['IsAutoShared'],
  341. token: map['Token'],
  342. );
  343. }
  344. Map<String, dynamic> toJson() {
  345. final map = super.toJson();
  346. if(deviceCode != null)
  347. map['DeviceCode'] = deviceCode;
  348. if(serialNumber != null)
  349. map['SerialNumber'] = serialNumber;
  350. if(name != null)
  351. map['Name'] = name;
  352. if(description != null)
  353. map['Description'] = description;
  354. if(headPicUrl != null)
  355. map['HeadPicUrl'] = headPicUrl;
  356. if(organizationCode != null)
  357. map['OrganizationCode'] = organizationCode;
  358. if(departmentCode != null)
  359. map['DepartmentCode'] = departmentCode;
  360. map['IsAutoShared'] = isAutoShared;
  361. return map;
  362. }
  363. }
  364. enum DictionaryTypeEnum {
  365. DeviceModel,
  366. DeviceType,
  367. }
  368. class CreateDictionaryItemRequest extends TokenRequest{
  369. DictionaryTypeEnum dictionaryType;
  370. String? dictionaryItemValue;
  371. String? parentCode;
  372. CreateDictionaryItemRequest({
  373. this.dictionaryType = DictionaryTypeEnum.DeviceModel,
  374. this.dictionaryItemValue,
  375. this.parentCode,
  376. String? token,
  377. }) : super(
  378. token: token,
  379. );
  380. factory CreateDictionaryItemRequest.fromJson(Map<String, dynamic> map) {
  381. return CreateDictionaryItemRequest(
  382. dictionaryType: DictionaryTypeEnum.values.firstWhere((e) => e.index == map['DictionaryType']),
  383. dictionaryItemValue: map['DictionaryItemValue'],
  384. parentCode: map['ParentCode'],
  385. token: map['Token'],
  386. );
  387. }
  388. Map<String, dynamic> toJson() {
  389. final map = super.toJson();
  390. map['DictionaryType'] = dictionaryType.index;
  391. if(dictionaryItemValue != null)
  392. map['DictionaryItemValue'] = dictionaryItemValue;
  393. if(parentCode != null)
  394. map['ParentCode'] = parentCode;
  395. return map;
  396. }
  397. }
  398. class DictionaryDTO extends BaseDTO{
  399. String? dictionaryCode;
  400. DictionaryTypeEnum dictionaryType;
  401. String? value;
  402. String? parentCode;
  403. DictionaryDTO({
  404. this.dictionaryCode,
  405. this.dictionaryType = DictionaryTypeEnum.DeviceModel,
  406. this.value,
  407. this.parentCode,
  408. DateTime? createTime,
  409. DateTime? updateTime,
  410. }) : super(
  411. createTime: createTime,
  412. updateTime: updateTime,
  413. );
  414. factory DictionaryDTO.fromJson(Map<String, dynamic> map) {
  415. return DictionaryDTO(
  416. dictionaryCode: map['DictionaryCode'],
  417. dictionaryType: DictionaryTypeEnum.values.firstWhere((e) => e.index == map['DictionaryType']),
  418. value: map['Value'],
  419. parentCode: map['ParentCode'],
  420. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  421. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  422. );
  423. }
  424. Map<String, dynamic> toJson() {
  425. final map = super.toJson();
  426. if(dictionaryCode != null)
  427. map['DictionaryCode'] = dictionaryCode;
  428. map['DictionaryType'] = dictionaryType.index;
  429. if(value != null)
  430. map['Value'] = value;
  431. if(parentCode != null)
  432. map['ParentCode'] = parentCode;
  433. return map;
  434. }
  435. }
  436. class FindDeviceModelItemsRequest extends TokenRequest{
  437. DictionaryTypeEnum dictionaryType;
  438. String? deviceTypeCode;
  439. FindDeviceModelItemsRequest({
  440. this.dictionaryType = DictionaryTypeEnum.DeviceModel,
  441. this.deviceTypeCode,
  442. String? token,
  443. }) : super(
  444. token: token,
  445. );
  446. factory FindDeviceModelItemsRequest.fromJson(Map<String, dynamic> map) {
  447. return FindDeviceModelItemsRequest(
  448. dictionaryType: DictionaryTypeEnum.values.firstWhere((e) => e.index == map['DictionaryType']),
  449. deviceTypeCode: map['DeviceTypeCode'],
  450. token: map['Token'],
  451. );
  452. }
  453. Map<String, dynamic> toJson() {
  454. final map = super.toJson();
  455. map['DictionaryType'] = dictionaryType.index;
  456. if(deviceTypeCode != null)
  457. map['DeviceTypeCode'] = deviceTypeCode;
  458. return map;
  459. }
  460. }
  461. class FindDeviceTypeItemsRequest extends TokenRequest{
  462. DictionaryTypeEnum dictionaryType;
  463. FindDeviceTypeItemsRequest({
  464. this.dictionaryType = DictionaryTypeEnum.DeviceModel,
  465. String? token,
  466. }) : super(
  467. token: token,
  468. );
  469. factory FindDeviceTypeItemsRequest.fromJson(Map<String, dynamic> map) {
  470. return FindDeviceTypeItemsRequest(
  471. dictionaryType: DictionaryTypeEnum.values.firstWhere((e) => e.index == map['DictionaryType']),
  472. token: map['Token'],
  473. );
  474. }
  475. Map<String, dynamic> toJson() {
  476. final map = super.toJson();
  477. map['DictionaryType'] = dictionaryType.index;
  478. return map;
  479. }
  480. }
  481. class CreateShareDeviceToUserRequest extends TokenRequest{
  482. List<String>? userCodes;
  483. String? deviceCode;
  484. CreateShareDeviceToUserRequest({
  485. this.userCodes,
  486. this.deviceCode,
  487. String? token,
  488. }) : super(
  489. token: token,
  490. );
  491. factory CreateShareDeviceToUserRequest.fromJson(Map<String, dynamic> map) {
  492. return CreateShareDeviceToUserRequest(
  493. userCodes: map['UserCodes'] != null ? map['UserCodes'].cast<String>().toList() : null,
  494. deviceCode: map['DeviceCode'],
  495. token: map['Token'],
  496. );
  497. }
  498. Map<String, dynamic> toJson() {
  499. final map = super.toJson();
  500. if(userCodes != null)
  501. map['UserCodes'] = userCodes;
  502. if(deviceCode != null)
  503. map['DeviceCode'] = deviceCode;
  504. return map;
  505. }
  506. }
  507. class DeleteShareDeviceToUserRequest extends TokenRequest{
  508. List<String>? userCodes;
  509. String? deviceCode;
  510. DeleteShareDeviceToUserRequest({
  511. this.userCodes,
  512. this.deviceCode,
  513. String? token,
  514. }) : super(
  515. token: token,
  516. );
  517. factory DeleteShareDeviceToUserRequest.fromJson(Map<String, dynamic> map) {
  518. return DeleteShareDeviceToUserRequest(
  519. userCodes: map['UserCodes'] != null ? map['UserCodes'].cast<String>().toList() : null,
  520. deviceCode: map['DeviceCode'],
  521. token: map['Token'],
  522. );
  523. }
  524. Map<String, dynamic> toJson() {
  525. final map = super.toJson();
  526. if(userCodes != null)
  527. map['UserCodes'] = userCodes;
  528. if(deviceCode != null)
  529. map['DeviceCode'] = deviceCode;
  530. return map;
  531. }
  532. }
  533. class RemoveDeviceRelevancyRequest extends TokenRequest{
  534. String? organizationCode;
  535. String? departmentCode;
  536. String? deviceCode;
  537. RemoveDeviceRelevancyRequest({
  538. this.organizationCode,
  539. this.departmentCode,
  540. this.deviceCode,
  541. String? token,
  542. }) : super(
  543. token: token,
  544. );
  545. factory RemoveDeviceRelevancyRequest.fromJson(Map<String, dynamic> map) {
  546. return RemoveDeviceRelevancyRequest(
  547. organizationCode: map['OrganizationCode'],
  548. departmentCode: map['DepartmentCode'],
  549. deviceCode: map['DeviceCode'],
  550. token: map['Token'],
  551. );
  552. }
  553. Map<String, dynamic> toJson() {
  554. final map = super.toJson();
  555. if(organizationCode != null)
  556. map['OrganizationCode'] = organizationCode;
  557. if(departmentCode != null)
  558. map['DepartmentCode'] = departmentCode;
  559. if(deviceCode != null)
  560. map['DeviceCode'] = deviceCode;
  561. return map;
  562. }
  563. }
  564. class FindDevicesByOrganizationCodeRequest extends TokenRequest{
  565. String? organizationCode;
  566. FindDevicesByOrganizationCodeRequest({
  567. this.organizationCode,
  568. String? token,
  569. }) : super(
  570. token: token,
  571. );
  572. factory FindDevicesByOrganizationCodeRequest.fromJson(Map<String, dynamic> map) {
  573. return FindDevicesByOrganizationCodeRequest(
  574. organizationCode: map['OrganizationCode'],
  575. token: map['Token'],
  576. );
  577. }
  578. Map<String, dynamic> toJson() {
  579. final map = super.toJson();
  580. if(organizationCode != null)
  581. map['OrganizationCode'] = organizationCode;
  582. return map;
  583. }
  584. }
  585. class SelectItemDTO {
  586. String? key;
  587. String? value;
  588. SelectItemDTO({
  589. this.key,
  590. this.value,
  591. });
  592. factory SelectItemDTO.fromJson(Map<String, dynamic> map) {
  593. return SelectItemDTO(
  594. key: map['Key'],
  595. value: map['Value'],
  596. );
  597. }
  598. Map<String, dynamic> toJson() {
  599. final map = Map<String, dynamic>();
  600. if(key != null)
  601. map['Key'] = key;
  602. if(value != null)
  603. map['Value'] = value;
  604. return map;
  605. }
  606. }