| | |
| | | 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-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)); |
| | | } |
| | | |
| | | } |