12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121 |
- import 'dart:typed_data';
- import 'package:domain/entity/response/job_list_edit_index_s_g_entity.dart';
- import 'package:domain/entity/response/job_list_index_s_g_entity.dart';
- import 'package:domain/entity/response/job_template_edit_index_entity.dart';
- import 'package:domain/entity/response/job_template_s_g_entity.dart';
- import 'package:domain/entity/response/job_title_edit_index_entity.dart';
- import 'package:domain/entity/response/job_title_s_g_entity.dart';
- import 'package:domain/entity/response/labour_request_s_g_add_index_entity.dart';
- import 'package:domain/entity/response/labour_request_s_g_entity.dart';
- import 'package:get/get.dart';
- import 'package:plugin_platform/dio_export.dart';
- import 'package:plugin_platform/http/http_provider.dart';
- import 'package:plugin_platform/http/http_result.dart';
- import 'package:shared/utils/util.dart';
- import '../constants/api_constants.dart';
- import '../entity/response/job_list_s_g_entity.dart';
- import '../entity/response/labour_request_index_entity.dart';
- import '../entity/response/labour_request_s_g_edit_index_entity.dart';
- import '../entity/response/labour_request_s_g_list_entity.dart';
- /// 用工相关(新加坡)
- class LabourSGRepository extends GetxService {
- HttpProvider httpProvider;
- LabourSGRepository({required this.httpProvider});
- /// 用工模版中的工作标题列表
- Future<HttpResult<JobTitleSGEntity>> fetchJobTitleList(
- String? keyword, {
- required int curPage,
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params["cur_page"] = curPage.toString();
- params["page_size"] = "10";
- if (Utils.isNotEmpty(keyword)) {
- params["keyword"] = keyword!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTitleListSG,
- params: params,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobTitleSGEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobTitleSGEntity>(data: data);
- }
- return result.convert();
- }
- /// 根据ID获取主列表的Item数据,用于刷新Item
- Future<HttpResult<JobTitleSGEntity>> fetchJobTitleListByIds(
- String? ids, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params["cur_page"] = "1";
- params["page_size"] = "9999";
- if (!Utils.isEmpty(ids)) {
- params["job_title_id"] = ids!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTitleListSG,
- params: params,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobTitleSGEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobTitleSGEntity>(data: data);
- }
- return result.convert();
- }
- /// 添加工作标题的详情或选项数据
- Future<HttpResult<JobTitleEditIndexEntity>> fetchJobTitleAddIndex({
- CancelToken? cancelToken,
- }) async {
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTitleAddIndexSG,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobTitleEditIndexEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobTitleEditIndexEntity>(data: data);
- }
- return result.convert();
- }
- /// 编辑工作标题的详情或选项数据
- Future<HttpResult<JobTitleEditIndexEntity>> fetchJobTitleEditIndex(
- String? titleId, {
- CancelToken? cancelToken,
- }) async {
- Map<String, String> params = {};
- params["title_id"] = titleId ?? "";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTitleEditIndexSG,
- params: params,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobTitleEditIndexEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobTitleEditIndexEntity>(data: data);
- }
- return result.convert();
- }
- /// 添加工作标题的提交
- Future<HttpResult> addJobTitleSubmit(
- String? jobTitle,
- String? sort,
- String? templateId, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['job_title'] = jobTitle ?? "";
- if (!Utils.isEmpty(templateId)) {
- params["template_id"] = templateId!;
- }
- if (!Utils.isEmpty(sort)) {
- params["sort"] = sort!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTitleAddSubmitSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- /// 编辑工作标题的提交
- Future<HttpResult> editJobTitleSubmit(
- String? titleId,
- String? jobTitle,
- String? sort,
- String? templateId, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['job_title'] = jobTitle ?? "";
- params['title_id'] = titleId ?? "";
- if (!Utils.isEmpty(templateId)) {
- params["template_id"] = templateId!;
- }
- if (!Utils.isEmpty(sort)) {
- params["sort"] = sort!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTitleEditSubmitSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- /// 删除工作标题的提交
- Future<HttpResult> deleteJobTitleSubmit(
- String? titleId, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['title_id'] = titleId ?? "";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTitleDeleteSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- // =================================== Template ↓ ===================================
- /// 用工模版中的工作标题列表
- Future<HttpResult<JobTemplateSGEntity>> fetchJobTemplateList(
- String? keyword, {
- required int curPage,
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params["cur_page"] = curPage.toString();
- params["page_size"] = "10";
- if (!Utils.isEmpty(keyword)) {
- params["keyword"] = keyword!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTemplateListSG,
- params: params,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobTemplateSGEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobTemplateSGEntity>(data: data);
- }
- return result.convert();
- }
- /// 根据ID获取主列表的Item数据,用于刷新Item
- Future<HttpResult<JobTemplateSGEntity>> fetchJobTemplateListByIds(
- String? ids, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params["cur_page"] = "1";
- params["page_size"] = "9999";
- if (!Utils.isEmpty(ids)) {
- params["job_temp_id"] = ids!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTemplateListSG,
- params: params,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobTemplateSGEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobTemplateSGEntity>(data: data);
- }
- return result.convert();
- }
- /// 添加工作模板的详情或选项数据
- Future<HttpResult<JobTemplateEditIndexEntity>> fetchJobTemplateAddIndex({
- CancelToken? cancelToken,
- }) async {
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTemplateAddIndexSG,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobTemplateEditIndexEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobTemplateEditIndexEntity>(data: data);
- }
- return result.convert();
- }
- /// 编辑工作模板的详情或选项数据
- Future<HttpResult<JobTemplateEditIndexEntity>> fetchJobTemplateEditIndex(
- String? templateId, {
- CancelToken? cancelToken,
- }) async {
- Map<String, String> params = {};
- params["template_id"] = templateId ?? "";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTemplateEditIndexSG,
- params: params,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobTemplateEditIndexEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobTemplateEditIndexEntity>(data: data);
- }
- return result.convert();
- }
- /// 添加工作模板的提交
- Future<HttpResult> addJobTemplateSubmit(
- String? name,
- String? contact,
- String? contactNo,
- String? description,
- String? note,
- String? age,
- String? sex,
- String? withFoodCert,
- String? language, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['name'] = name ?? "";
- if (!Utils.isEmpty(contact)) {
- params["contact"] = contact!;
- }
- if (!Utils.isEmpty(contactNo)) {
- params["contact_no"] = contactNo!;
- }
- if (!Utils.isEmpty(description)) {
- params["description"] = description!;
- }
- if (!Utils.isEmpty(note)) {
- params["note"] = note!;
- }
- if (!Utils.isEmpty(age)) {
- params["age"] = age!;
- }
- if (!Utils.isEmpty(sex)) {
- params["sex"] = sex!;
- }
- if (!Utils.isEmpty(withFoodCert)) {
- params["with_food_cert"] = withFoodCert!;
- }
- if (!Utils.isEmpty(language)) {
- params["language"] = language!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTemplateAddSubmitSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- /// 编辑工作模板的提交
- Future<HttpResult> editJobTemplateSubmit(
- String? templateId,
- String? name,
- String? contact,
- String? contactNo,
- String? description,
- String? note,
- String? age,
- String? sex,
- String? withFoodCert,
- String? language, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['name'] = name ?? "";
- params['template_id'] = templateId ?? "";
- if (!Utils.isEmpty(contact)) {
- params["contact"] = contact!;
- }
- if (!Utils.isEmpty(contactNo)) {
- params["contact_no"] = contactNo!;
- }
- if (!Utils.isEmpty(description)) {
- params["description"] = description!;
- }
- if (!Utils.isEmpty(note)) {
- params["note"] = note!;
- }
- if (!Utils.isEmpty(age)) {
- params["age"] = age!;
- }
- if (!Utils.isEmpty(sex)) {
- params["sex"] = sex!;
- }
- if (!Utils.isEmpty(withFoodCert)) {
- params["with_food_cert"] = withFoodCert!;
- }
- if (!Utils.isEmpty(language)) {
- params["language"] = language!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTemplateEditSubmitSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- /// 删除工作标题的提交
- Future<HttpResult> deleteJobTemplateSubmit(
- String? templateId, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['template_id'] = templateId ?? "";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobTemplateDeleteSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- /// 用工请求的首页数据
- Future<HttpResult<LabourRequestSGCountList?>> fetchLabourRequestMain(
- String? date, {
- CancelToken? cancelToken,
- }) async {
- Map<String, String> params = {};
- if (Utils.isNotEmpty(date)) {
- params["date"] = date ?? "";
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiLabourRequestMainSG,
- params: params,
- cancelToken: cancelToken,
- );
- // //根据返回的结果,封装原始数据为Bean/Entity对象
- // if (result.isSuccess) {
- // //重新赋值data或list
- // final json = result.getDataJson();
- // var data = LabourRequestSGEntity.fromJson(json!);
- // //重新赋值data或list
- // return result.convert<LabourRequestSGEntity>(data: data);
- // }
- // return result.convert();
- if (result.isSuccess) {
- var jsonList = result.getListJson();
- var list = jsonList?.map((e) {
- if (e is Map<String, dynamic>) {
- return LabourRequestSGCountList.fromJson(e);
- } else {
- return null;
- }
- }).toList();
- return result.convert<LabourRequestSGCountList?>(list: list);
- }
- return result.convert<LabourRequestSGCountList>();
- }
- /// 添加用工请求的选项数据
- Future<HttpResult<LabourRequestSGAddIndexEntity>> fetchLabourRequestAddIndex({
- bool isShowLoadingDialog = true,
- CancelToken? cancelToken,
- }) async {
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiLabourRequestAddIndexSG,
- isShowLoadingDialog: isShowLoadingDialog,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = LabourRequestSGAddIndexEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<LabourRequestSGAddIndexEntity>(data: data);
- }
- return result.convert();
- }
- //用工请求的查询选项(Job List)
- Future<HttpResult<JobListIndexSGEntity>> fetchJobListIndex({
- CancelToken? cancelToken,
- }) async {
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobListIndexSG,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobListIndexSGEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobListIndexSGEntity>(data: data);
- }
- return result.convert();
- }
- //用工请求的查询列表(Job List)
- Future<HttpResult<JobListSGEntity>> fetchJobListTable(
- String? startDate,
- String? endDate,
- String? status,
- String? outletId, {
- required int curPage,
- CancelToken? cancelToken,
- }) async {
- Map<String, String> params = {};
- if (Utils.isNotEmpty(startDate)) {
- params['start_date'] = startDate ?? "";
- }
- if (Utils.isNotEmpty(endDate)) {
- params['end_date'] = endDate ?? "";
- }
- if (Utils.isNotEmpty(status)) {
- params['status'] = status ?? "";
- }
- if (Utils.isNotEmpty(outletId)) {
- params['outlet_id'] = outletId ?? "";
- }
- params['cur_page'] = curPage.toString();
- params['page_size'] = "10";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobListTableSG,
- params: params,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobListSGEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobListSGEntity>(data: data);
- }
- return result.convert();
- }
- /// 根据ID获取主列表的Item数据,用于刷新Item
- Future<HttpResult<JobListSGEntity>> fetchJobListByIds(
- String? jobId, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params["cur_page"] = "1";
- params["page_size"] = "9999";
- if (!Utils.isEmpty(jobId)) {
- params["job_id"] = jobId!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobListTableSG,
- params: params,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobListSGEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobListSGEntity>(data: data);
- }
- return result.convert();
- }
- //用工请求的编辑详情(Job List)
- Future<HttpResult<JobListEditIndexSGEntity>> fetchJobListEditIndex(
- String? jobId, {
- CancelToken? cancelToken,
- }) async {
- Map<String, String> params = {};
- params['job_id'] = jobId ?? "";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobListEditIndexSG,
- params: params,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = JobListEditIndexSGEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<JobListEditIndexSGEntity>(data: data);
- }
- return result.convert();
- }
- //用工请求的编辑提交(Job List)
- Future<HttpResult> editJobListSubmit(
- String? jobId,
- String? startTime,
- String? endTime,
- String? outletId,
- int sexLimit,
- String? maleLimit,
- String? femaleLimit,
- String? needNum,
- String? requestType,
- String? remark, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['job_id'] = jobId ?? "";
- params['start_time'] = startTime ?? "";
- params['end_time'] = endTime ?? "";
- params['outlet_id'] = outletId ?? "";
- params['sex_limit'] = sexLimit.toString();
- if (sexLimit == 1) {
- params['male_limit'] = maleLimit ?? "0";
- params['female_limit'] = femaleLimit ?? "0";
- // params['need_num'] = (int.parse(maleLimit ?? "0") + int.parse(femaleLimit ?? "0")).toString();
- } else {
- params['need_num'] = needNum ?? "0";
- }
- if (Utils.isNotEmpty(requestType)) {
- params['request_type'] = requestType ?? "";
- }
- if (Utils.isNotEmpty(remark)) {
- params['remark'] = remark ?? "";
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobListEditSubmitSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- //用工请求的取消(Job List)
- Future<HttpResult> cancelJobList(
- String? jobId, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['job_id'] = jobId ?? "";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobListCancelSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- //用工请求的删除(Job List)
- Future<HttpResult> deleteJobList(
- String? jobId, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['job_id'] = jobId ?? "";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobListDeleteSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- //用工请求的考勤确认(Job List)
- Future<HttpResult> confirmJobList(
- String? jobId, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['job_id'] = jobId ?? "";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiJobListConfirmSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- // V2 - 新版的LabourRequest 改动
- /// 获取用工请求的筛选选项
- Future<HttpResult<LabourRequestIndexEntity>> fetchLabourRequestSGIndex({
- CancelToken? cancelToken,
- }) async {
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiLabourRequestIndex,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = LabourRequestIndexEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<LabourRequestIndexEntity>(data: data);
- }
- return result.convert();
- }
- /// 获取用工请求的主列表
- Future<HttpResult<LabourRequestSGListEntity>> fetchLabourRequestSGList(
- String? keyword,
- String? startDate,
- String? endDate,
- String? statusId,
- String? departmentId, {
- required int curPage,
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params["cur_page"] = curPage.toString();
- params["page_size"] = "20";
- if (!Utils.isEmpty(keyword)) {
- params["job_title"] = keyword!;
- }
- if (!Utils.isEmpty(startDate)) {
- params["job_start"] = startDate!;
- }
- if (!Utils.isEmpty(endDate)) {
- params["job_end"] = endDate!;
- }
- if (!Utils.isEmpty(statusId)) {
- params["status"] = statusId!;
- }
- if (!Utils.isEmpty(departmentId)) {
- params["outlet_id"] = departmentId!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiLabourRequestList,
- params: params,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = LabourRequestSGListEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<LabourRequestSGListEntity>(data: data);
- }
- return result.convert();
- }
- /// 根据ID获取主列表的Item数据,用于刷新Item
- Future<HttpResult<LabourRequestSGListEntity>> fetchItemByRequestId(
- String? requestId, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params["cur_page"] = "1";
- params["page_size"] = "1";
- if (!Utils.isEmpty(requestId)) {
- params["request_id"] = requestId!;
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiLabourRequestList,
- params: params,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = LabourRequestSGListEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<LabourRequestSGListEntity>(data: data);
- }
- return result.convert();
- }
- /// 删除工作标题的提交
- Future<HttpResult> submitLabourRequestAdd(
- String? jobTitleId,
- String? startTime,
- String? endTime,
- String? repeatStart,
- String? repeatEnd,
- String? outletId,
- int sexLimit,
- String? maleLimit,
- String? femaleLimit,
- String? needNum,
- String? requestType,
- String? remark, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['job_title_id'] = jobTitleId ?? "";
- params['start_time'] = startTime ?? "";
- params['end_time'] = endTime ?? "";
- params['outlet_id'] = outletId ?? "";
- params['sex_limit'] = sexLimit.toString();
- if (sexLimit == 1) {
- params['male_limit'] = maleLimit ?? "0";
- params['female_limit'] = femaleLimit ?? "0";
- // params['need_num'] = (int.parse(maleLimit ?? "0") + int.parse(femaleLimit ?? "0")).toString(); //不传 need_num 字段
- } else {
- params['need_num'] = needNum ?? "0";
- }
- if (Utils.isNotEmpty(repeatStart)) {
- params['repeat_start'] = repeatStart ?? "";
- }
- if (Utils.isNotEmpty(repeatEnd)) {
- params['repeat_end'] = repeatEnd ?? "";
- }
- if (Utils.isNotEmpty(requestType)) {
- params['request_type'] = requestType ?? "";
- }
- if (Utils.isNotEmpty(remark)) {
- params['remark'] = remark ?? "";
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiLabourRequestAddSubmitSG,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- /// 用工的编辑详情
- Future<HttpResult<LabourRequestSGEditIndexEntity>> fetchLabourRequestEditDetail(
- String? requestId, {
- bool isShowLoadingDialog = true,
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['request_id'] = requestId ?? "";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiLabourRequestEditDetail,
- params: params,
- isShowLoadingDialog: isShowLoadingDialog,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- final json = result.getDataJson();
- var data = LabourRequestSGEditIndexEntity.fromJson(json!);
- //重新赋值data或list
- return result.convert<LabourRequestSGEditIndexEntity>(data: data);
- }
- return result.convert();
- }
- /// 编辑工作标题的提交
- Future<HttpResult> submitLabourRequestEdit(
- String? requestId,
- String? startTime,
- String? endTime,
- String? outletId,
- int sexLimit,
- String? maleLimit,
- String? femaleLimit,
- String? needNum,
- String? requestType,
- String? remark, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['request_id'] = requestId ?? "";
- params['start_time'] = startTime ?? "";
- params['end_time'] = endTime ?? "";
- params['outlet_id'] = outletId ?? "";
- params['sex_limit'] = sexLimit.toString();
- if (sexLimit == 1) {
- params['male_limit'] = maleLimit ?? "0";
- params['female_limit'] = femaleLimit ?? "0";
- // params['need_num'] = (int.parse(maleLimit ?? "0") + int.parse(femaleLimit ?? "0")).toString(); //不传 need_num 字段
- } else {
- params['need_num'] = needNum ?? "0";
- }
- if (Utils.isNotEmpty(requestType)) {
- params['request_type'] = requestType ?? "";
- }
- if (Utils.isNotEmpty(remark)) {
- params['remark'] = remark ?? "";
- }
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiLabourRequestEditSubmit,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- /// 删除新加坡的用工请求
- Future<HttpResult> deleteLabourRequestSG(
- String? requestId, {
- CancelToken? cancelToken,
- }) async {
- //参数
- Map<String, String> params = {};
- params['request_id'] = requestId ?? "";
- final result = await httpProvider.requestNetResult(
- ApiConstants.apiLabourRequestDelete,
- method: HttpMethod.POST,
- params: params,
- networkDebounce: true,
- isShowLoadingDialog: true,
- cancelToken: cancelToken,
- );
- //根据返回的结果,封装原始数据为Bean/Entity对象
- if (result.isSuccess) {
- //重新赋值data或list
- return result.convert();
- }
- return result.convert();
- }
- }
|