| | |
| | | @Autowired |
| | | private CompensationPerformanceService compensationPerformanceService; |
| | | |
| | | @Autowired |
| | | private StaffOnJobMapper staffOnJobMapper; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "薪酬绩效-分页查询", businessType = BusinessType.OTHER) |
| | | @ApiOperation("薪酬绩效-分页查询") |
| | | public AjaxResult listPage(Page page, CompensationPerformance compensationPerformance){ |
| | | IPage<CompensationPerformance> listPage = compensationPerformanceService.listPage(page, compensationPerformance); |
| | | public AjaxResult listPage(Page page, String staffName, String payDateStr) { |
| | | IPage<CompensationPerformance> listPage = compensationPerformanceService.listPage(page, staffName, payDateStr); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | |
| | | @Log(title = "薪酬绩效-添加", businessType = BusinessType.INSERT) |
| | | @ApiOperation("薪酬绩效-添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody CompensationPerformance compensationPerformance){ |
| | | public AjaxResult add(@RequestBody CompensationPerformance compensationPerformance) { |
| | | boolean save = compensationPerformanceService.save(compensationPerformance); |
| | | return save ? AjaxResult.success("添加成功") : AjaxResult.error("添加失败"); |
| | | } |
| | |
| | | @Log(title = "薪酬绩效-修改", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("薪酬绩效-修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody CompensationPerformance compensationPerformance){ |
| | | public AjaxResult update(@RequestBody CompensationPerformance compensationPerformance) { |
| | | boolean update = compensationPerformanceService.updateById(compensationPerformance); |
| | | return update ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败"); |
| | | } |
| | |
| | | @Log(title = "薪酬绩效-删除", businessType = BusinessType.DELETE) |
| | | @ApiOperation("薪酬绩效-删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | boolean delete = compensationPerformanceService.removeBatchByIds(ids); |
| | | return delete ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败"); |
| | | } |
| | | |
| | | @Log(title = "导出薪资管理列表", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response ) { |
| | | List<CompensationPerformance> list = compensationPerformanceService.list(); |
| | | ExcelUtil<CompensationPerformance> util = new ExcelUtil<CompensationPerformance>(CompensationPerformance.class); |
| | | public void export(HttpServletResponse response) { |
| | | List<CompensationPerformance> list = compensationPerformanceService.exportList(); |
| | | ExcelUtil<CompensationPerformance> util = new ExcelUtil<>(CompensationPerformance.class); |
| | | util.exportExcel(response, list, "导出薪资管理列表"); |
| | | } |
| | | |
| | |
| | | util.exportExcel(response, list, "下载薪资管理列表模板"); |
| | | } |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Log(title = "导入薪资管理列表", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | ExcelUtil<CompensationPerformance> util = new ExcelUtil<>(CompensationPerformance.class); |
| | | List<CompensationPerformance> list = util.importExcel(file.getInputStream()); |
| | | list.forEach(item->{ |
| | | SysUser staffOnJob = sysUserMapper.selectUserByNickName(item.getName()); |
| | | if(staffOnJob!=null){ |
| | | item.setStaffId(staffOnJob.getUserId()); |
| | | list.forEach(item -> { |
| | | StaffOnJob staffOnJob = staffOnJobMapper.selectStaffByNickName(item.getStaffName()); |
| | | if (staffOnJob != null) { |
| | | item.setStaffId(staffOnJob.getId()); |
| | | } |
| | | }); |
| | | boolean b = compensationPerformanceService.saveBatch(list); |