job_repository.dart 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. import 'dart:typed_data';
  2. import 'package:domain/entity/response/job_list_add_staff_entity.dart';
  3. import 'package:domain/entity/response/job_list_applied_edit_entity.dart';
  4. import 'package:domain/entity/response/job_list_applied_info_entity.dart';
  5. import 'package:domain/entity/response/job_list_applied_staff_list_entity.dart';
  6. import 'package:domain/entity/response/job_list_applied_staff_search_entity.dart';
  7. import 'package:domain/entity/response/job_list_detail_entity.dart';
  8. import 'package:domain/entity/response/job_list_entity.dart';
  9. import 'package:domain/entity/response/job_list_index_entity.dart';
  10. import 'package:domain/entity/response/job_list_remark_view_entity.dart';
  11. import 'package:domain/entity/response/staff_detail_entity.dart';
  12. import 'package:domain/entity/response/staff_labour_history_entity.dart';
  13. import 'package:domain/entity/response/staff_remark_history_entity.dart';
  14. import 'package:get/get.dart';
  15. import 'package:plugin_platform/dio_export.dart';
  16. import 'package:plugin_platform/http/http_provider.dart';
  17. import 'package:plugin_platform/http/http_result.dart';
  18. import 'package:shared/utils/util.dart';
  19. import '../constants/api_constants.dart';
  20. import '../entity/response/attendance_entity.dart';
  21. import '../entity/response/check_success_entity.dart';
  22. import '../entity/response/job_list_applied_work_flow_entity.dart';
  23. /// 工作相关
  24. class JobRepository extends GetxService {
  25. HttpProvider httpProvider;
  26. JobRepository({required this.httpProvider});
  27. /// 获取当前酒店的考勤成员列表
  28. Future<HttpResult<AttendanceEntity>> fetchAttendanceList(
  29. String? keyword,
  30. String? startDate,
  31. String? endDate, {
  32. CancelToken? cancelToken,
  33. }) async {
  34. Map<String, String> params = {};
  35. params["cur_page"] = "1";
  36. params["page_size"] = "9999";
  37. if (!Utils.isEmpty(keyword)) {
  38. params["keyword"] = keyword!;
  39. }
  40. if (!Utils.isEmpty(startDate)) {
  41. params["start_date"] = startDate!;
  42. }
  43. if (!Utils.isEmpty(endDate)) {
  44. params["end_date"] = endDate!;
  45. }
  46. final result = await httpProvider.requestNetResult(
  47. ApiConstants.apiSignApplied,
  48. params: params,
  49. cancelToken: cancelToken,
  50. );
  51. //根据返回的结果,封装原始数据为Bean/Entity对象
  52. if (result.isSuccess) {
  53. //重新赋值data或list
  54. final json = result.getDataJson();
  55. var data = AttendanceEntity.fromJson(json!);
  56. //重新赋值data或list
  57. return result.convert<AttendanceEntity>(data: data);
  58. }
  59. return result.convert();
  60. }
  61. /// 用户上传考勤
  62. Future<HttpResult<CheckSuccessEntity>> submitCheckInOut(
  63. String? appliedId,
  64. ByteData? byteData, {
  65. bool isCheckIn = false,
  66. CancelToken? cancelToken,
  67. }) async {
  68. //Post请求
  69. Map<String, String> params = {};
  70. params['applied_id'] = appliedId ?? "";
  71. params['check_type'] = isCheckIn ? "1" : "2";
  72. Map<String, Uint8List> streams = {};
  73. if (byteData != null) {
  74. streams["capture"] = byteData.buffer.asUint8List();
  75. }
  76. final result = await httpProvider.requestNetResult(
  77. method: HttpMethod.POST,
  78. ApiConstants.apiSignInOut,
  79. params: params,
  80. pathStreams: streams,
  81. networkDebounce: true,
  82. isShowLoadingDialog: true,
  83. cancelToken: cancelToken,
  84. );
  85. //根据返回的结果,封装原始数据为Bean/Entity对象
  86. if (result.isSuccess) {
  87. final json = result.getDataJson();
  88. var data = CheckSuccessEntity.fromJson(json!);
  89. //重新赋值data
  90. return result.convert<CheckSuccessEntity>(data: data);
  91. }
  92. return result.convert<CheckSuccessEntity>();
  93. }
  94. /// 工作列表的筛选选项
  95. Future<HttpResult<JobListIndexEntity>> fetchJobListIndex({
  96. CancelToken? cancelToken,
  97. }) async {
  98. final result = await httpProvider.requestNetResult(
  99. ApiConstants.apiJobListIndex,
  100. cancelToken: cancelToken,
  101. );
  102. //根据返回的结果,封装原始数据为Bean/Entity对象
  103. if (result.isSuccess) {
  104. //重新赋值data或list
  105. final json = result.getDataJson();
  106. var data = JobListIndexEntity.fromJson(json!);
  107. //重新赋值data或list
  108. return result.convert<JobListIndexEntity>(data: data);
  109. }
  110. return result.convert();
  111. }
  112. /// 获取工作列表的主列表
  113. Future<HttpResult<JobListEntity>> fetchJobListTable(
  114. String? keyword,
  115. String? startDate,
  116. String? endDate,
  117. String? statusId,
  118. String? departmentId, {
  119. required int curPage,
  120. CancelToken? cancelToken,
  121. }) async {
  122. //参数
  123. Map<String, String> params = {};
  124. params["cur_page"] = curPage.toString();
  125. params["page_size"] = "20";
  126. if (!Utils.isEmpty(keyword)) {
  127. params["job_title"] = keyword!;
  128. }
  129. if (!Utils.isEmpty(startDate)) {
  130. params["start_time"] = startDate!;
  131. }
  132. if (!Utils.isEmpty(endDate)) {
  133. params["end_time"] = endDate!;
  134. }
  135. if (!Utils.isEmpty(statusId)) {
  136. params["status"] = statusId!;
  137. }
  138. if (!Utils.isEmpty(departmentId)) {
  139. params["co_department_id"] = departmentId!;
  140. }
  141. final result = await httpProvider.requestNetResult(
  142. ApiConstants.apiJobListTable,
  143. params: params,
  144. cancelToken: cancelToken,
  145. );
  146. //根据返回的结果,封装原始数据为Bean/Entity对象
  147. if (result.isSuccess) {
  148. //重新赋值data或list
  149. final json = result.getDataJson();
  150. var data = JobListEntity.fromJson(json!);
  151. //重新赋值data或list
  152. return result.convert<JobListEntity>(data: data);
  153. }
  154. return result.convert();
  155. }
  156. /// 工作列表的详情
  157. Future<HttpResult<JobListDetailEntity>> fetchJobListDetail(
  158. String? jobId, {
  159. CancelToken? cancelToken,
  160. }) async {
  161. //参数
  162. Map<String, String> params = {};
  163. params['job_id'] = jobId ?? "";
  164. final result = await httpProvider.requestNetResult(
  165. ApiConstants.apiJobListDetail,
  166. params: params,
  167. isShowLoadingDialog: true,
  168. cancelToken: cancelToken,
  169. );
  170. //根据返回的结果,封装原始数据为Bean/Entity对象
  171. if (result.isSuccess) {
  172. //重新赋值data或list
  173. final json = result.getDataJson();
  174. var data = JobListDetailEntity.fromJson(json!);
  175. //重新赋值data或list
  176. return result.convert<JobListDetailEntity>(data: data);
  177. }
  178. return result.convert();
  179. }
  180. /// 工作中已申请的工作信息
  181. Future<HttpResult<JobListAppliedInfoEntity>> fetchJobAppliedInfo(
  182. String? jobId, {
  183. CancelToken? cancelToken,
  184. }) async {
  185. //参数
  186. Map<String, String> params = {};
  187. params['job_id'] = jobId ?? "";
  188. final result = await httpProvider.requestNetResult(
  189. ApiConstants.apiJobListAppliedJobInfo,
  190. params: params,
  191. cancelToken: cancelToken,
  192. );
  193. //根据返回的结果,封装原始数据为Bean/Entity对象
  194. if (result.isSuccess) {
  195. //重新赋值data或list
  196. final json = result.getDataJson();
  197. var data = JobListAppliedInfoEntity.fromJson(json!);
  198. //重新赋值data或list
  199. return result.convert<JobListAppliedInfoEntity>(data: data);
  200. }
  201. return result.convert();
  202. }
  203. /// 工作中已申请的成员列表
  204. Future<HttpResult<JobListAppliedStaffListEntity>> fetchJobAppliedStaffs(
  205. String? jobId,
  206. String? staffName, {
  207. String? appliedId,
  208. required int curPage,
  209. CancelToken? cancelToken,
  210. }) async {
  211. //参数
  212. Map<String, String> params = {};
  213. params["cur_page"] = curPage.toString();
  214. params["page_size"] = "10";
  215. if (!Utils.isEmpty(jobId)) {
  216. params["job_id"] = jobId!;
  217. }
  218. if (!Utils.isEmpty(appliedId)) {
  219. params["applied_id"] = appliedId!;
  220. }
  221. if (!Utils.isEmpty(staffName)) {
  222. params["staff_name"] = staffName!;
  223. }
  224. final result = await httpProvider.requestNetResult(
  225. ApiConstants.apiJobListAppliedStaffList,
  226. params: params,
  227. cancelToken: cancelToken,
  228. );
  229. //根据返回的结果,封装原始数据为Bean/Entity对象
  230. if (result.isSuccess) {
  231. //重新赋值data或list
  232. final json = result.getDataJson();
  233. var data = JobListAppliedStaffListEntity.fromJson(json!);
  234. //重新赋值data或list
  235. return result.convert<JobListAppliedStaffListEntity>(data: data);
  236. }
  237. return result.convert();
  238. }
  239. /// 根据ID获取主列表的Item数据,用于刷新Item
  240. Future<HttpResult<JobListAppliedStaffListEntity>> fetchItemByAppliedIds(
  241. String? jobId,
  242. String? appliedIds, {
  243. CancelToken? cancelToken,
  244. }) async {
  245. //参数
  246. Map<String, String> params = {};
  247. params["cur_page"] = "1";
  248. params["page_size"] = "9999";
  249. if (!Utils.isEmpty(appliedIds)) {
  250. params["applied_ids"] = appliedIds!;
  251. }
  252. if (!Utils.isEmpty(jobId)) {
  253. params["job_id"] = jobId!;
  254. }
  255. final result = await httpProvider.requestNetResult(
  256. ApiConstants.apiJobListAppliedStaffList,
  257. params: params,
  258. isShowLoadingDialog: true,
  259. cancelToken: cancelToken,
  260. );
  261. //根据返回的结果,封装原始数据为Bean/Entity对象
  262. if (result.isSuccess) {
  263. //重新赋值data或list
  264. final json = result.getDataJson();
  265. var data = JobListAppliedStaffListEntity.fromJson(json!);
  266. //重新赋值data或list
  267. return result.convert<JobListAppliedStaffListEntity>(data: data);
  268. }
  269. return result.convert();
  270. }
  271. /// 添加员工的全部员工数据列表
  272. Future<HttpResult<JobListAppliedStaffSearchEntity>> searchStaffList(
  273. String? jobId,
  274. String? keyword, {
  275. required int curPage,
  276. CancelToken? cancelToken,
  277. }) async {
  278. //参数
  279. Map<String, String> params = {};
  280. params["cur_page"] = curPage.toString();
  281. params["page_size"] = "10";
  282. if (!Utils.isEmpty(jobId)) {
  283. params["job_id"] = jobId!;
  284. }
  285. if (!Utils.isEmpty(keyword)) {
  286. params["keyword"] = keyword!;
  287. }
  288. final result = await httpProvider.requestNetResult(
  289. ApiConstants.apiJobListAppliedStaffSearch,
  290. params: params,
  291. cancelToken: cancelToken,
  292. );
  293. //根据返回的结果,封装原始数据为Bean/Entity对象
  294. if (result.isSuccess) {
  295. //重新赋值data或list
  296. final json = result.getDataJson();
  297. var data = JobListAppliedStaffSearchEntity.fromJson(json!);
  298. //重新赋值data或list
  299. return result.convert<JobListAppliedStaffSearchEntity>(data: data);
  300. }
  301. return result.convert();
  302. }
  303. /// 添加员工到工作
  304. Future<HttpResult<JobListAddStaffEntity>> addStaff2Job(
  305. String? jobId,
  306. String? staffIds, {
  307. CancelToken? cancelToken,
  308. }) async {
  309. //参数
  310. Map<String, String> params = {};
  311. if (!Utils.isEmpty(jobId)) {
  312. params["job_id"] = jobId!;
  313. }
  314. if (!Utils.isEmpty(staffIds)) {
  315. params["staff_ids"] = staffIds!;
  316. }
  317. final result = await httpProvider.requestNetResult(
  318. ApiConstants.apiJobListAppliedStaffAdd,
  319. isShowLoadingDialog: true,
  320. method: HttpMethod.POST,
  321. params: params,
  322. cancelToken: cancelToken,
  323. );
  324. //根据返回的结果,封装原始数据为Bean/Entity对象
  325. if (result.isSuccess) {
  326. //重新赋值data或list
  327. final json = result.getDataJson();
  328. var data = JobListAddStaffEntity.fromJson(json!);
  329. //重新赋值data或list
  330. return result.convert<JobListAddStaffEntity>(data: data);
  331. }
  332. return result.convert();
  333. }
  334. /// 批量修改员工的签到信息与状态
  335. Future<HttpResult> batchEditStaffCheckTime(
  336. String? jobId,
  337. String? appliedIds,
  338. String? startTime,
  339. String? endTime, {
  340. CancelToken? cancelToken,
  341. }) async {
  342. //参数
  343. Map<String, String> params = {};
  344. if (!Utils.isEmpty(startTime)) {
  345. params["start_time"] = startTime!;
  346. }
  347. if (!Utils.isEmpty(endTime)) {
  348. params["end_time"] = endTime!;
  349. }
  350. if (!Utils.isEmpty(appliedIds)) {
  351. params["applied_ids"] = appliedIds!;
  352. }
  353. if (!Utils.isEmpty(jobId)) {
  354. params["job_id"] = jobId!;
  355. }
  356. final result = await httpProvider.requestNetResult(
  357. ApiConstants.apiJobListAppliedStaffBatchEdit,
  358. isShowLoadingDialog: true,
  359. method: HttpMethod.POST,
  360. params: params,
  361. cancelToken: cancelToken,
  362. );
  363. //根据返回的结果,封装原始数据为Bean/Entity对象
  364. if (result.isSuccess) {
  365. //重新赋值data或list
  366. return result.convert();
  367. }
  368. return result.convert();
  369. }
  370. /// 获取单个员工的信息,准备修改
  371. Future<HttpResult<JobListAppliedEditEntity>> fetchAppliedEditView(
  372. String? appliedId, {
  373. CancelToken? cancelToken,
  374. }) async {
  375. //参数
  376. Map<String, String> params = {};
  377. if (!Utils.isEmpty(appliedId)) {
  378. params["applied_id"] = appliedId!;
  379. }
  380. final result = await httpProvider.requestNetResult(
  381. ApiConstants.apiJobListAppliedStaffEditIndex,
  382. isShowLoadingDialog: true,
  383. params: params,
  384. cancelToken: cancelToken,
  385. );
  386. //根据返回的结果,封装原始数据为Bean/Entity对象
  387. if (result.isSuccess) {
  388. //重新赋值data或list
  389. final json = result.getDataJson();
  390. var data = JobListAppliedEditEntity.fromJson(json!);
  391. //重新赋值data或list
  392. return result.convert<JobListAppliedEditEntity>(data: data);
  393. }
  394. return result.convert();
  395. }
  396. /// 单独修改单个员工的信息
  397. Future<HttpResult> editAppliedSingleStaffInfo(
  398. String? appliedId,
  399. JobListAppliedEditEntity entity, {
  400. CancelToken? cancelToken,
  401. }) async {
  402. //参数
  403. Map<String, String> params = {};
  404. if (!Utils.isEmpty(appliedId)) {
  405. params["applied_id"] = appliedId!;
  406. }
  407. if (!Utils.isEmpty(entity.startTime)) {
  408. params["start_time"] = entity.startTime!;
  409. }
  410. if (!Utils.isEmpty(entity.endTime)) {
  411. params["end_time"] = entity.endTime!;
  412. }
  413. if (!Utils.isEmpty(entity.securityIn)) {
  414. params["security_in"] = entity.securityIn!;
  415. }
  416. if (!Utils.isEmpty(entity.securityOut)) {
  417. params["security_out"] = entity.securityOut!;
  418. }
  419. if (!Utils.isEmpty(entity.workIn)) {
  420. params["work_in"] = entity.workIn!;
  421. }
  422. if (!Utils.isEmpty(entity.workOut)) {
  423. params["work_out"] = entity.workOut!;
  424. }
  425. if (entity.jobUnit == "hour") {
  426. if (!Utils.isEmpty(entity.adjustHours)) {
  427. params["adjust_hours"] = entity.adjustHours!;
  428. }
  429. } else {
  430. if (entity.totalRooms != 0) {
  431. params["total_rooms"] = entity.totalRooms.toString();
  432. }
  433. }
  434. if (entity.reasonType != 0) {
  435. params["co_reason_type"] = entity.reasonType.toString();
  436. }
  437. if (!Utils.isEmpty(entity.coReason)) {
  438. params["co_reason"] = entity.coReason!;
  439. }
  440. final result = await httpProvider.requestNetResult(
  441. ApiConstants.apiJobListAppliedStaffEditSubmit,
  442. isShowLoadingDialog: true,
  443. method: HttpMethod.POST,
  444. params: params,
  445. cancelToken: cancelToken,
  446. );
  447. //根据返回的结果,封装原始数据为Bean/Entity对象
  448. if (result.isSuccess) {
  449. //重新赋值data或list
  450. return result.convert();
  451. }
  452. return result.convert();
  453. }
  454. /// 给员工评分的详情与选项
  455. Future<HttpResult<JobListRemarkViewEntity>> fetchAppliedStaffReviewView(
  456. String? appliedId, {
  457. CancelToken? cancelToken,
  458. }) async {
  459. //参数
  460. Map<String, String> params = {};
  461. if (!Utils.isEmpty(appliedId)) {
  462. params["applied_id"] = appliedId!;
  463. }
  464. final result = await httpProvider.requestNetResult(
  465. ApiConstants.apiJobListAppliedStaffReviewIndex,
  466. isShowLoadingDialog: true,
  467. params: params,
  468. cancelToken: cancelToken,
  469. );
  470. //根据返回的结果,封装原始数据为Bean/Entity对象
  471. if (result.isSuccess) {
  472. //重新赋值data或list
  473. final json = result.getDataJson();
  474. var data = JobListRemarkViewEntity.fromJson(json!);
  475. //重新赋值data或list
  476. return result.convert<JobListRemarkViewEntity>(data: data);
  477. }
  478. return result.convert();
  479. }
  480. /// 单独给单个员工评分的提交
  481. Future<HttpResult> remarkAppliedSingleStaffSubmit(
  482. String? appliedId,
  483. String? attitude_rate,
  484. String? grooming_rate,
  485. String? performance_rate,
  486. String? experience_rate,
  487. String? content, {
  488. CancelToken? cancelToken,
  489. }) async {
  490. //参数
  491. Map<String, String> params = {};
  492. if (!Utils.isEmpty(appliedId)) {
  493. params["applied_id"] = appliedId!;
  494. }
  495. if (!Utils.isEmpty(attitude_rate)) {
  496. params["attitude_rate"] = attitude_rate!;
  497. }
  498. if (!Utils.isEmpty(grooming_rate)) {
  499. params["grooming_rate"] = grooming_rate!;
  500. }
  501. if (!Utils.isEmpty(performance_rate)) {
  502. params["performance_rate"] = performance_rate!;
  503. }
  504. if (!Utils.isEmpty(experience_rate)) {
  505. params["experience_rate"] = experience_rate!;
  506. }
  507. if (!Utils.isEmpty(content)) {
  508. params["content"] = content!;
  509. }
  510. final result = await httpProvider.requestNetResult(
  511. ApiConstants.apiJobListAppliedStaffReviewSubmit,
  512. isShowLoadingDialog: true,
  513. method: HttpMethod.POST,
  514. params: params,
  515. cancelToken: cancelToken,
  516. );
  517. //根据返回的结果,封装原始数据为Bean/Entity对象
  518. if (result.isSuccess) {
  519. //重新赋值data或list
  520. return result.convert();
  521. }
  522. return result.convert();
  523. }
  524. /// 批量提交多个员工的考勤
  525. Future<HttpResult> submitBatchStaffApprove(
  526. String? appliedIds, {
  527. CancelToken? cancelToken,
  528. }) async {
  529. //参数
  530. Map<String, String> params = {};
  531. if (!Utils.isEmpty(appliedIds)) {
  532. params["applied_ids"] = appliedIds!;
  533. }
  534. final result = await httpProvider.requestNetResult(
  535. ApiConstants.apiJobListAppliedApprove,
  536. isShowLoadingDialog: true,
  537. method: HttpMethod.POST,
  538. params: params,
  539. cancelToken: cancelToken,
  540. );
  541. //根据返回的结果,封装原始数据为Bean/Entity对象
  542. if (result.isSuccess) {
  543. //重新赋值data或list
  544. return result.convert();
  545. }
  546. return result.convert();
  547. }
  548. // 员工状态的工作流
  549. Future<HttpResult<JobListAppliedWorkFlowEntity>> fetchAppliedWorkFlow(
  550. String? appliedId, {
  551. CancelToken? cancelToken,
  552. }) async {
  553. //参数
  554. Map<String, String> params = {};
  555. if (!Utils.isEmpty(appliedId)) {
  556. params["applied_id"] = appliedId!;
  557. }
  558. final result = await httpProvider.requestNetResult(
  559. ApiConstants.apiJobListAppliedStaffStateWorkflow,
  560. params: params,
  561. cancelToken: cancelToken,
  562. );
  563. //根据返回的结果,封装原始数据为Bean/Entity对象
  564. if (result.isSuccess) {
  565. //重新赋值data或list
  566. final json = result.getDataJson();
  567. var data = JobListAppliedWorkFlowEntity.fromJson(json!);
  568. //重新赋值data或list
  569. return result.convert<JobListAppliedWorkFlowEntity>(data: data);
  570. }
  571. return result.convert();
  572. }
  573. // 员工的信息
  574. Future<HttpResult<StaffDetailEntity>> fetchStaffDetail(
  575. String? memberId, {
  576. CancelToken? cancelToken,
  577. }) async {
  578. //参数
  579. Map<String, String> params = {};
  580. if (!Utils.isEmpty(memberId)) {
  581. params["member_id"] = memberId!;
  582. }
  583. final result = await httpProvider.requestNetResult(
  584. ApiConstants.apiJobListStaffDetail,
  585. params: params,
  586. cancelToken: cancelToken,
  587. );
  588. //根据返回的结果,封装原始数据为Bean/Entity对象
  589. if (result.isSuccess) {
  590. //重新赋值data或list
  591. final json = result.getDataJson();
  592. var data = StaffDetailEntity.fromJson(json!);
  593. //重新赋值data或list
  594. return result.convert<StaffDetailEntity>(data: data);
  595. }
  596. return result.convert();
  597. }
  598. // 员工的历史申请记录
  599. Future<HttpResult<StaffLabourHistoryEntity>> fetchStaffLabourHistory(
  600. String? memberId,
  601. String? keyword, {
  602. required int curPage,
  603. CancelToken? cancelToken,
  604. }) async {
  605. //参数
  606. Map<String, String> params = {};
  607. params["cur_page"] = curPage.toString();
  608. params["page_size"] = "10";
  609. if (!Utils.isEmpty(memberId)) {
  610. params["member_id"] = memberId!;
  611. }
  612. if (!Utils.isEmpty(keyword)) {
  613. params["keyword"] = keyword!;
  614. }
  615. final result = await httpProvider.requestNetResult(
  616. ApiConstants.apiJobListStaffLabourHistory,
  617. params: params,
  618. cancelToken: cancelToken,
  619. );
  620. //根据返回的结果,封装原始数据为Bean/Entity对象
  621. if (result.isSuccess) {
  622. //重新赋值data或list
  623. final json = result.getDataJson();
  624. var data = StaffLabourHistoryEntity.fromJson(json!);
  625. //重新赋值data或list
  626. return result.convert<StaffLabourHistoryEntity>(data: data);
  627. }
  628. return result.convert();
  629. }
  630. // 员工的历史评价记录
  631. Future<HttpResult<StaffRemarkHistoryEntity>> fetchStaffRemarkHistory(
  632. String? memberId, {
  633. required int curPage,
  634. CancelToken? cancelToken,
  635. }) async {
  636. //参数
  637. Map<String, String> params = {};
  638. params["cur_page"] = curPage.toString();
  639. params["page_size"] = "10";
  640. if (!Utils.isEmpty(memberId)) {
  641. params["member_id"] = memberId!;
  642. }
  643. final result = await httpProvider.requestNetResult(
  644. ApiConstants.apiJobListStaffRemarkHistory,
  645. params: params,
  646. cancelToken: cancelToken,
  647. );
  648. //根据返回的结果,封装原始数据为Bean/Entity对象
  649. if (result.isSuccess) {
  650. //重新赋值data或list
  651. final json = result.getDataJson();
  652. var data = StaffRemarkHistoryEntity.fromJson(json!);
  653. //重新赋值data或list
  654. return result.convert<StaffRemarkHistoryEntity>(data: data);
  655. }
  656. return result.convert();
  657. }
  658. }