recognition.m.dart 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. import 'liveConsultation.m.dart';
  2. class IDCardInfoResult {
  3. String? name;
  4. String? idCardNo;
  5. String? gender;
  6. String? nation;
  7. String? birthDay;
  8. String? address;
  9. IDCardInfoResult({
  10. this.name,
  11. this.idCardNo,
  12. this.gender,
  13. this.nation,
  14. this.birthDay,
  15. this.address,
  16. });
  17. factory IDCardInfoResult.fromJson(Map<String, dynamic> map) {
  18. return IDCardInfoResult(
  19. name: map['Name'],
  20. idCardNo: map['IdCardNo'],
  21. gender: map['Gender'],
  22. nation: map['Nation'],
  23. birthDay: map['BirthDay'],
  24. address: map['Address'],
  25. );
  26. }
  27. Map<String, dynamic> toJson() {
  28. final map = Map<String, dynamic>();
  29. if (name != null) {
  30. map['Name'] = name;
  31. }
  32. if (idCardNo != null) {
  33. map['IdCardNo'] = idCardNo;
  34. }
  35. if (gender != null) {
  36. map['Gender'] = gender;
  37. }
  38. if (nation != null) {
  39. map['Nation'] = nation;
  40. }
  41. if (birthDay != null) {
  42. map['BirthDay'] = birthDay;
  43. }
  44. if (address != null) {
  45. map['Address'] = address;
  46. }
  47. return map;
  48. }
  49. }
  50. class RecognitionResult {
  51. int statusCode;
  52. bool isSuccess;
  53. IDCardInfoResult? iDCardData;
  54. RecognitionResult({
  55. this.statusCode = 0,
  56. this.isSuccess = false,
  57. this.iDCardData,
  58. });
  59. factory RecognitionResult.fromJson(Map<String, dynamic> map) {
  60. return RecognitionResult(
  61. statusCode: map['StatusCode'],
  62. isSuccess: map['IsSuccess'],
  63. iDCardData: map['IDCardData'] != null ? IDCardInfoResult.fromJson(map['IDCardData']) : null,
  64. );
  65. }
  66. Map<String, dynamic> toJson() {
  67. final map = Map<String, dynamic>();
  68. map['StatusCode'] = statusCode;
  69. map['IsSuccess'] = isSuccess;
  70. if (iDCardData != null) {
  71. map['IDCardData'] = iDCardData;
  72. }
  73. return map;
  74. }
  75. }
  76. enum UploadFileDataTypeEnum {
  77. ImageUrl,
  78. ImageBase64,
  79. }
  80. class IDCardInfoRequest extends TokenRequest{
  81. String? imageData;
  82. UploadFileDataTypeEnum imageDataType;
  83. IDCardInfoRequest({
  84. this.imageData,
  85. this.imageDataType = UploadFileDataTypeEnum.ImageUrl,
  86. String? token,
  87. }) : super(
  88. token: token,
  89. );
  90. factory IDCardInfoRequest.fromJson(Map<String, dynamic> map) {
  91. return IDCardInfoRequest(
  92. imageData: map['ImageData'],
  93. imageDataType: UploadFileDataTypeEnum.values.firstWhere((e) => e.index == map['ImageDataType']),
  94. token: map['Token'],
  95. );
  96. }
  97. Map<String, dynamic> toJson() {
  98. final map = super.toJson();
  99. if (imageData != null)
  100. map['ImageData'] = imageData;
  101. map['ImageDataType'] = imageDataType.index;
  102. return map;
  103. }
  104. }
  105. class AddOrUpdatePersonRequest extends TokenRequest{
  106. String? groupId;
  107. String? personId;
  108. String? faceUrl;
  109. AddOrUpdatePersonRequest({
  110. this.groupId,
  111. this.personId,
  112. this.faceUrl,
  113. String? token,
  114. }) : super(
  115. token: token,
  116. );
  117. factory AddOrUpdatePersonRequest.fromJson(Map<String, dynamic> map) {
  118. return AddOrUpdatePersonRequest(
  119. groupId: map['GroupId'],
  120. personId: map['PersonId'],
  121. faceUrl: map['FaceUrl'],
  122. token: map['Token'],
  123. );
  124. }
  125. Map<String, dynamic> toJson() {
  126. final map = super.toJson();
  127. if (groupId != null)
  128. map['GroupId'] = groupId;
  129. if (personId != null)
  130. map['PersonId'] = personId;
  131. if (faceUrl != null)
  132. map['FaceUrl'] = faceUrl;
  133. return map;
  134. }
  135. }
  136. class RecognitionPersonDTO {
  137. String? personId;
  138. String? faceId;
  139. double score;
  140. RecognitionPersonDTO({
  141. this.personId,
  142. this.faceId,
  143. this.score = 0,
  144. });
  145. factory RecognitionPersonDTO.fromJson(Map<String, dynamic> map) {
  146. return RecognitionPersonDTO(
  147. personId: map['PersonId'],
  148. faceId: map['FaceId'],
  149. score: double.parse(map['Score'].toString()),
  150. );
  151. }
  152. Map<String, dynamic> toJson() {
  153. final map = Map<String, dynamic>();
  154. if (personId != null) {
  155. map['PersonId'] = personId;
  156. }
  157. if (faceId != null) {
  158. map['FaceId'] = faceId;
  159. }
  160. map['Score'] = score;
  161. return map;
  162. }
  163. }
  164. class SearchPersonsResult {
  165. bool isSearchSuccess;
  166. String? errMessage;
  167. bool hasPerson;
  168. RecognitionPersonDTO? personInfo;
  169. List<RecognitionPersonDTO>? persons;
  170. SearchPersonsResult({
  171. this.isSearchSuccess = false,
  172. this.errMessage,
  173. this.hasPerson = false,
  174. this.personInfo,
  175. this.persons,
  176. });
  177. factory SearchPersonsResult.fromJson(Map<String, dynamic> map) {
  178. return SearchPersonsResult(
  179. isSearchSuccess: map['IsSearchSuccess'],
  180. errMessage: map['ErrMessage'],
  181. hasPerson: map['HasPerson'],
  182. personInfo: map['PersonInfo'] != null ? RecognitionPersonDTO.fromJson(map['PersonInfo']) : null,
  183. persons: map['Persons'] != null ? (map['Persons'] as List).map((e)=>RecognitionPersonDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  184. );
  185. }
  186. Map<String, dynamic> toJson() {
  187. final map = Map<String, dynamic>();
  188. map['IsSearchSuccess'] = isSearchSuccess;
  189. if (errMessage != null) {
  190. map['ErrMessage'] = errMessage;
  191. }
  192. map['HasPerson'] = hasPerson;
  193. if (personInfo != null) {
  194. map['PersonInfo'] = personInfo;
  195. }
  196. if (persons != null) {
  197. map['Persons'] = persons;
  198. }
  199. return map;
  200. }
  201. }
  202. class SearchPersonsRequest extends TokenRequest{
  203. String? groupId;
  204. String? faceUrl;
  205. SearchPersonsRequest({
  206. this.groupId,
  207. this.faceUrl,
  208. String? token,
  209. }) : super(
  210. token: token,
  211. );
  212. factory SearchPersonsRequest.fromJson(Map<String, dynamic> map) {
  213. return SearchPersonsRequest(
  214. groupId: map['GroupId'],
  215. faceUrl: map['FaceUrl'],
  216. token: map['Token'],
  217. );
  218. }
  219. Map<String, dynamic> toJson() {
  220. final map = super.toJson();
  221. if (groupId != null)
  222. map['GroupId'] = groupId;
  223. if (faceUrl != null)
  224. map['FaceUrl'] = faceUrl;
  225. return map;
  226. }
  227. }
  228. class SavePersonResult {
  229. bool success;
  230. String? errMessage;
  231. SavePersonResult({
  232. this.success = false,
  233. this.errMessage,
  234. });
  235. factory SavePersonResult.fromJson(Map<String, dynamic> map) {
  236. return SavePersonResult(
  237. success: map['Success'],
  238. errMessage: map['ErrMessage'],
  239. );
  240. }
  241. Map<String, dynamic> toJson() {
  242. final map = Map<String, dynamic>();
  243. map['Success'] = success;
  244. if (errMessage != null) {
  245. map['ErrMessage'] = errMessage;
  246. }
  247. return map;
  248. }
  249. }
  250. class SavePersonRequest extends TokenRequest{
  251. String? groupId;
  252. String? personId;
  253. String? faceUrl;
  254. SavePersonRequest({
  255. this.groupId,
  256. this.personId,
  257. this.faceUrl,
  258. String? token,
  259. }) : super(
  260. token: token,
  261. );
  262. factory SavePersonRequest.fromJson(Map<String, dynamic> map) {
  263. return SavePersonRequest(
  264. groupId: map['GroupId'],
  265. personId: map['PersonId'],
  266. faceUrl: map['FaceUrl'],
  267. token: map['Token'],
  268. );
  269. }
  270. Map<String, dynamic> toJson() {
  271. final map = super.toJson();
  272. if (groupId != null)
  273. map['GroupId'] = groupId;
  274. if (personId != null)
  275. map['PersonId'] = personId;
  276. if (faceUrl != null)
  277. map['FaceUrl'] = faceUrl;
  278. return map;
  279. }
  280. }
  281. class DeletePersonResult {
  282. bool success;
  283. String? errMessage;
  284. DeletePersonResult({
  285. this.success = false,
  286. this.errMessage,
  287. });
  288. factory DeletePersonResult.fromJson(Map<String, dynamic> map) {
  289. return DeletePersonResult(
  290. success: map['Success'],
  291. errMessage: map['ErrMessage'],
  292. );
  293. }
  294. Map<String, dynamic> toJson() {
  295. final map = Map<String, dynamic>();
  296. map['Success'] = success;
  297. if (errMessage != null) {
  298. map['ErrMessage'] = errMessage;
  299. }
  300. return map;
  301. }
  302. }
  303. class DeletePersonRequest extends TokenRequest{
  304. String? groupId;
  305. String? personId;
  306. DeletePersonRequest({
  307. this.groupId,
  308. this.personId,
  309. String? token,
  310. }) : super(
  311. token: token,
  312. );
  313. factory DeletePersonRequest.fromJson(Map<String, dynamic> map) {
  314. return DeletePersonRequest(
  315. groupId: map['GroupId'],
  316. personId: map['PersonId'],
  317. token: map['Token'],
  318. );
  319. }
  320. Map<String, dynamic> toJson() {
  321. final map = super.toJson();
  322. if (groupId != null)
  323. map['GroupId'] = groupId;
  324. if (personId != null)
  325. map['PersonId'] = personId;
  326. return map;
  327. }
  328. }