job_sg_repository.dart 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. import 'dart:typed_data';
  2. import 'package:domain/entity/response/job_applied_index_s_g_entity.dart';
  3. import 'package:domain/entity/response/job_applied_list_s_g_entity.dart';
  4. import 'package:domain/entity/response/job_list_add_staff_entity.dart';
  5. import 'package:domain/entity/response/job_list_applied_edit_entity.dart';
  6. import 'package:domain/entity/response/job_list_applied_info_entity.dart';
  7. import 'package:domain/entity/response/job_list_applied_staff_list_entity.dart';
  8. import 'package:domain/entity/response/job_list_applied_staff_search_entity.dart';
  9. import 'package:domain/entity/response/job_list_detail_entity.dart';
  10. import 'package:domain/entity/response/job_list_entity.dart';
  11. import 'package:domain/entity/response/job_list_index_entity.dart';
  12. import 'package:domain/entity/response/job_list_remark_view_entity.dart';
  13. import 'package:domain/entity/response/revise_list_s_g_entity.dart';
  14. import 'package:domain/entity/response/revise_log_s_g_entity.dart';
  15. import 'package:domain/entity/response/staff_detail_entity.dart';
  16. import 'package:domain/entity/response/staff_detail_s_g_entity.dart';
  17. import 'package:domain/entity/response/staff_labour_history_entity.dart';
  18. import 'package:domain/entity/response/staff_remark_history_entity.dart';
  19. import 'package:domain/entity/response/staff_review_history_s_g_entity.dart';
  20. import 'package:get/get.dart';
  21. import 'package:plugin_platform/dio_export.dart';
  22. import 'package:plugin_platform/http/http_provider.dart';
  23. import 'package:plugin_platform/http/http_result.dart';
  24. import 'package:shared/utils/util.dart';
  25. import '../constants/api_constants.dart';
  26. import '../entity/response/add_edit_revise_view_s_g_entity.dart';
  27. import '../entity/response/attendance_entity.dart';
  28. import '../entity/response/check_success_entity.dart';
  29. import '../entity/response/job_applied_edit_index_s_g_entity.dart';
  30. import '../entity/response/job_applied_remark_view_s_g_entity.dart';
  31. import '../entity/response/job_applied_staff_s_g_entity.dart';
  32. import '../entity/response/job_list_applied_work_flow_entity.dart';
  33. import '../entity/response/revise_index_s_g_entity.dart';
  34. import '../entity/response/staff_job_history_s_g_entity.dart';
  35. /// 工作相关(新加坡)
  36. class JobSGRepository extends GetxService {
  37. HttpProvider httpProvider;
  38. JobSGRepository({required this.httpProvider});
  39. /// 获取工作已申请的选项
  40. Future<HttpResult<JobAppliedIndexSGEntity>> fetchJobAppliedIndex(
  41. String? jobId, {
  42. CancelToken? cancelToken,
  43. }) async {
  44. //参数
  45. Map<String, String> params = {};
  46. params["job_id"] = jobId ?? "";
  47. final result = await httpProvider.requestNetResult(
  48. ApiConstants.apiJobAppliedIndexSG,
  49. params: params,
  50. cancelToken: cancelToken,
  51. );
  52. //根据返回的结果,封装原始数据为Bean/Entity对象
  53. if (result.isSuccess) {
  54. //重新赋值data或list
  55. final json = result.getDataJson();
  56. var data = JobAppliedIndexSGEntity.fromJson(json!);
  57. //重新赋值data或list
  58. return result.convert<JobAppliedIndexSGEntity>(data: data);
  59. }
  60. return result.convert();
  61. }
  62. /// 获取工作已申请的列表
  63. Future<HttpResult<JobAppliedListSGEntity>> fetchJobAppliedList(
  64. String? jobId,
  65. String? status,
  66. String? keyword, {
  67. required int curPage,
  68. CancelToken? cancelToken,
  69. }) async {
  70. //参数
  71. Map<String, String> params = {};
  72. params["cur_page"] = curPage.toString();
  73. params["page_size"] = "10";
  74. params["job_id"] = jobId ?? "";
  75. if (!Utils.isEmpty(keyword)) {
  76. params["keyword"] = keyword!;
  77. }
  78. if (!Utils.isEmpty(status)) {
  79. params["status"] = status!;
  80. }
  81. final result = await httpProvider.requestNetResult(
  82. ApiConstants.apiJobAppliedListSG,
  83. params: params,
  84. cancelToken: cancelToken,
  85. );
  86. //根据返回的结果,封装原始数据为Bean/Entity对象
  87. if (result.isSuccess) {
  88. //重新赋值data或list
  89. final json = result.getDataJson();
  90. var data = JobAppliedListSGEntity.fromJson(json!);
  91. //重新赋值data或list
  92. return result.convert<JobAppliedListSGEntity>(data: data);
  93. }
  94. return result.convert();
  95. }
  96. /// 根据ID获取主列表的Item数据,用于刷新Item
  97. Future<HttpResult<JobAppliedListSGEntity>> fetchItemByAppliedIds(
  98. String? jobId,
  99. String? appliedIds, {
  100. CancelToken? cancelToken,
  101. }) async {
  102. //参数
  103. Map<String, String> params = {};
  104. params["cur_page"] = "1";
  105. params["page_size"] = "9999";
  106. if (!Utils.isEmpty(appliedIds)) {
  107. params["applied_ids"] = appliedIds!;
  108. }
  109. if (!Utils.isEmpty(jobId)) {
  110. params["job_id"] = jobId!;
  111. }
  112. final result = await httpProvider.requestNetResult(
  113. ApiConstants.apiJobAppliedListSG,
  114. params: params,
  115. isShowLoadingDialog: true,
  116. cancelToken: cancelToken,
  117. );
  118. //根据返回的结果,封装原始数据为Bean/Entity对象
  119. if (result.isSuccess) {
  120. //重新赋值data或list
  121. final json = result.getDataJson();
  122. var data = JobAppliedListSGEntity.fromJson(json!);
  123. //重新赋值data或list
  124. return result.convert<JobAppliedListSGEntity>(data: data);
  125. }
  126. return result.convert();
  127. }
  128. /// 获取工作已申请的列表中添加的员工搜索
  129. Future<HttpResult<JobAppliedStaffSGEntity>> searchJobAppliedStaff(
  130. String? jobId,
  131. String? keyword, {
  132. required int curPage,
  133. CancelToken? cancelToken,
  134. }) async {
  135. //参数
  136. Map<String, String> params = {};
  137. params["cur_page"] = curPage.toString();
  138. params["page_size"] = "20";
  139. params["job_id"] = jobId ?? "";
  140. if (!Utils.isEmpty(keyword)) {
  141. params["keyword"] = keyword!;
  142. }
  143. final result = await httpProvider.requestNetResult(
  144. ApiConstants.apiJobAppliedSearchStaffSG,
  145. params: params,
  146. cancelToken: cancelToken,
  147. );
  148. //根据返回的结果,封装原始数据为Bean/Entity对象
  149. if (result.isSuccess) {
  150. //重新赋值data或list
  151. final json = result.getDataJson();
  152. var data = JobAppliedStaffSGEntity.fromJson(json!);
  153. //重新赋值data或list
  154. return result.convert<JobAppliedStaffSGEntity>(data: data);
  155. }
  156. return result.convert();
  157. }
  158. /// 添加员工到申请列表
  159. Future<HttpResult> addStaff2AppliedJob(
  160. String? jobId,
  161. String? staffIds, {
  162. CancelToken? cancelToken,
  163. }) async {
  164. //参数
  165. Map<String, String> params = {};
  166. params['job_id'] = jobId ?? "";
  167. params['staff_ids'] = staffIds ?? "";
  168. final result = await httpProvider.requestNetResult(
  169. ApiConstants.apiJobAppliedAddStaffSubmitSG,
  170. method: HttpMethod.POST,
  171. params: params,
  172. networkDebounce: true,
  173. isShowLoadingDialog: true,
  174. cancelToken: cancelToken,
  175. );
  176. //根据返回的结果,封装原始数据为Bean/Entity对象
  177. if (result.isSuccess) {
  178. //重新赋值data或list
  179. return result.convert();
  180. }
  181. return result.convert();
  182. }
  183. /// 批量修改员工信息或考勤
  184. Future<HttpResult> batchEditJobApplied(
  185. String? appliedIds,
  186. String? startTime,
  187. String? endTime,
  188. String? subtractHours,
  189. String? status, {
  190. CancelToken? cancelToken,
  191. }) async {
  192. //参数
  193. Map<String, String> params = {};
  194. params['applied_ids'] = appliedIds ?? "";
  195. if (!Utils.isEmpty(startTime)) {
  196. params['start_time'] = startTime ?? "";
  197. }
  198. if (!Utils.isEmpty(endTime)) {
  199. params['end_time'] = endTime ?? "";
  200. }
  201. if (!Utils.isEmpty(subtractHours)) {
  202. params['subtract_hours'] = subtractHours ?? "";
  203. }
  204. if (!Utils.isEmpty(status)) {
  205. params['status'] = status ?? "";
  206. }
  207. final result = await httpProvider.requestNetResult(
  208. ApiConstants.apiJobAppliedBatchEditSG,
  209. method: HttpMethod.POST,
  210. params: params,
  211. networkDebounce: true,
  212. isShowLoadingDialog: true,
  213. cancelToken: cancelToken,
  214. );
  215. //根据返回的结果,封装原始数据为Bean/Entity对象
  216. if (result.isSuccess) {
  217. //重新赋值data或list
  218. return result.convert();
  219. }
  220. return result.convert();
  221. }
  222. /// 编辑员工信息或考勤的选项详情
  223. Future<HttpResult<JobAppliedEditIndexSGEntity>> fetchEditJobAppliedIndex(
  224. String? appliedId, {
  225. CancelToken? cancelToken,
  226. }) async {
  227. //参数
  228. Map<String, String> params = {};
  229. params['applied_id'] = appliedId ?? "";
  230. final result = await httpProvider.requestNetResult(
  231. ApiConstants.apiJobAppliedEditViewSG,
  232. params: params,
  233. isShowLoadingDialog: true,
  234. cancelToken: cancelToken,
  235. );
  236. //根据返回的结果,封装原始数据为Bean/Entity对象
  237. if (result.isSuccess) {
  238. //重新赋值data或list
  239. final json = result.getDataJson();
  240. var data = JobAppliedEditIndexSGEntity.fromJson(json!);
  241. //重新赋值data或list
  242. return result.convert<JobAppliedEditIndexSGEntity>(data: data);
  243. }
  244. return result.convert();
  245. }
  246. /// 编辑员工信息或考勤的提交
  247. Future<HttpResult> submitEditJobApplied(
  248. String? appliedId,
  249. String? startTime,
  250. String? endTime,
  251. String? security_in,
  252. String? security_out,
  253. String? work_in,
  254. String? work_out,
  255. String? adjustHours,
  256. String? status, {
  257. CancelToken? cancelToken,
  258. }) async {
  259. //参数
  260. Map<String, String> params = {};
  261. params['applied_id'] = appliedId ?? "";
  262. params['start_time'] = startTime ?? "";
  263. params['end_time'] = endTime ?? "";
  264. if (!Utils.isEmpty(security_in)) {
  265. params['security_in'] = security_in ?? "";
  266. }
  267. if (!Utils.isEmpty(security_out)) {
  268. params['security_out'] = security_out ?? "";
  269. }
  270. if (!Utils.isEmpty(work_in)) {
  271. params['work_in'] = work_in ?? "";
  272. }
  273. if (!Utils.isEmpty(work_out)) {
  274. params['work_out'] = work_out ?? "";
  275. }
  276. if (!Utils.isEmpty(adjustHours)) {
  277. params['adjust_hours'] = adjustHours ?? "";
  278. }
  279. if (!Utils.isEmpty(status)) {
  280. params['status'] = status ?? "";
  281. }
  282. final result = await httpProvider.requestNetResult(
  283. ApiConstants.apiJobAppliedEditSubmitSG,
  284. method: HttpMethod.POST,
  285. params: params,
  286. networkDebounce: true,
  287. isShowLoadingDialog: true,
  288. cancelToken: cancelToken,
  289. );
  290. //根据返回的结果,封装原始数据为Bean/Entity对象
  291. if (result.isSuccess) {
  292. //重新赋值data或list
  293. return result.convert();
  294. }
  295. return result.convert();
  296. }
  297. /// 修改考勤员工的考勤状态
  298. Future<HttpResult> submitEditAppliedStatus(
  299. String? appliedId,
  300. String? status, {
  301. CancelToken? cancelToken,
  302. }) async {
  303. //参数
  304. Map<String, String> params = {};
  305. params['applied_id'] = appliedId ?? "";
  306. params['status'] = status ?? "";
  307. final result = await httpProvider.requestNetResult(
  308. ApiConstants.apiJobAppliedChangeStatusSG,
  309. method: HttpMethod.POST,
  310. params: params,
  311. networkDebounce: true,
  312. isShowLoadingDialog: true,
  313. cancelToken: cancelToken,
  314. );
  315. //根据返回的结果,封装原始数据为Bean/Entity对象
  316. if (result.isSuccess) {
  317. //重新赋值data或list
  318. return result.convert();
  319. }
  320. return result.convert();
  321. }
  322. /// 获取员工的评价信息
  323. Future<HttpResult<JobAppliedRemarkViewSGEntity>> fetchJobAppliedRemarkView(
  324. String? appliedId, {
  325. CancelToken? cancelToken,
  326. }) async {
  327. //参数
  328. Map<String, String> params = {};
  329. params['applied_id'] = appliedId ?? "";
  330. final result = await httpProvider.requestNetResult(
  331. ApiConstants.apiJobAppliedRemarkViewSG,
  332. params: params,
  333. isShowLoadingDialog: true,
  334. cancelToken: cancelToken,
  335. );
  336. //根据返回的结果,封装原始数据为Bean/Entity对象
  337. if (result.isSuccess) {
  338. //重新赋值data或list
  339. final json = result.getDataJson();
  340. var data = JobAppliedRemarkViewSGEntity.fromJson(json!);
  341. //重新赋值data或list
  342. return result.convert<JobAppliedRemarkViewSGEntity>(data: data);
  343. }
  344. return result.convert();
  345. }
  346. /// 提交员工的评价
  347. Future<HttpResult> submitAppliedRemark(
  348. String? appliedId,
  349. String? attitude_rate,
  350. String? grooming_rate,
  351. String? performance_rate,
  352. String? experience_rate,
  353. String? feedback, {
  354. CancelToken? cancelToken,
  355. }) async {
  356. //参数
  357. Map<String, String> params = {};
  358. params['applied_id'] = appliedId ?? "";
  359. params['attitude_rate'] = (double.parse(attitude_rate ?? "5.0")).toInt().toString();
  360. params['grooming_rate'] = (double.parse(grooming_rate ?? "5.0")).toInt().toString();
  361. params['performance_rate'] = (double.parse(performance_rate ?? "5.0")).toInt().toString();
  362. params['experience_rate'] = (double.parse(experience_rate ?? "5.0")).toInt().toString();
  363. if (!Utils.isEmpty(feedback)) {
  364. params['feedback'] = feedback ?? "";
  365. }
  366. final result = await httpProvider.requestNetResult(
  367. ApiConstants.apiJobAppliedRemarkSubmitSG,
  368. method: HttpMethod.POST,
  369. params: params,
  370. networkDebounce: true,
  371. isShowLoadingDialog: true,
  372. cancelToken: cancelToken,
  373. );
  374. //根据返回的结果,封装原始数据为Bean/Entity对象
  375. if (result.isSuccess) {
  376. //重新赋值data或list
  377. return result.convert();
  378. }
  379. return result.convert();
  380. }
  381. /// 获取员工的详细信息
  382. Future<HttpResult<StaffDetailSGEntity>> fetchStaffDetail(
  383. String? memberId, {
  384. CancelToken? cancelToken,
  385. }) async {
  386. //参数
  387. Map<String, String> params = {};
  388. params['member_id'] = memberId ?? "";
  389. final result = await httpProvider.requestNetResult(
  390. ApiConstants.apiJobListStaffDetailSG,
  391. params: params,
  392. );
  393. //根据返回的结果,封装原始数据为Bean/Entity对象
  394. if (result.isSuccess) {
  395. //重新赋值data或list
  396. final json = result.getDataJson();
  397. var data = StaffDetailSGEntity.fromJson(json!);
  398. //重新赋值data或list
  399. return result.convert<StaffDetailSGEntity>(data: data);
  400. }
  401. return result.convert();
  402. }
  403. /// 获取员工的做工历史列表
  404. Future<HttpResult<StaffJobHistorySGEntity>> fetchStaffJobHistory(
  405. String? memberId, {
  406. required int curPage,
  407. CancelToken? cancelToken,
  408. }) async {
  409. //参数
  410. Map<String, String> params = {};
  411. params['member_id'] = memberId ?? "";
  412. params['cur_page'] = curPage.toString();
  413. params['page_size'] = "10";
  414. final result = await httpProvider.requestNetResult(
  415. ApiConstants.apiJobListStaffLabourHistorySG,
  416. params: params,
  417. );
  418. //根据返回的结果,封装原始数据为Bean/Entity对象
  419. if (result.isSuccess) {
  420. //重新赋值data或list
  421. final json = result.getDataJson();
  422. var data = StaffJobHistorySGEntity.fromJson(json!);
  423. //重新赋值data或list
  424. return result.convert<StaffJobHistorySGEntity>(data: data);
  425. }
  426. return result.convert();
  427. }
  428. /// 获取员工的做工评价历史列表
  429. Future<HttpResult<StaffReviewHistorySGEntity>> fetchStaffReviewHeadView(
  430. String? memberId, {
  431. CancelToken? cancelToken,
  432. }) async {
  433. //参数
  434. Map<String, String> params = {};
  435. params['member_id'] = memberId ?? "";
  436. final result = await httpProvider.requestNetResult(
  437. ApiConstants.apiJobListStaffReviewHeadSG,
  438. params: params,
  439. );
  440. //根据返回的结果,封装原始数据为Bean/Entity对象
  441. if (result.isSuccess) {
  442. //重新赋值data或list
  443. final json = result.getDataJson();
  444. var data = StaffReviewHistorySGEntity.fromJson(json!);
  445. //重新赋值data或list
  446. return result.convert<StaffReviewHistorySGEntity>(data: data);
  447. }
  448. return result.convert();
  449. }
  450. /// 获取员工的做工评价历史列表
  451. Future<HttpResult<StaffReviewHistorySGEntity>> fetchStaffReviewHistory(
  452. String? memberId, {
  453. required int curPage,
  454. CancelToken? cancelToken,
  455. }) async {
  456. //参数
  457. Map<String, String> params = {};
  458. params['cur_page'] = curPage.toString();
  459. params['page_size'] = "10";
  460. params['member_id'] = memberId ?? "";
  461. final result = await httpProvider.requestNetResult(
  462. ApiConstants.apiJobListStaffReViewHistorySG,
  463. params: params,
  464. );
  465. //根据返回的结果,封装原始数据为Bean/Entity对象
  466. if (result.isSuccess) {
  467. //重新赋值data或list
  468. final json = result.getDataJson();
  469. var data = StaffReviewHistorySGEntity.fromJson(json!);
  470. //重新赋值data或list
  471. return result.convert<StaffReviewHistorySGEntity>(data: data);
  472. }
  473. return result.convert();
  474. }
  475. /// Revise 列表选项
  476. Future<HttpResult<ReviseIndexSGEntity>> fetchReviseIndex({
  477. CancelToken? cancelToken,
  478. }) async {
  479. final result = await httpProvider.requestNetResult(
  480. ApiConstants.apiReviseIndexSG,
  481. cancelToken: cancelToken,
  482. );
  483. //根据返回的结果,封装原始数据为Bean/Entity对象
  484. if (result.isSuccess) {
  485. //重新赋值data或list
  486. final json = result.getDataJson();
  487. var data = ReviseIndexSGEntity.fromJson(json!);
  488. //重新赋值data或list
  489. return result.convert<ReviseIndexSGEntity>(data: data);
  490. }
  491. return result.convert();
  492. }
  493. /// Revise 列表选项
  494. Future<HttpResult<ReviseListSGEntity>> fetchReviseList(
  495. String? applied_id,
  496. String? status,
  497. String? keyword,
  498. String? start_date,
  499. String? end_date, {
  500. required int curPage,
  501. CancelToken? cancelToken,
  502. }) async {
  503. //参数
  504. Map<String, String> params = {};
  505. params["cur_page"] = curPage.toString();
  506. params["page_size"] = "10";
  507. if (!Utils.isEmpty(applied_id)) {
  508. params["applied_id"] = applied_id!;
  509. }
  510. if (!Utils.isEmpty(status)) {
  511. params["status"] = status!;
  512. }
  513. if (!Utils.isEmpty(keyword)) {
  514. params["keyword"] = keyword!;
  515. }
  516. if (!Utils.isEmpty(start_date)) {
  517. params["start_date"] = start_date!;
  518. }
  519. if (!Utils.isEmpty(end_date)) {
  520. params["end_date"] = end_date!;
  521. }
  522. final result = await httpProvider.requestNetResult(
  523. ApiConstants.apiReviseListSG,
  524. params: params,
  525. cancelToken: cancelToken,
  526. );
  527. //根据返回的结果,封装原始数据为Bean/Entity对象
  528. if (result.isSuccess) {
  529. //重新赋值data或list
  530. final json = result.getDataJson();
  531. var data = ReviseListSGEntity.fromJson(json!);
  532. //重新赋值data或list
  533. return result.convert<ReviseListSGEntity>(data: data);
  534. }
  535. return result.convert();
  536. }
  537. /// 根据ID获取主列表的Item数据,用于刷新Item
  538. Future<HttpResult<ReviseListSGEntity>> fetchReviseListByIds(
  539. String? reviseId, {
  540. CancelToken? cancelToken,
  541. }) async {
  542. //参数
  543. Map<String, String> params = {};
  544. params["cur_page"] = "1";
  545. params["page_size"] = "9999";
  546. if (!Utils.isEmpty(reviseId)) {
  547. params["revise_id"] = reviseId!;
  548. }
  549. final result = await httpProvider.requestNetResult(
  550. ApiConstants.apiReviseListSG,
  551. params: params,
  552. cancelToken: cancelToken,
  553. );
  554. //根据返回的结果,封装原始数据为Bean/Entity对象
  555. if (result.isSuccess) {
  556. //重新赋值data或list
  557. final json = result.getDataJson();
  558. var data = ReviseListSGEntity.fromJson(json!);
  559. //重新赋值data或list
  560. return result.convert<ReviseListSGEntity>(data: data);
  561. }
  562. return result.convert();
  563. }
  564. /// Revise 添加选项
  565. Future<HttpResult<AddEditReviseViewSGEntity>> fetchReviseAddIndex(
  566. String? applied_id, {
  567. CancelToken? cancelToken,
  568. }) async {
  569. Map<String, String> params = {};
  570. params["applied_id"] = applied_id ?? "";
  571. final result = await httpProvider.requestNetResult(
  572. ApiConstants.apiAddReviseViewSG,
  573. params: params,
  574. isShowLoadingDialog: true,
  575. cancelToken: cancelToken,
  576. );
  577. //根据返回的结果,封装原始数据为Bean/Entity对象
  578. if (result.isSuccess) {
  579. //重新赋值data或list
  580. final json = result.getDataJson();
  581. var data = AddEditReviseViewSGEntity.fromJson(json!);
  582. //重新赋值data或list
  583. return result.convert<AddEditReviseViewSGEntity>(data: data);
  584. }
  585. return result.convert();
  586. }
  587. /// Revise 编辑选项
  588. Future<HttpResult<AddEditReviseViewSGEntity>> fetchReviseEditIndex(
  589. String? revise_id, {
  590. CancelToken? cancelToken,
  591. }) async {
  592. Map<String, String> params = {};
  593. params["revise_id"] = revise_id ?? "";
  594. final result = await httpProvider.requestNetResult(
  595. ApiConstants.apiEditReviseViewSG,
  596. params: params,
  597. isShowLoadingDialog: true,
  598. cancelToken: cancelToken,
  599. );
  600. //根据返回的结果,封装原始数据为Bean/Entity对象
  601. if (result.isSuccess) {
  602. //重新赋值data或list
  603. final json = result.getDataJson();
  604. var data = AddEditReviseViewSGEntity.fromJson(json!);
  605. //重新赋值data或list
  606. return result.convert<AddEditReviseViewSGEntity>(data: data);
  607. }
  608. return result.convert();
  609. }
  610. /// Review Add 提交
  611. Future<HttpResult> submitReviseAdd(
  612. String? appliedId,
  613. String? revise_hours,
  614. String? revise_msg, {
  615. CancelToken? cancelToken,
  616. }) async {
  617. //参数
  618. Map<String, String> params = {};
  619. params['applied_id'] = appliedId ?? "";
  620. if (!Utils.isEmpty(revise_hours)) {
  621. params['revise_hours'] = revise_hours ?? "";
  622. }
  623. if (!Utils.isEmpty(revise_msg)) {
  624. params['revise_msg'] = revise_msg ?? "";
  625. }
  626. final result = await httpProvider.requestNetResult(
  627. ApiConstants.apiAddReviseSubmitSG,
  628. method: HttpMethod.POST,
  629. params: params,
  630. networkDebounce: true,
  631. isShowLoadingDialog: true,
  632. cancelToken: cancelToken,
  633. );
  634. //根据返回的结果,封装原始数据为Bean/Entity对象
  635. if (result.isSuccess) {
  636. //重新赋值data或list
  637. return result.convert();
  638. }
  639. return result.convert();
  640. }
  641. /// Review Edit 提交
  642. Future<HttpResult> submitReviseEdit(
  643. String? revise_id,
  644. String? revise_hours,
  645. String? revise_msg, {
  646. CancelToken? cancelToken,
  647. }) async {
  648. //参数
  649. Map<String, String> params = {};
  650. params['revise_id'] = revise_id ?? "";
  651. if (!Utils.isEmpty(revise_hours)) {
  652. params['revise_hours'] = revise_hours ?? "";
  653. }
  654. if (!Utils.isEmpty(revise_msg)) {
  655. params['revise_msg'] = revise_msg ?? "";
  656. }
  657. final result = await httpProvider.requestNetResult(
  658. ApiConstants.apiEditReviseSubmitSG,
  659. method: HttpMethod.POST,
  660. params: params,
  661. networkDebounce: true,
  662. isShowLoadingDialog: true,
  663. cancelToken: cancelToken,
  664. );
  665. //根据返回的结果,封装原始数据为Bean/Entity对象
  666. if (result.isSuccess) {
  667. //重新赋值data或list
  668. return result.convert();
  669. }
  670. return result.convert();
  671. }
  672. /// Review Recall
  673. Future<HttpResult> recallRevise(
  674. String? revise_id, {
  675. CancelToken? cancelToken,
  676. }) async {
  677. //参数
  678. Map<String, String> params = {};
  679. params['revise_id'] = revise_id ?? "";
  680. final result = await httpProvider.requestNetResult(
  681. ApiConstants.apiRecallReviseSG,
  682. method: HttpMethod.POST,
  683. params: params,
  684. networkDebounce: true,
  685. isShowLoadingDialog: true,
  686. cancelToken: cancelToken,
  687. );
  688. //根据返回的结果,封装原始数据为Bean/Entity对象
  689. if (result.isSuccess) {
  690. //重新赋值data或list
  691. return result.convert();
  692. }
  693. return result.convert();
  694. }
  695. /// Review Delete
  696. Future<HttpResult> deleteRevise(
  697. String? revise_id, {
  698. CancelToken? cancelToken,
  699. }) async {
  700. //参数
  701. Map<String, String> params = {};
  702. params['revise_id'] = revise_id ?? "";
  703. final result = await httpProvider.requestNetResult(
  704. ApiConstants.apiDeleteReviseSG,
  705. method: HttpMethod.POST,
  706. params: params,
  707. networkDebounce: true,
  708. isShowLoadingDialog: true,
  709. cancelToken: cancelToken,
  710. );
  711. //根据返回的结果,封装原始数据为Bean/Entity对象
  712. if (result.isSuccess) {
  713. //重新赋值data或list
  714. return result.convert();
  715. }
  716. return result.convert();
  717. }
  718. /// Review Logs
  719. Future<HttpResult<ReviseLogSGEntity>> fetchReviseLogs(
  720. String? revise_id, {
  721. CancelToken? cancelToken,
  722. }) async {
  723. Map<String, String> params = {};
  724. params["revise_id"] = revise_id ?? "";
  725. final result = await httpProvider.requestNetResult(
  726. ApiConstants.apiReviseLogListSG,
  727. params: params,
  728. cancelToken: cancelToken,
  729. );
  730. //根据返回的结果,封装原始数据为Bean/Entity对象
  731. if (result.isSuccess) {
  732. //重新赋值data或list
  733. final json = result.getDataJson();
  734. var data = ReviseLogSGEntity.fromJson(json!);
  735. //重新赋值data或list
  736. return result.convert<ReviseLogSGEntity>(data: data);
  737. }
  738. return result.convert();
  739. }
  740. }