import 'dart:typed_data'; import 'package:domain/entity/response/job_applied_index_s_g_entity.dart'; import 'package:domain/entity/response/job_applied_list_s_g_entity.dart'; import 'package:domain/entity/response/job_list_add_staff_entity.dart'; import 'package:domain/entity/response/job_list_applied_edit_entity.dart'; import 'package:domain/entity/response/job_list_applied_info_entity.dart'; import 'package:domain/entity/response/job_list_applied_staff_list_entity.dart'; import 'package:domain/entity/response/job_list_applied_staff_search_entity.dart'; import 'package:domain/entity/response/job_list_detail_entity.dart'; import 'package:domain/entity/response/job_list_entity.dart'; import 'package:domain/entity/response/job_list_index_entity.dart'; import 'package:domain/entity/response/job_list_remark_view_entity.dart'; import 'package:domain/entity/response/revise_list_s_g_entity.dart'; import 'package:domain/entity/response/revise_log_s_g_entity.dart'; import 'package:domain/entity/response/staff_detail_entity.dart'; import 'package:domain/entity/response/staff_detail_s_g_entity.dart'; import 'package:domain/entity/response/staff_labour_history_entity.dart'; import 'package:domain/entity/response/staff_remark_history_entity.dart'; import 'package:domain/entity/response/staff_review_history_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/add_edit_revise_view_s_g_entity.dart'; import '../entity/response/attendance_entity.dart'; import '../entity/response/check_success_entity.dart'; import '../entity/response/job_applied_edit_index_s_g_entity.dart'; import '../entity/response/job_applied_remark_view_s_g_entity.dart'; import '../entity/response/job_applied_staff_s_g_entity.dart'; import '../entity/response/job_list_applied_work_flow_entity.dart'; import '../entity/response/revise_index_s_g_entity.dart'; import '../entity/response/staff_job_history_s_g_entity.dart'; /// 工作相关(新加坡) class JobSGRepository extends GetxService { HttpProvider httpProvider; JobSGRepository({required this.httpProvider}); /// 获取工作已申请的选项 Future> fetchJobAppliedIndex( String? jobId, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params["job_id"] = jobId ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedIndexSG, params: params, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = JobAppliedIndexSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// 获取工作已申请的列表 Future> fetchJobAppliedList( String? jobId, String? status, String? keyword, { required int curPage, CancelToken? cancelToken, }) async { //参数 Map params = {}; params["cur_page"] = curPage.toString(); params["page_size"] = "10"; params["job_id"] = jobId ?? ""; if (!Utils.isEmpty(keyword)) { params["keyword"] = keyword!; } if (!Utils.isEmpty(status)) { params["status"] = status!; } final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedListSG, params: params, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = JobAppliedListSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// 根据ID获取主列表的Item数据,用于刷新Item Future> fetchItemByAppliedIds( String? jobId, String? appliedIds, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params["cur_page"] = "1"; params["page_size"] = "9999"; if (!Utils.isEmpty(appliedIds)) { params["applied_ids"] = appliedIds!; } if (!Utils.isEmpty(jobId)) { params["job_id"] = jobId!; } final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedListSG, params: params, isShowLoadingDialog: true, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = JobAppliedListSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// 获取工作已申请的列表中添加的员工搜索 Future> searchJobAppliedStaff( String? jobId, String? keyword, { required int curPage, CancelToken? cancelToken, }) async { //参数 Map params = {}; params["cur_page"] = curPage.toString(); params["page_size"] = "20"; params["job_id"] = jobId ?? ""; if (!Utils.isEmpty(keyword)) { params["keyword"] = keyword!; } final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedSearchStaffSG, params: params, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = JobAppliedStaffSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// 添加员工到申请列表 Future addStaff2AppliedJob( String? jobId, String? staffIds, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['job_id'] = jobId ?? ""; params['staff_ids'] = staffIds ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedAddStaffSubmitSG, 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 batchEditJobApplied( String? jobId, String? appliedIds, String? startTime, String? endTime, String? subtractHours, String? status, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['applied_ids'] = appliedIds ?? ""; params['job_id'] = jobId ?? ""; if (!Utils.isEmpty(startTime)) { params['start_time'] = startTime ?? ""; } if (!Utils.isEmpty(endTime)) { params['end_time'] = endTime ?? ""; } if (!Utils.isEmpty(subtractHours)) { params['subtract_hours'] = subtractHours ?? ""; } if (!Utils.isEmpty(status)) { params['status'] = status ?? ""; } final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedBatchEditSG, 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> fetchEditJobAppliedIndex( String? appliedId, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['applied_id'] = appliedId ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedEditViewSG, params: params, isShowLoadingDialog: true, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = JobAppliedEditIndexSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// 编辑员工信息或考勤的提交 Future submitEditJobApplied( String? appliedId, String? startTime, String? endTime, String? security_in, String? security_out, String? work_in, String? work_out, String? adjustHours, String? status, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['applied_id'] = appliedId ?? ""; params['start_time'] = startTime ?? ""; params['end_time'] = endTime ?? ""; if (!Utils.isEmpty(security_in)) { params['security_in'] = security_in ?? ""; } if (!Utils.isEmpty(security_out)) { params['security_out'] = security_out ?? ""; } if (!Utils.isEmpty(work_in)) { params['work_in'] = work_in ?? ""; } if (!Utils.isEmpty(work_out)) { params['work_out'] = work_out ?? ""; } if (!Utils.isEmpty(adjustHours)) { params['adjust_hours'] = adjustHours ?? ""; } if (!Utils.isEmpty(status)) { params['status'] = status ?? ""; } final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedEditSubmitSG, 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 submitEditAppliedStatus( String? appliedId, String? status, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['applied_id'] = appliedId ?? ""; params['status'] = status ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedChangeStatusSG, 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> fetchJobAppliedRemarkView( String? appliedId, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['applied_id'] = appliedId ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedRemarkViewSG, params: params, isShowLoadingDialog: true, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = JobAppliedRemarkViewSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// 提交员工的评价 Future submitAppliedRemark( String? appliedId, String? attitude_rate, String? grooming_rate, String? performance_rate, String? experience_rate, String? feedback, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['applied_id'] = appliedId ?? ""; params['attitude_rate'] = (double.parse(attitude_rate ?? "5.0")).toInt().toString(); params['grooming_rate'] = (double.parse(grooming_rate ?? "5.0")).toInt().toString(); params['performance_rate'] = (double.parse(performance_rate ?? "5.0")).toInt().toString(); params['experience_rate'] = (double.parse(experience_rate ?? "5.0")).toInt().toString(); if (!Utils.isEmpty(feedback)) { params['feedback'] = feedback ?? ""; } final result = await httpProvider.requestNetResult( ApiConstants.apiJobAppliedRemarkSubmitSG, 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> fetchStaffDetail( String? memberId, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['member_id'] = memberId ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiJobListStaffDetailSG, params: params, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = StaffDetailSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// 获取员工的做工历史列表 Future> fetchStaffJobHistory( String? memberId, { required int curPage, CancelToken? cancelToken, }) async { //参数 Map params = {}; params['member_id'] = memberId ?? ""; params['cur_page'] = curPage.toString(); params['page_size'] = "10"; final result = await httpProvider.requestNetResult( ApiConstants.apiJobListStaffLabourHistorySG, params: params, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = StaffJobHistorySGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// 获取员工的做工评价历史列表 Future> fetchStaffReviewHeadView( String? memberId, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['member_id'] = memberId ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiJobListStaffReviewHeadSG, params: params, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = StaffReviewHistorySGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// 获取员工的做工评价历史列表 Future> fetchStaffReviewHistory( String? memberId, { required int curPage, CancelToken? cancelToken, }) async { //参数 Map params = {}; params['cur_page'] = curPage.toString(); params['page_size'] = "10"; params['member_id'] = memberId ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiJobListStaffReViewHistorySG, params: params, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = StaffReviewHistorySGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// Revise 列表选项 Future> fetchReviseIndex({ CancelToken? cancelToken, }) async { final result = await httpProvider.requestNetResult( ApiConstants.apiReviseIndexSG, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = ReviseIndexSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// Revise 列表选项 Future> fetchReviseList( String? applied_id, String? status, String? keyword, String? start_date, String? end_date, { required int curPage, CancelToken? cancelToken, }) async { //参数 Map params = {}; params["cur_page"] = curPage.toString(); params["page_size"] = "10"; if (!Utils.isEmpty(applied_id)) { params["applied_id"] = applied_id!; } if (!Utils.isEmpty(status)) { params["status"] = status!; } if (!Utils.isEmpty(keyword)) { params["keyword"] = keyword!; } if (!Utils.isEmpty(start_date)) { params["start_date"] = start_date!; } if (!Utils.isEmpty(end_date)) { params["end_date"] = end_date!; } final result = await httpProvider.requestNetResult( ApiConstants.apiReviseListSG, params: params, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = ReviseListSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// 根据ID获取主列表的Item数据,用于刷新Item Future> fetchReviseListByIds( String? reviseId, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params["cur_page"] = "1"; params["page_size"] = "9999"; if (!Utils.isEmpty(reviseId)) { params["revise_id"] = reviseId!; } final result = await httpProvider.requestNetResult( ApiConstants.apiReviseListSG, params: params, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = ReviseListSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// Revise 添加选项 Future> fetchReviseAddIndex( String? applied_id, { CancelToken? cancelToken, }) async { Map params = {}; params["applied_id"] = applied_id ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiAddReviseViewSG, params: params, isShowLoadingDialog: true, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = AddEditReviseViewSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// Revise 编辑选项 Future> fetchReviseEditIndex( String? revise_id, { CancelToken? cancelToken, }) async { Map params = {}; params["revise_id"] = revise_id ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiEditReviseViewSG, params: params, isShowLoadingDialog: true, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = AddEditReviseViewSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } /// Review Add 提交 Future submitReviseAdd( String? appliedId, String? revise_hours, String? revise_msg, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['applied_id'] = appliedId ?? ""; if (!Utils.isEmpty(revise_hours)) { params['revise_hours'] = revise_hours ?? ""; } if (!Utils.isEmpty(revise_msg)) { params['revise_msg'] = revise_msg ?? ""; } final result = await httpProvider.requestNetResult( ApiConstants.apiAddReviseSubmitSG, method: HttpMethod.POST, params: params, networkDebounce: true, isShowLoadingDialog: true, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list return result.convert(); } return result.convert(); } /// Review Edit 提交 Future submitReviseEdit( String? revise_id, String? revise_hours, String? revise_msg, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['revise_id'] = revise_id ?? ""; if (!Utils.isEmpty(revise_hours)) { params['revise_hours'] = revise_hours ?? ""; } if (!Utils.isEmpty(revise_msg)) { params['revise_msg'] = revise_msg ?? ""; } final result = await httpProvider.requestNetResult( ApiConstants.apiEditReviseSubmitSG, method: HttpMethod.POST, params: params, networkDebounce: true, isShowLoadingDialog: true, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list return result.convert(); } return result.convert(); } /// Review Recall Future recallRevise( String? revise_id, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['revise_id'] = revise_id ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiRecallReviseSG, method: HttpMethod.POST, params: params, networkDebounce: true, isShowLoadingDialog: true, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list return result.convert(); } return result.convert(); } /// Review Delete Future deleteRevise( String? revise_id, { CancelToken? cancelToken, }) async { //参数 Map params = {}; params['revise_id'] = revise_id ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiDeleteReviseSG, method: HttpMethod.POST, params: params, networkDebounce: true, isShowLoadingDialog: true, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list return result.convert(); } return result.convert(); } /// Review Logs Future> fetchReviseLogs( String? revise_id, { CancelToken? cancelToken, }) async { Map params = {}; params["revise_id"] = revise_id ?? ""; final result = await httpProvider.requestNetResult( ApiConstants.apiReviseLogListSG, params: params, cancelToken: cancelToken, ); //根据返回的结果,封装原始数据为Bean/Entity对象 if (result.isSuccess) { //重新赋值data或list final json = result.getDataJson(); var data = ReviseLogSGEntity.fromJson(json!); //重新赋值data或list return result.convert(data: data); } return result.convert(); } }