package com.engine.salary.web; import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam; import com.engine.salary.service.AttendQuoteService; import com.engine.salary.service.impl.AttendQuoteServiceImpl; import com.engine.salary.util.ResponseResult; import io.swagger.v3.oas.annotations.parameters.RequestBody; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import java.util.Map; public class AttendQuoteController { private AttendQuoteService getService(User user) { return (AttendQuoteService) ServiceUtil.getService(AttendQuoteServiceImpl.class, user); } /** * 考勤数据列表 */ @GET @Path("/list") @Produces(MediaType.APPLICATION_JSON) public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteQueryParam queryParam) { User user = HrmUserVarify.getUser(request, response); Map map = ParamUtil.request2Map(request); map.put("queryParam", queryParam); return ResponseResult.run(getService(user)::list, map); } // /** // * 获取引用考勤表单 // * @return // */ // @GetMapping("/getSyncForm") // @ApiOperation("获取引用考勤表单") // @WeaPermission // public WeaResult getSyncForm() { // return WeaResult.success(service.getSyncForm(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); // } // // /** // * 获取薪资周期和考勤周期 // * @param salaryYearMonth 薪资所属月 // * @param salarySobId 薪资账套id // * @return // */ // @PostMapping("/getSalaryCycleAndAttendCycle") // @ApiOperation("获取薪资周期和考勤周期") // @WeaPermission // public WeaResult> getSalaryCycleAndAttendCycle(@RequestParam(value = "salaryYearMonth") YearMonth salaryYearMonth, @RequestParam(value = "salarySobId") Long salarySobId) { // return WeaResult.success(service.getSalaryCycleAndAttendCycle(salaryYearMonth, salarySobId, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); // } // // /** // * 同步引用考勤数据 // * @return // */ // @PostMapping("/syncAttendQuoteData") // @ApiOperation("同步引用考勤数据") // @WeaPermission // public WeaResult syncAttendQuoteData(@RequestBody AttendQuoteDataSyncParam syncParam) { // return attendQuoteDataService.syncAttendQuoteData(syncParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); // } // // /** // * 获取薪资账套下拉列表 // * @return // */ // @GetMapping("/selectSalarySobList") // @ApiOperation("获取薪资账套下拉列表") // @WeaPermission // public WeaResult>> selectSalarySobList() { // return WeaResult.success(service.selectSalarySobList(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); // } // // /** // * 下载导入模板 // * @return // */ // @PostMapping("/downloadTemplate") // @ApiOperation("下载导入模板") // @WeaPermission // public WeaResult> downloadTemplate(@RequestBody AttendQuoteDataExportTemplateParam exportParam) { // String currentTenantKey = TenantContext.getCurrentTenantKey(); // Long currentEmployeeId = UserContext.getCurrentEmployeeId(); // if (exportParam.getSalaryYearMonth()==null || exportParam.getSalarySobId()==null) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100250, "薪资所属月和薪资账套id不能为空")); // } // return WeaResult.success(attendQuoteDataService.downloadTemplate(exportParam, currentEmployeeId, currentTenantKey)); // } // // /** // * 获取导入参数 // * @return // */ // @GetMapping("/getImportParams") // @ApiOperation("获取导入参数") // @WeaPermission // public WeaResult getImportParams() { // return WeaResult.success(salaryBatchService.buildImportParam("importAttendQuoteData", // "importAttendQuoteData", // SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), 85367, "考勤引用"), // null, // null)); // } // // /** // * 查看考勤数据 // * @param queryParam // * @return // */ // @PostMapping("/view") // @ApiOperation("查看") // @WeaPermission // public WeaResult> view(@RequestBody AttendQuoteDataQueryParam queryParam) { // String currentTenantKey = TenantContext.getCurrentTenantKey(); // Long currentEmployeeId = UserContext.getCurrentEmployeeId(); // if (queryParam.getAttendQuoteId() == null) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), 100253, "考勤引用id不能为空")); // } // return WeaResult.success(attendQuoteDataService.view(queryParam, currentEmployeeId, currentTenantKey)); // } // // /** // * 删除考勤数据 // * @param ids // * @return // */ // @PostMapping("/delete") // @ApiOperation("删除") // @WeaPermission // public WeaResult delete(@RequestBody Collection ids) { // String currentTenantKey = TenantContext.getCurrentTenantKey(); // Long currentEmployeeId = UserContext.getCurrentEmployeeId(); // if (CollectionUtils.isEmpty(ids)) { // return WeaResult.fail(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 84026, "参数错误")); // } // return service.delete(ids, currentEmployeeId, currentTenantKey); // } // // /** // * 导出考勤数据 // * @param queryParam // * @return // */ // @PostMapping("/export") // @ApiOperation("导出考勤数据") // @WeaPermission // public WeaResult> export(@RequestBody AttendQuoteDataQueryParam queryParam) { // String currentTenantKey = TenantContext.getCurrentTenantKey(); // Long currentEmployeeId = UserContext.getCurrentEmployeeId(); // if (queryParam.getAttendQuoteId() == null) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), 100253, "考勤引用id不能为空")); // } // return WeaResult.success(attendQuoteDataService.export(queryParam, currentEmployeeId, currentTenantKey)); // } // // /** // * 考勤字段管理列表 // * @param queryParam // * @return // */ // @PostMapping("/fieldList") // @ApiOperation("考勤字段管理列表") // @WeaPermission // public WeaResult>> fieldList(@RequestBody AttendQuoteFieldQueryParam queryParam) { // return WeaResult.success(attendQuoteFieldService.list(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); // } // // /** // * 同步考勤模块字段 // * @return // */ // @PostMapping("/syncAttendFields") // @ApiOperation("同步考勤模块字段") // @WeaPermission // public WeaResult syncAttendFields() { // return attendQuoteFieldService.syncAttendFields(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); // } // // /** // * 获取考勤字段表单 // * @param id // * @return // */ // @GetMapping("/getFieldForm") // @ApiOperation("获取考勤字段表单") // @WeaPermission // public WeaResult getFieldForm(@RequestParam(value = "id", required = false) Long id) { // return WeaResult.success(attendQuoteFieldService.getFrom(id, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); // } // // /** // * 新建考勤字段 // * @param saveParam // * @return // */ // @PostMapping("/saveField") // @ApiOperation("新建考勤字段") // @WeaPermission // public WeaResult saveField(@RequestBody AttendQuoteFieldSaveParam saveParam) { // return attendQuoteFieldService.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); // } // // /** // * 启用/停用自定义字段 // * @param id // * @param enableStatus // * @return // */ // @PostMapping("/updateEnableStatus") // @ApiOperation("启用/停用自定义字段") // @WeaPermission // public WeaResult updateEnableStatus(@RequestParam(value = "id") Long id, @RequestParam(value = "enableStatus") Boolean enableStatus) { // return attendQuoteFieldService.updateEnableStatus(id, enableStatus, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); // } // // /** // * 修改考勤字段 // * @param saveParam // * @return // */ // @PostMapping("/updateField") // @ApiOperation("修改考勤字段") // @WeaPermission // public WeaResult updateField(@RequestBody AttendQuoteFieldSaveParam saveParam) { // return attendQuoteFieldService.update(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); // } // // /** // * 删除考勤字段 // * @param ids // * @return // */ // @PostMapping("/deleteField") // @ApiOperation("删除考勤字段") // @WeaPermission // public WeaResult deleteField(@RequestBody Collection ids) { // String currentTenantKey = TenantContext.getCurrentTenantKey(); // Long currentEmployeeId = UserContext.getCurrentEmployeeId(); // if (CollectionUtils.isEmpty(ids)) { // return WeaResult.fail(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 84026, "参数错误")); // } // return attendQuoteFieldService.delete(ids, currentEmployeeId, currentTenantKey); // } // // /** // * 数据采集-考勤引用字段设置列表 // * @param queryParam // * @return // */ // @PostMapping("/fieldSetting/list") // @ApiOperation("数据采集-考勤引用字段设置-列表") // @WeaPermission // public WeaResult> fieldSettingList(@RequestBody AttendQuoteFieldSettingQueryParam queryParam) { // return WeaResult.success(attendQuoteFieldSettingService.list(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); // } // // /** // * 数据采集-考勤引用字段设置保存 // * @param saveParam // * @return // */ // @PostMapping("/fieldSetting/save") // @ApiOperation("数据采集-考勤引用字段设置-保存") // @WeaPermission // public WeaResult fieldSettingSave(@RequestBody AttendQuoteFieldSettingSaveParam saveParam) { // return attendQuoteFieldSettingService.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); // } // // /** // * 数据采集-考勤引用字段设置-恢复默认设置 // * @return // */ // @PostMapping("/fieldSetting/recoverAsDefault") // @ApiOperation("数据采集-考勤引用字段设置-恢复默认设置") // @WeaPermission // public WeaResult> fieldSettingRecoverAsDefault(@RequestBody AttendQuoteFieldSettingRecoverParam recoverParam) { // return WeaResult.success(attendQuoteFieldSettingService.recoverAsDefault(recoverParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); // } // // /** // * 数据采集-考勤引用字段设置-设为默认设置 // * @param saveParam // * @return // */ // @PostMapping("/fieldSetting/saveAsDefault") // @ApiOperation("数据采集-考勤引用字段设置-设为默认设置") // @WeaPermission // public WeaResult fieldSettingSaveAsDefault(@RequestBody AttendQuoteFieldSettingSaveParam saveParam) { // return attendQuoteFieldSettingService.saveAsDefault(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); // } }