| | |
| | | |
| | | import cn.gistack.sm.sjztmd.util.MyDateUtils; |
| | | import cn.gistack.sm.sjztmd.word.service.ISjztmdService; |
| | | import cn.gistack.sm.sjztmd.word.util.BriefReportUtil; |
| | | import cn.gistack.sm.sjztmd.word.util.ExcelUtil; |
| | | import cn.gistack.sm.sjztmd.word.util.WordUtil; |
| | | import cn.gistack.sm.sjztmd.word.vo.*; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.core.io.InputStreamResource; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | |
| | | |
| | | private final ISjztmdService sjztmdService; |
| | | |
| | | @GetMapping(value = "/getBriefReport") |
| | | public R getBriefReport() { |
| | | //获取总览、大中库、明细数据 |
| | | List<TotalInfo> totalList = sjztmdService.getTotalInfo(""); |
| | | return R.data(BriefReportUtil.formatTotalInfo(totalList)); |
| | | } |
| | | |
| | | @GetMapping("/download/{resGuid}") |
| | | public ResponseEntity genera(HttpServletResponse response, @PathVariable String resGuid) throws Exception { |
| | | HashMap<String,Object> obj = sjztmdService.getTbWordVO(resGuid); |
| | |
| | | |
| | | @GetMapping("/download/overFloodInfo") |
| | | public ResponseEntity overFloodInfo(String isShow) throws Exception{ |
| | | String time = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| | | String fileName = time+ "全省水库防汛情况.docx"; |
| | | String time = new SimpleDateFormat("yyyy日MM月dd日HH时").format(new Date()); |
| | | String fileName = time+ "报汛文件.docx"; |
| | | String fileNameURL = URLEncoder.encode(fileName, "UTF-8"); |
| | | //获取总览、大中库、明细数据 |
| | | List<TotalInfo> totalList = sjztmdService.getTotalInfo(isShow); |
| | |
| | | // 将临时文件添加到响应中,以便用户下载 |
| | | return ResponseEntity.ok() |
| | | .contentType(MediaType.valueOf("application/vnd.openxmlformats-officedocument.wordprocessingml.document")) // 设置响应的内容类型为二进制流(octet stream) |
| | | .header("Content-Disposition", "attachment; filename=\"" + fileNameURL) // 设置响应的Content-Disposition头,以便浏览器提示用户下载文件 |
| | | .header("Content-Disposition", "attachment; filename=" + fileNameURL) // 设置响应的Content-Disposition头,以便浏览器提示用户下载文件 |
| | | .body(resource); // 将InputStreamResource对象作为响应体 |
| | | } |
| | | |