| | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.performanceappraise.vo.*; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.employee.HrmEmployeeDO; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.performanceappraise.*; |
| | |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得绩效考核方案") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('hrm:performance-appraise:query')") |
| | | public CommonResult<HrmPerformanceAppraiseRespVO> getAppraise(@RequestParam("id") Long id) { |
| | | HrmPerformanceAppraiseDO appraise = appraiseService.getAppraise(id); |
| | | if (appraise == null) { |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得绩效考核方案分页") |
| | | @PreAuthorize("@ss.hasPermission('hrm:performance-appraise:query')") |
| | | public CommonResult<PageResult<HrmPerformanceAppraiseRespVO>> getAppraisePage(@Valid HrmPerformanceAppraisePageReqVO pageReqVO) { |
| | | PageResult<HrmPerformanceAppraiseDO> pageResult = appraiseService.getAppraisePage(pageReqVO); |
| | | if (CollUtil.isEmpty(pageResult.getList())) { |
| | |
| | | @GetMapping("/item-list") |
| | | @Operation(summary = "获得绩效考核指标列表") |
| | | @Parameter(name = "appraiseId", description = "方案编号", required = true, example = "1") |
| | | @PreAuthorize("@ss.hasPermission('hrm:performance-appraise:query')") |
| | | public CommonResult<List<HrmPerformanceAppraiseItemRespVO>> getAppraiseItemList(@RequestParam("appraiseId") Long appraiseId) { |
| | | return success(BeanUtils.toBean(appraiseService.getAppraiseItemList(appraiseId), HrmPerformanceAppraiseItemRespVO.class)); |
| | | } |
| | |
| | | |
| | | @GetMapping("/approver-ids") |
| | | @Operation(summary = "获得审批人编号集合,供前端判断是否展示审核按钮") |
| | | @PreAuthorize("@ss.hasPermission('hrm:performance-appraise:query')") |
| | | public CommonResult<Set<Long>> getApproverUserIds() { |
| | | return success(appraiseService.getAppraiseApproverUserIds()); |
| | | } |
| | |
| | | |
| | | @GetMapping("/result-page") |
| | | @Operation(summary = "获得绩效考核结果分页") |
| | | @PreAuthorize("@ss.hasPermission('hrm:performance-appraise:query')") |
| | | public CommonResult<PageResult<HrmPerformanceAppraiseResultRespVO>> getAppraiseResultPage( |
| | | @Valid HrmPerformanceAppraiseResultPageReqVO pageReqVO) { |
| | | PageResult<HrmPerformanceAppraiseResultDO> pageResult = appraiseService.getAppraiseResultPage(pageReqVO); |
| | |
| | | @Operation(summary = "获得员工考核结果(含指标明细)") |
| | | @Parameter(name = "appraiseId", description = "方案编号", required = true, example = "1") |
| | | @Parameter(name = "employeeId", description = "员工编号", required = true, example = "100") |
| | | @PreAuthorize("@ss.hasPermission('hrm:performance-appraise:query')") |
| | | public CommonResult<HrmPerformanceAppraiseResultRespVO> getAppraiseResult( |
| | | @RequestParam("appraiseId") Long appraiseId, |
| | | @RequestParam("employeeId") Long employeeId) { |
| | |
| | | }; |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "获得导入绩效考核方案模板") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | // 手动创建导出 demo |
| | | List<HrmPerformanceAppraiseImportExcelVO> list = Arrays.asList( |
| | | HrmPerformanceAppraiseImportExcelVO.builder().name("2026年8月绩效考核").periodType(1) |
| | | .period("2026-08").scopeType(1).remark("").build() |
| | | ); |
| | | // 输出 |
| | | ExcelUtils.write(response, "绩效考核方案导入模板.xls", "绩效考核方案列表", HrmPerformanceAppraiseImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入绩效考核方案") |
| | | @PreAuthorize("@ss.hasPermission('hrm:performance-appraise:import')") |
| | | public CommonResult<HrmPerformanceAppraiseImportRespVO> importExcel(@Valid HrmPerformanceAppraiseImportReqVO importReqVO) |
| | | throws Exception { |
| | | List<HrmPerformanceAppraiseImportExcelVO> list = ExcelUtils.read(importReqVO.getFile(), HrmPerformanceAppraiseImportExcelVO.class); |
| | | return success(appraiseService.importAppraiseList(list, importReqVO)); |
| | | } |
| | | |
| | | } |