| | |
| | | // 删除文件 |
| | | @DeleteMapping("/deleteCNASFile") |
| | | public Result saveFile(String fileName) { |
| | | if (fileName == null || fileName.trim().isEmpty()) { |
| | | throw new ErrorException("缺少文件名"); |
| | | } |
| | | String[] split = fileName.split(","); |
| | | for (String s : split) { |
| | | FileSaveUtil.DeleteFile(s); |
| | | String name = s.trim(); |
| | | if (name.isEmpty()) { |
| | | continue; |
| | | } |
| | | // 只允许删除文件名,禁止通过路径穿越删除其他目录 |
| | | if (name.contains("/") || name.contains("\\") || name.contains("..")) { |
| | | throw new ErrorException("文件名不合法"); |
| | | } |
| | | FileSaveUtil.DeleteFile(name); |
| | | } |
| | | return Result.success(); |
| | | |
| | |
| | | |
| | | @Operation(summary = "下载人员档案卡") |
| | | @GetMapping("/exportPersonBasicInfoById") |
| | | public Result exportPersonBasicInfoById(Integer id, HttpServletResponse response) { |
| | | return Result.success(personBasicInfoService.exportPersonBasicInfoById(id,response)); |
| | | public void exportPersonBasicInfoById(Integer id, HttpServletResponse response) { |
| | | personBasicInfoService.exportPersonBasicInfoById(id, response); |
| | | } |
| | | |
| | | /** |