| | |
| | | |
| | | |
| | | |
| | | import cn.gistack.sm.sjztmd.util.MyDateUtils; |
| | | import cn.gistack.sm.sjztmd.word.service.ISjztmdService; |
| | | import cn.gistack.sm.sjztmd.word.util.ExcelUtil; |
| | | import cn.gistack.sm.sjztmd.word.util.WordUtil; |
| | |
| | | } |
| | | |
| | | @GetMapping("/download/overFloodInfo") |
| | | public ResponseEntity overFloodInfo() throws Exception{ |
| | | public ResponseEntity overFloodInfo(String isShow) throws Exception{ |
| | | String time = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| | | String fileName = time+ "全省水库防汛情况.docx"; |
| | | String fileNameURL = URLEncoder.encode(fileName, "UTF-8"); |
| | | //获取总览、大中库、明细数据 |
| | | List<TotalInfo> totalList = sjztmdService.getTotalInfo(); |
| | | List<DzkInfo> dzkList = sjztmdService.getDzkInfo(); |
| | | List<OverDetail> overDetailList = sjztmdService.getOverDetailInfo(); |
| | | List<SzInfo> szInfoList = sjztmdService.getSzInfo(); |
| | | List<TotalInfo> totalList = sjztmdService.getTotalInfo(isShow); |
| | | List<DzkInfo> dzkList = sjztmdService.getDzkInfo(isShow); |
| | | List<OverDetail> overDetailList = sjztmdService.getOverDetailInfo(isShow); |
| | | List<SzInfo> szInfoList = sjztmdService.getSzInfo(isShow); |
| | | |
| | | byte[] data = WordUtil.GetOverInfo(totalList,dzkList,overDetailList,szInfoList); |
| | | HashMap<String,String> over10Params = new HashMap<>(); |
| | | //small_start_stag=0&small_end_stag=2&mid_start_stag=0&mid_end_stag=2&big_start_stag=0&big_end_stag=2 |
| | | over10Params.put("small_start_stag", "10"); |
| | | over10Params.put("mid_start_stag", "10"); |
| | | over10Params.put("big_start_stag", "10"); |
| | | |
| | | HashMap<String,String> normalParams = new HashMap<>(); |
| | | //small_start_stag=0&small_end_stag=2&mid_start_stag=0&mid_end_stag=2&big_start_stag=0&big_end_stag=2 |
| | | normalParams.put("small_start_stag", "0"); |
| | | normalParams.put("mid_start_stag", "0"); |
| | | normalParams.put("big_start_stag", "0"); |
| | | |
| | | |
| | | List<TotalInfo> totalOverList = sjztmdService.getTotalOverInfo(isShow,normalParams); |
| | | List<TotalInfo> totalOver10List = sjztmdService.getTotalOverInfo(isShow,over10Params); |
| | | byte[] data = null; |
| | | if (MyDateUtils.isTodayInFloodSeason()){ |
| | | data = WordUtil.GetOverInfo(totalList,dzkList,overDetailList,szInfoList); |
| | | }else { |
| | | data= WordUtil.GetNotInSeasonOverInfo(totalList,dzkList,overDetailList,szInfoList,totalOverList,totalOver10List); |
| | | |
| | | } |
| | | // 创建响应实体并设置响应头,将输出流作为响应体返回给客户端 |
| | | InputStreamResource resource = new InputStreamResource(new ByteArrayInputStream(data)); |
| | | |
| | |
| | | } |
| | | |
| | | @GetMapping("/download/getOverFloodInfoExcel") |
| | | public void getOverFloodInfoExcel(HttpServletResponse response) throws Exception { |
| | | public void getOverFloodInfoExcel(HttpServletResponse response,String isShow) throws Exception { |
| | | |
| | | //获取总览、大中库、明细数据 |
| | | List<TotalInfo> totalList = sjztmdService.getTotalInfo(); |
| | | List<DzkInfo> dzkList = sjztmdService.getDzkInfo(); |
| | | List<OverDetail> overDetailList = sjztmdService.getOverDetailInfo(); |
| | | List<TotalInfo> totalList = sjztmdService.getTotalInfo(isShow); |
| | | List<DzkInfo> dzkList = sjztmdService.getDzkInfo(isShow); |
| | | List<OverDetail> overDetailList = sjztmdService.getOverDetailInfo(isShow); |
| | | |
| | | ExcelUtil.generateExcel(response,totalList,dzkList,overDetailList); |
| | | } |