| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")) + "_" + file.getOriginalFilename(); |
| | | urlString = realpath + "/" + pathName; |
| | | file.transferTo(new File(urlString)); |
| | | return Result.success(insReportService.inReport("/word/"+pathName, id)); |
| | | return Result.success(insReportService.inReport("/word/" + pathName, id)); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("文件上传失败"); |
| | | } |
| | |
| | | writer.write("{\"error\":0}"); |
| | | } |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "报告批量下载") |
| | | @GetMapping("/downAll") |
| | | public Result downAll(String ids) { |
| | | return Result.success(insReportService.downAll(ids)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "报告批量上传") |
| | | @PostMapping("/upAll") |
| | | public Result upAll(MultipartFile file) throws IOException { |
| | | return Result.success(insReportService.upAll(file)); |
| | | } |
| | | } |