Browse Source

修改报表记录中的下载文件方法

develop
bobol 2 months ago
parent
commit
9abcb0f0a7
  1. 4
      lzbi-module/src/main/java/com/lzbi/report/controller/DcBusiReportRecordController.java
  2. 2
      lzbi-module/src/main/java/com/lzbi/report/service/DcBusiReportRecordService.java

4
lzbi-module/src/main/java/com/lzbi/report/controller/DcBusiReportRecordController.java

@ -134,10 +134,10 @@ public class DcBusiReportRecordController extends BaseController
return toAjax(dcBusiReportRecordService.deleteDcBusiReportRecordByIds(ids));
}
@ApiOperation("天气报表")
@ApiOperation("下载报表")
@PreAuthorize("@ss.hasPermi('report:reportRecord:download')")
@PostMapping("/download/{id}")
public void downloadFile(HttpServletResponse response, @PathVariable("id") Long id) throws IOException {
public void downloadFile(HttpServletResponse response, @PathVariable("id") Long id) {
dcBusiReportRecordService.downloadFile(response, id);
}
}

2
lzbi-module/src/main/java/com/lzbi/report/service/DcBusiReportRecordService.java

@ -160,7 +160,7 @@ public class DcBusiReportRecordService extends ServiceImpl<DcBusiReportRecordMap
String url = reportRecord.getUrl();
File file = new File(url);
if (!file.exists()) {
return;
throw new RuntimeException("文件不存在");
}
response.setContentType("application/octet-stream");
response.setCharacterEncoding("utf-8");

Loading…
Cancel
Save