uk_labour_repository.dart 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942
  1. import 'dart:io';
  2. import 'package:domain/entity/response/uk_labour_request_review_detail_entity.dart';
  3. import 'package:domain/entity/response/uk_labour_request_review_list_entity.dart';
  4. import 'package:domain/entity/server_time.dart';
  5. import 'package:get/get.dart';
  6. import 'package:plugin_platform/platform_export.dart';
  7. import 'package:plugin_platform/http/http_provider.dart';
  8. import 'package:plugin_platform/http/http_result.dart';
  9. import 'package:shared/utils/log_utils.dart';
  10. import 'package:shared/utils/util.dart';
  11. import '../constants/api_constants.dart';
  12. import '../entity/response/uk_lab_req_show_template_entity.dart';
  13. import '../entity/response/uk_labour_request_detail_entity.dart';
  14. import '../entity/response/uk_labour_request_preselect_addstaff_list_entity.dart';
  15. import '../entity/response/uk_labour_request_preselected_list_entity.dart';
  16. import '../entity/response/uk_labour_request_table_entity.dart';
  17. import '../entity/response/uk_labour_review_status_entity.dart';
  18. /// 用工请求相关
  19. class UkLabourRepository extends GetxService {
  20. HttpProvider httpProvider;
  21. UkLabourRepository({required this.httpProvider});
  22. /// 获取用工请求的主列表
  23. Future<HttpResult<UkLabourRequestTableEntity>> fetchLabourRequestList(
  24. String? keyword,
  25. String? startDate,
  26. String? endDate,
  27. String? statusId,
  28. String? departmentId, {
  29. required int curPage,
  30. CancelToken? cancelToken,
  31. }) async {
  32. //参数
  33. Map<String, String> params = {};
  34. params["cur_page"] = curPage.toString();
  35. params["page_size"] = "20";
  36. if (!Utils.isEmpty(keyword)) {
  37. params["job_title"] = keyword!;
  38. }
  39. if (!Utils.isEmpty(startDate)) {
  40. params["job_start"] = startDate!;
  41. }
  42. if (!Utils.isEmpty(endDate)) {
  43. params["job_end"] = endDate!;
  44. }
  45. if (!Utils.isEmpty(statusId)) {
  46. params["co_status"] = statusId!;
  47. }
  48. if (!Utils.isEmpty(departmentId)) {
  49. params["co_department_id"] = departmentId!;
  50. }
  51. final result = await httpProvider.requestNetResult(
  52. ApiConstants.apiLabourRequestList,
  53. params: params,
  54. cancelToken: cancelToken,
  55. );
  56. //根据返回的结果,封装原始数据为Bean/Entity对象
  57. if (result.isSuccess) {
  58. //重新赋值data或list
  59. final json = result.getDataJson();
  60. var data = UkLabourRequestTableEntity.fromJson(json!);
  61. //重新赋值data或list
  62. return result.convert<UkLabourRequestTableEntity>(data: data);
  63. }
  64. return result.convert();
  65. }
  66. /// 根据ID获取主列表的Item数据,用于刷新Item
  67. Future<HttpResult<UkLabourRequestTableEntity>> fetchItemByRequestId(
  68. String? requestId, {
  69. CancelToken? cancelToken,
  70. }) async {
  71. //参数
  72. Map<String, String> params = {};
  73. params["cur_page"] = "1";
  74. params["page_size"] = "1";
  75. if (!Utils.isEmpty(requestId)) {
  76. params["request_id"] = requestId!;
  77. }
  78. final result = await httpProvider.requestNetResult(
  79. ApiConstants.apiLabourRequestList,
  80. params: params,
  81. isShowLoadingDialog: true,
  82. cancelToken: cancelToken,
  83. );
  84. //根据返回的结果,封装原始数据为Bean/Entity对象
  85. if (result.isSuccess) {
  86. //重新赋值data或list
  87. final json = result.getDataJson();
  88. var data = UkLabourRequestTableEntity.fromJson(json!);
  89. //重新赋值data或list
  90. return result.convert<UkLabourRequestTableEntity>(data: data);
  91. }
  92. return result.convert();
  93. }
  94. /// 添加用工的选项
  95. Future<HttpResult<UkLabourRequestDetailEntity>> fetchLabourRequestAddOption({
  96. CancelToken? cancelToken,
  97. }) async {
  98. final result = await httpProvider.requestNetResult(
  99. ApiConstants.apiLabourRequestAddOption,
  100. isShowLoadingDialog: true,
  101. cancelToken: cancelToken,
  102. );
  103. //根据返回的结果,封装原始数据为Bean/Entity对象
  104. if (result.isSuccess) {
  105. //重新赋值data或list
  106. final json = result.getDataJson();
  107. var data = UkLabourRequestDetailEntity.fromJson(json!);
  108. //重新赋值data或list
  109. return result.convert<UkLabourRequestDetailEntity>(data: data);
  110. }
  111. return result.convert();
  112. }
  113. /// 根据模板id 回显 详情页相关数据
  114. Future<HttpResult<UkLabReqShowTemplateEntity>> fetchLabourRequestShowTemplateData(
  115. String templateId,
  116. {
  117. CancelToken? cancelToken,
  118. }) async {
  119. Map<String, dynamic> params = {};
  120. params['template_id'] = templateId;
  121. final result = await httpProvider.requestNetResult(
  122. ApiConstants.apiLabourRequestTemplateShowUK,
  123. params: params,
  124. isShowLoadingDialog: true,
  125. cancelToken: cancelToken,
  126. );
  127. //根据返回的结果,封装原始数据为Bean/Entity对象
  128. if (result.isSuccess) {
  129. //重新赋值data或list
  130. final json = result.getDataJson();
  131. var data = UkLabReqShowTemplateEntity.fromJson(json!);
  132. //重新赋值data或list
  133. return result.convert<UkLabReqShowTemplateEntity>(data: data);
  134. }
  135. return result.convert();
  136. }
  137. /// 获取labourequest 详情
  138. Future<HttpResult<UkLabourRequestDetailEntity>> fetchLabourRequestDetail(
  139. String? requestId, {
  140. CancelToken? cancelToken,
  141. }) async {
  142. //参数
  143. Map<String, String> params = {};
  144. if (!Utils.isEmpty(requestId)) {
  145. params["request_id"] = requestId!;
  146. }
  147. final result = await httpProvider.requestNetResult(
  148. ApiConstants.apiLabourRequestEditDetail,
  149. params: params,
  150. isShowLoadingDialog: true,
  151. cancelToken: cancelToken,
  152. );
  153. //根据返回的结果,封装原始数据为Bean/Entity对象
  154. if (result.isSuccess) {
  155. //重新赋值data或list
  156. final json = result.getDataJson();
  157. var data = UkLabourRequestDetailEntity.fromJson(json!);
  158. //重新赋值data或list
  159. return result.convert<UkLabourRequestDetailEntity>(data: data);
  160. }
  161. return result.convert();
  162. }
  163. /// lab-request 的编辑用工请求发布
  164. Future<HttpResult> editLabourRequestSubmit({
  165. String? requestId,
  166. String? templateId,
  167. String? jobStart,
  168. String? jobEnd,
  169. String? departmentId,
  170. String? needNum,
  171. String? salaryBy,
  172. String? repeatDateStr,
  173. String? amount,
  174. String? countryId,
  175. String? cityId,
  176. String? location,
  177. String? certificate, // 多个逗号隔开
  178. String? challenge25,
  179. String? vehicle, // 多个逗号隔开
  180. String? description,
  181. String? employmentType,
  182. String? eventName,
  183. String? eventType,
  184. String? passengers,
  185. String? estRevenue,
  186. String? position,
  187. String? estCost,
  188. dynamic? attUrl,
  189. String? videoText,
  190. dynamic? videoCover,
  191. dynamic? video,
  192. dynamic? otherImage,
  193. dynamic? otherDocument,
  194. CancelToken? cancelToken,
  195. }) async {
  196. //参数
  197. Map<String, dynamic> params = {};
  198. params['request_id'] = requestId ?? "";
  199. params['template_id'] = templateId ?? "";
  200. params['job_start'] = jobStart ?? "";
  201. params['job_end'] = jobEnd ?? "";
  202. params['need_num'] = needNum ?? "";
  203. if (!Utils.isEmpty(departmentId)) {
  204. params["co_department_id"] = departmentId!;
  205. }
  206. params['salary_by'] = salaryBy ?? "";
  207. if (!Utils.isEmpty(amount)) {
  208. params["amount"] = amount!;
  209. }
  210. if (!Utils.isEmpty(countryId)) {
  211. params["country_id"] = countryId!;
  212. }
  213. if (!Utils.isEmpty(cityId)) {
  214. params["city_id"] = cityId!;
  215. }
  216. if (!Utils.isEmpty(location)) {
  217. params["location"] = location!;
  218. }
  219. if(!Utils.isEmpty(certificate)){
  220. params["certificate"] = certificate!;
  221. }
  222. if(!Utils.isEmpty(challenge25)){
  223. params["challenge_25"] = challenge25!;
  224. }
  225. if(!Utils.isEmpty(vehicle)){
  226. params["vehicle"] = vehicle!;
  227. }
  228. if(!Utils.isEmpty(repeatDateStr)) {
  229. params["select"] = repeatDateStr!;
  230. }
  231. params['description'] = description ?? "";
  232. params['employment_type'] = employmentType ?? "";
  233. params['event_name'] = eventName ?? "";
  234. params['event_type'] = eventType ?? "";
  235. params['passengers'] = passengers ?? "";
  236. params['est_revenue'] = estRevenue ?? "";
  237. params['position'] = position ?? "";
  238. params['est_cost'] = estCost ?? "";
  239. //可能是file 也可能是 url
  240. Map<String, String> filePathParams = {};
  241. // 判断 http 或者 https 开头
  242. if(Utils.isNotEmpty(attUrl)){
  243. if(attUrl!.startsWith("http") || attUrl!.startsWith("https")){
  244. params['att_url'] = attUrl;
  245. }else {
  246. filePathParams['att_url'] = attUrl;
  247. }
  248. }
  249. // 视频部分的参数
  250. params['video_text'] = videoText ?? "";
  251. //可能是file 也可能是 url
  252. // 判断 http 或者 https 开头
  253. if(Utils.isNotEmpty(videoCover)){
  254. if(videoCover!.startsWith("http") || videoCover!.startsWith("https")){
  255. params['video_cover'] = videoCover;
  256. }else {
  257. filePathParams['video_cover'] = videoCover;
  258. }
  259. }
  260. //可能是file 也可能是 url
  261. // 判断 http 或者 https 开头
  262. if(Utils.isNotEmpty(video)){
  263. if(video!.startsWith("http") || video!.startsWith("https")){
  264. params['video'] = video;
  265. }else {
  266. filePathParams['video'] = video;
  267. }
  268. }
  269. //可能是file 也可能是 url
  270. // 判断 http 或者 https 开头
  271. if(Utils.isNotEmpty(otherImage)){
  272. if(otherImage!.startsWith("http") || otherImage!.startsWith("https")){
  273. params['other_image'] = otherImage;
  274. }else {
  275. filePathParams['other_image'] = otherImage;
  276. }
  277. }
  278. //可能是file 也可能是 url
  279. // 判断 http 或者 https 开头
  280. if(Utils.isNotEmpty(otherDocument)){
  281. if(otherDocument!.startsWith("http") || otherDocument!.startsWith("https")){
  282. params['other_document'] = otherDocument;
  283. }else {
  284. filePathParams['other_document'] = otherDocument;
  285. }
  286. }
  287. final result = await httpProvider.requestNetResult(
  288. ApiConstants.apiLabourRequestEditSubmit,
  289. method: HttpMethod.POST,
  290. params: params,
  291. paths: filePathParams,
  292. networkDebounce: true,
  293. isShowLoadingDialog: true,
  294. cancelToken: cancelToken,
  295. );
  296. //根据返回的结果,封装原始数据为Bean/Entity对象
  297. if (result.isSuccess) {
  298. //重新赋值data或list
  299. return result.convert();
  300. }
  301. return result.convert();
  302. }
  303. /// lab-request 的新增 labourequest用工请求发布
  304. Future<HttpResult> addLabourRequestSubmit({
  305. String? templateId,
  306. String? jobDate,
  307. String? jobStart,
  308. String? jobEnd,
  309. String? departmentId,
  310. String? needNum,
  311. String? salaryBy,
  312. String? repeatDateStr,
  313. String? amount,
  314. String? countryId,
  315. String? cityId,
  316. String? location,
  317. String? certificate, // 多个逗号隔开
  318. String? challenge25,
  319. String? vehicle, // 多个逗号隔开
  320. String? jobApplyPreId,
  321. String? description,
  322. String? employmentType,
  323. String? eventName,
  324. String? eventType,
  325. String? passengers,
  326. String? estRevenue,
  327. String? position,
  328. String? estCost,
  329. dynamic? attUrl,
  330. String? videoText,
  331. dynamic? videoCover,
  332. dynamic? video,
  333. dynamic? otherImage,
  334. dynamic? otherDocument,
  335. CancelToken? cancelToken,
  336. }) async {
  337. //参数
  338. Map<String, dynamic> params = {};
  339. params['template_id'] = templateId ?? "";
  340. params['job_date'] = jobDate ?? "";
  341. params['start_time'] = jobStart ?? "";
  342. params['end_time'] = jobEnd ?? "";
  343. params['need_num'] = needNum ?? "";
  344. if (!Utils.isEmpty(departmentId)) {
  345. params["co_department_id"] = departmentId!;
  346. }
  347. params['salary_by'] = salaryBy ?? "";
  348. if(!Utils.isEmpty(repeatDateStr)){
  349. params["select"] = repeatDateStr!;
  350. }
  351. if(!Utils.isEmpty(jobApplyPreId)){
  352. params["job_apply_pre_id"] = jobApplyPreId!;
  353. }
  354. if (!Utils.isEmpty(amount)) {
  355. params["amount"] = amount!;
  356. }
  357. if (!Utils.isEmpty(countryId)) {
  358. params["country_id"] = countryId!;
  359. }
  360. if (!Utils.isEmpty(cityId)) {
  361. params["city_id"] = cityId!;
  362. }
  363. if (!Utils.isEmpty(location)) {
  364. params["location"] = location!;
  365. }
  366. if(!Utils.isEmpty(certificate)){
  367. params["certificate"] = certificate!;
  368. }
  369. if(!Utils.isEmpty(challenge25)){
  370. params["challenge_25"] = challenge25!;
  371. }
  372. if(!Utils.isEmpty(vehicle)){
  373. params["vehicle"] = vehicle!;
  374. }
  375. params['description'] = description ?? "";
  376. params['employment_type'] = employmentType ?? "";
  377. params['event_name'] = eventName ?? "";
  378. params['event_type'] = eventType ?? "";
  379. params['passengers'] = passengers ?? "";
  380. params['est_revenue'] = estRevenue ?? "";
  381. params['position'] = position ?? "";
  382. params['est_cost'] = estCost ?? "";
  383. //可能是file 也可能是 url
  384. Map<String, String> filePathParams = {};
  385. // 判断 http 或者 https 开头
  386. if(Utils.isNotEmpty(attUrl)){
  387. if(attUrl!.startsWith("http") || attUrl!.startsWith("https")){
  388. params['att_url'] = attUrl;
  389. }else {
  390. filePathParams['att_url'] = attUrl;
  391. }
  392. }
  393. // 视频部分的参数
  394. params['video_text'] = videoText ?? "";
  395. //可能是file 也可能是 url
  396. // 判断 http 或者 https 开头
  397. if(Utils.isNotEmpty(videoCover)){
  398. if(videoCover!.startsWith("http") || videoCover!.startsWith("https")){
  399. params['video_cover'] = videoCover;
  400. }else {
  401. filePathParams['video_cover'] = videoCover;
  402. }
  403. }
  404. //可能是file 也可能是 url
  405. // 判断 http 或者 https 开头
  406. if(Utils.isNotEmpty(video)){
  407. if(video!.startsWith("http") || video!.startsWith("https")){
  408. params['video'] = video;
  409. }else {
  410. filePathParams['video'] = video;
  411. }
  412. }
  413. //可能是file 也可能是 url
  414. // 判断 http 或者 https 开头
  415. if(Utils.isNotEmpty(otherImage)){
  416. if(otherImage!.startsWith("http") || otherImage!.startsWith("https")){
  417. params['other_image'] = otherImage;
  418. }else {
  419. filePathParams['other_image'] = otherImage;
  420. }
  421. }
  422. //可能是file 也可能是 url
  423. // 判断 http 或者 https 开头
  424. if(Utils.isNotEmpty(otherDocument)){
  425. if(otherDocument!.startsWith("http") || otherDocument!.startsWith("https")){
  426. params['other_document'] = otherDocument;
  427. }else {
  428. filePathParams['other_document'] = otherDocument;
  429. }
  430. }
  431. final result = await httpProvider.requestNetResult(
  432. ApiConstants.apiLabourRequestAddSubmit,
  433. method: HttpMethod.POST,
  434. params: params,
  435. paths: filePathParams,
  436. networkDebounce: true,
  437. isShowLoadingDialog: true,
  438. cancelToken: cancelToken,
  439. );
  440. //根据返回的结果,封装原始数据为Bean/Entity对象
  441. if (result.isSuccess) {
  442. //重新赋值data或list
  443. return result.convert();
  444. }
  445. return result.convert();
  446. }
  447. /// lab-request-review 的编辑用工请求发布
  448. Future<HttpResult> editLabourRequestReviewSubmit({
  449. String? requestId,
  450. String? templateId,
  451. String? jobStart,
  452. String? jobEnd,
  453. String? departmentId,
  454. String? needNum,
  455. String? countryId,
  456. String? cityId,
  457. String? location,
  458. String? salaryBy,
  459. String? repeatDateStr,
  460. String? amount,
  461. String? certificate, // 多个逗号隔开
  462. String? challenge25,
  463. String? vehicle, // 多个逗号隔开
  464. String? description,
  465. String? employmentType,
  466. String? eventName,
  467. String? eventType,
  468. String? passengers,
  469. String? estRevenue,
  470. String? position,
  471. String? estCost,
  472. dynamic? attUrl,
  473. String? videoText,
  474. dynamic? videoCover,
  475. dynamic? video,
  476. dynamic? otherImage,
  477. dynamic? otherDocument,
  478. CancelToken? cancelToken,
  479. }) async {
  480. //参数
  481. Map<String, dynamic> params = {};
  482. params['request_id'] = requestId ?? "";
  483. params['template_id'] = templateId ?? "";
  484. params['job_start'] = jobStart ?? "";
  485. params['job_end'] = jobEnd ?? "";
  486. params['need_num'] = needNum ?? "";
  487. if (!Utils.isEmpty(departmentId)) {
  488. params["co_department_id"] = departmentId!;
  489. }
  490. params['salary_by'] = salaryBy ?? "";
  491. if (!Utils.isEmpty(amount)) {
  492. params["amount"] = amount!;
  493. }
  494. if (!Utils.isEmpty(countryId)) {
  495. params["country_id"] = countryId!;
  496. }
  497. if (!Utils.isEmpty(cityId)) {
  498. params["city_id"] = cityId!;
  499. }
  500. if (!Utils.isEmpty(location)) {
  501. params["location"] = location!;
  502. }
  503. if(!Utils.isEmpty(certificate)){
  504. params["certificate"] = certificate!;
  505. }
  506. if(!Utils.isEmpty(challenge25)){
  507. params["challenge_25"] = challenge25!;
  508. }
  509. if(!Utils.isEmpty(vehicle)){
  510. params["vehicle"] = vehicle!;
  511. }
  512. if(!Utils.isEmpty(repeatDateStr)) {
  513. params["select"] = repeatDateStr!;
  514. }
  515. params['description'] = description ?? "";
  516. params['employment_type'] = employmentType ?? "";
  517. params['event_name'] = eventName ?? "";
  518. params['event_type'] = eventType ?? "";
  519. params['passengers'] = passengers ?? "";
  520. params['est_revenue'] = estRevenue ?? "";
  521. params['position'] = position ?? "";
  522. params['est_cost'] = estCost ?? "";
  523. //可能是file 也可能是 url
  524. Map<String, String> filePathParams = {};
  525. // 判断 http 或者 https 开头
  526. if(Utils.isNotEmpty(attUrl)){
  527. if(attUrl!.startsWith("http") || attUrl!.startsWith("https")){
  528. params['att_url'] = attUrl;
  529. }else {
  530. filePathParams['att_url'] = attUrl;
  531. }
  532. }
  533. // 视频部分的参数
  534. params['video_text'] = videoText ?? "";
  535. //可能是file 也可能是 url
  536. // 判断 http 或者 https 开头
  537. if(Utils.isNotEmpty(videoCover)){
  538. if(videoCover!.startsWith("http") || videoCover!.startsWith("https")){
  539. params['video_cover'] = videoCover;
  540. }else {
  541. filePathParams['video_cover'] = videoCover;
  542. }
  543. }
  544. //可能是file 也可能是 url
  545. // 判断 http 或者 https 开头
  546. if(Utils.isNotEmpty(video)){
  547. if(video!.startsWith("http") || video!.startsWith("https")){
  548. params['video'] = video;
  549. }else {
  550. filePathParams['video'] = video;
  551. }
  552. }
  553. //可能是file 也可能是 url
  554. // 判断 http 或者 https 开头
  555. if(Utils.isNotEmpty(otherImage)){
  556. if(otherImage!.startsWith("http") || otherImage!.startsWith("https")){
  557. params['other_image'] = otherImage;
  558. }else {
  559. filePathParams['other_image'] = otherImage;
  560. }
  561. }
  562. //可能是file 也可能是 url
  563. // 判断 http 或者 https 开头
  564. if(Utils.isNotEmpty(otherDocument)){
  565. if(otherDocument!.startsWith("http") || otherDocument!.startsWith("https")){
  566. params['other_document'] = otherDocument;
  567. }else {
  568. filePathParams['other_document'] = otherDocument;
  569. }
  570. }
  571. final result = await httpProvider.requestNetResult(
  572. ApiConstants.apiLabourRequestReViewEditUK,
  573. method: HttpMethod.POST,
  574. params: params,
  575. paths: filePathParams,
  576. networkDebounce: true,
  577. isShowLoadingDialog: true,
  578. cancelToken: cancelToken,
  579. );
  580. //根据返回的结果,封装原始数据为Bean/Entity对象
  581. if (result.isSuccess) {
  582. //重新赋值data或list
  583. return result.convert();
  584. }
  585. return result.convert();
  586. }
  587. /// 用工请求 快速复制
  588. Future<HttpResult> quickCopyLabourRequestSubmit(
  589. String? requestId,
  590. // 格式[Y-m-d]
  591. String? jobDate,
  592. //格式[H:m]
  593. String? startTime,
  594. //格式[H:m]
  595. String? endTime,
  596. {
  597. CancelToken? cancelToken,
  598. }) async {
  599. //参数
  600. Map<String, String> params = {};
  601. params['request_id'] = requestId ?? "";
  602. params['job_date'] = jobDate ?? "";
  603. params['start_time'] = startTime ?? "";
  604. params['end_time'] = endTime ?? "";
  605. final result = await httpProvider.requestNetResult(
  606. ApiConstants.apiLabourRequestQuickCopyUK,
  607. method: HttpMethod.POST,
  608. params: params,
  609. networkDebounce: true,
  610. isShowLoadingDialog: true,
  611. cancelToken: cancelToken,
  612. );
  613. //根据返回的结果,封装原始数据为Bean/Entity对象
  614. if (result.isSuccess) {
  615. //重新赋值data或list
  616. return result.convert();
  617. }
  618. return result.convert();
  619. }
  620. /// 获取 labourequest preselected 列表
  621. Future<HttpResult<UkLabourRequestPreselectedListEntity>> fetchLabourRequestPreselectedList(
  622. String reQuestId,
  623. {
  624. required int curPage,
  625. CancelToken? cancelToken,
  626. }) async {
  627. //参数
  628. Map<String, String> params = {};
  629. params["cur_page"] = curPage.toString();
  630. params["page_size"] = "20";
  631. if (!Utils.isEmpty(reQuestId)) {
  632. params["request_id"] = reQuestId;
  633. }
  634. final result = await httpProvider.requestNetResult(
  635. ApiConstants.apiLabourRequestPreSelectListUK,
  636. params: params,
  637. cancelToken: cancelToken,
  638. );
  639. //根据返回的结果,封装原始数据为Bean/Entity对象
  640. if (result.isSuccess) {
  641. //重新赋值data或list
  642. final json = result.getDataJson();
  643. var data = UkLabourRequestPreselectedListEntity.fromJson(json!);
  644. //重新赋值data或list
  645. return result.convert<UkLabourRequestPreselectedListEntity>(data: data);
  646. }
  647. return result.convert();
  648. }
  649. /// 预选人-添加员工的列表
  650. Future<HttpResult<UkLabourRequestPreselectAddstaffListEntity>> fetchtPreselectedAddStaffList(
  651. String? keyword,
  652. String? location,
  653. String? reQuestId,
  654. String? industryId,
  655. String? skillId,
  656. {
  657. required int curPage,
  658. CancelToken? cancelToken,
  659. }) async {
  660. //参数
  661. Map<String, String> params = {};
  662. params["cur_page"] = curPage.toString();
  663. params["page_size"] = "20";
  664. if (!Utils.isEmpty(keyword)) {
  665. params["keyword"] = keyword!;
  666. }
  667. if (!Utils.isEmpty(location)) {
  668. params["location"] = location!;
  669. }
  670. if (!Utils.isEmpty(reQuestId)) {
  671. params["request_id"] = reQuestId!;
  672. }
  673. if (!Utils.isEmpty(industryId)) {
  674. params["industry_id"] = industryId!;
  675. }
  676. if (!Utils.isEmpty(skillId)) {
  677. params["skill_id"] = skillId!;
  678. }
  679. final result = await httpProvider.requestNetResult(
  680. ApiConstants.apiLabourRequestPreSelectAddStaffListUK,
  681. params: params,
  682. cancelToken: cancelToken,
  683. );
  684. //根据返回的结果,封装原始数据为Bean/Entity对象
  685. if (result.isSuccess) {
  686. //重新赋值data或list
  687. final json = result.getDataJson();
  688. var data = UkLabourRequestPreselectAddstaffListEntity.fromJson(json!);
  689. //重新赋值data或list
  690. return result.convert<UkLabourRequestPreselectAddstaffListEntity>(data: data);
  691. }
  692. return result.convert();
  693. }
  694. //// 添加预选员工
  695. Future<HttpResult> labourRequestPreselectedAddStaffSubmit(
  696. String reQuestId,
  697. String staffIds,
  698. {
  699. CancelToken? cancelToken,
  700. }) async {
  701. //参数
  702. Map<String, String> params = {};
  703. params['request_id'] = reQuestId ?? "";
  704. params['staff_ids'] = staffIds ?? "";
  705. final result = await httpProvider.requestNetResult(
  706. ApiConstants.apiLabourRequestPreSelectAddBatchUK,
  707. method: HttpMethod.POST,
  708. params: params,
  709. networkDebounce: true,
  710. isShowLoadingDialog: true,
  711. cancelToken: cancelToken,
  712. );
  713. //根据返回的结果,封装原始数据为Bean/Entity对象
  714. if (result.isSuccess) {
  715. //重新赋值data或list
  716. return result.convert();
  717. }
  718. return result.convert();
  719. }
  720. /// 删除预选员工
  721. Future<HttpResult> labourRequestPreselectedDelete(
  722. String selectedId,
  723. {
  724. CancelToken? cancelToken,
  725. }) async {
  726. //参数
  727. Map<String, String> params = {};
  728. params['selected_id'] = selectedId ?? "";
  729. final result = await httpProvider.requestNetResult(
  730. ApiConstants.apiLabourRequestPreSelectDeleteUK,
  731. method: HttpMethod.POST,
  732. params: params,
  733. networkDebounce: true,
  734. isShowLoadingDialog: true,
  735. cancelToken: cancelToken,
  736. );
  737. //根据返回的结果,封装原始数据为Bean/Entity对象
  738. if (result.isSuccess) {
  739. //重新赋值data或list
  740. return result.convert();
  741. }
  742. return result.convert();
  743. }
  744. /// labourequest -review ------------
  745. /// 获取用工请求审核的主列表
  746. Future<HttpResult<UkLabourRequestReviewListEntity>> fetchLabourRequestReViewList({
  747. String? keyword,
  748. String? startDate,
  749. String? endDate,
  750. String? departmentId,
  751. required int curPage,
  752. CancelToken? cancelToken,
  753. }) async {
  754. //参数
  755. Map<String, String> params = {};
  756. params["cur_page"] = curPage.toString();
  757. params["page_size"] = "20";
  758. if (!Utils.isEmpty(keyword)) {
  759. params["job_title"] = keyword!;
  760. }
  761. if (!Utils.isEmpty(startDate)) {
  762. params["job_start"] = startDate!;
  763. }
  764. if (!Utils.isEmpty(endDate)) {
  765. params["job_end"] = endDate!;
  766. }
  767. if (!Utils.isEmpty(departmentId)) {
  768. params["co_department_id"] = departmentId!;
  769. }
  770. final result = await httpProvider.requestNetResult(
  771. ApiConstants.apiLabourRequestReViewListUK,
  772. params: params,
  773. cancelToken: cancelToken,
  774. );
  775. //根据返回的结果,封装原始数据为Bean/Entity对象
  776. if (result.isSuccess) {
  777. //重新赋值data或list
  778. final json = result.getDataJson();
  779. var data = UkLabourRequestReviewListEntity.fromJson(json!);
  780. //重新赋值data或list
  781. return result.convert<UkLabourRequestReviewListEntity>(data: data);
  782. }
  783. return result.convert();
  784. }
  785. /// labourrequest -review 批量审核(批量同意/批量拒绝)
  786. Future<HttpResult> labourRequestReviewBatchSubmit(
  787. {
  788. // 多个Record Ids以逗号分隔
  789. String? recordIds,
  790. // 审核类型Type【approve|reject】
  791. String? type,
  792. CancelToken? cancelToken,
  793. }) async {
  794. //参数
  795. Map<String, String> params = {};
  796. params['record_ids'] = recordIds ?? "";
  797. params['type'] = type ?? "";
  798. final result = await httpProvider.requestNetResult(
  799. ApiConstants.apiLabourRequestReViewBatchSubmitUK,
  800. method: HttpMethod.POST,
  801. params: params,
  802. networkDebounce: true,
  803. isShowLoadingDialog: true,
  804. cancelToken: cancelToken,
  805. );
  806. //根据返回的结果,封装原始数据为Bean/Entity对象
  807. if (result.isSuccess) {
  808. //重新赋值data或list
  809. return result.convert();
  810. }
  811. return result.convert();
  812. }
  813. /// 用工审核的审核流程列表
  814. Future<HttpResult<UkLabourReviewStatusEntity>> fetchLabourReviewStatusView(
  815. String? requestId, {
  816. CancelToken? cancelToken,
  817. }) async {
  818. //参数
  819. Map<String, String> params = {};
  820. params['request_id'] = requestId ?? "";
  821. final result = await httpProvider.requestNetResult(
  822. ApiConstants.apiLabourRequestStateWorkFlow,
  823. params: params,
  824. cancelToken: cancelToken,
  825. );
  826. //根据返回的结果,封装原始数据为Bean/Entity对象
  827. if (result.isSuccess) {
  828. //重新赋值data或list
  829. final json = result.getDataJson();
  830. var data = UkLabourReviewStatusEntity.fromJson(json!);
  831. //重新赋值data或list
  832. return result.convert<UkLabourReviewStatusEntity>(data: data);
  833. }
  834. return result.convert();
  835. }
  836. }