job_repository.dart 21 KB

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