| | |
| | | import cn.gistack.alerts.sms.vo.SmsResultVO; |
| | | import cn.gistack.resource.feign.IOssClient; |
| | | import cn.gistack.resource.vo.MyMultipartFile; |
| | | import cn.gistack.sm.intelligentCall.service.CallService; |
| | | import cn.gistack.sm.intelligentCall.vo.CallTaskResultVO; |
| | | import cn.gistack.sm.sjztmd.entity.AttResBase; |
| | | import cn.gistack.sm.sjztmd.feign.IAttResBaseClient; |
| | | import cn.gistack.sm.sjztmd.feign.ISjztMdClient; |
| | |
| | | |
| | | private final ISmsRecordClient smsRecordClient; |
| | | |
| | | private final CallService callService; |
| | | |
| | | @Override |
| | | @GetMapping(GENERATE_DAY_REPORT_FLOOD) |
| | | public String generateDayReportFlood(String isShow) throws Exception{ |
| | | |
| | | public String generateDayReportFlood(String isShow) throws Exception { |
| | | |
| | | |
| | | //获取总览、大中库、明细数据 |
| | |
| | | vo.setResCode("0"); |
| | | List<SmsResultVO> dxyjList = smsRecordClient.smsSuccessList(vo); |
| | | |
| | | HashMap<String,String> over10Params = new HashMap<>(); |
| | | //外呼统计 |
| | | CallTaskResultVO callTaskResult = new CallTaskResultVO(); |
| | | callTaskResult.setStartTime(yesterday.format(formatter)); |
| | | callTaskResult.setEndTime(yesterday.format(formatter)); |
| | | List<CallTaskResultVO> whtjList = (List<CallTaskResultVO>) callService.getCallResultListTemp(null, callTaskResult); |
| | | |
| | | 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", "0.1"); |
| | | over10Params.put("mid_start_stag", "0.1"); |
| | | over10Params.put("big_start_stag", "0.1"); |
| | | |
| | | HashMap<String,String> normalParams = new HashMap<>(); |
| | | 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,dxyjList); |
| | | }else { |
| | | data= WordUtil.GetNotInSeasonOverInfo(totalList,dzkList,overDetailList,szInfoList,totalOverList,totalOver10List); |
| | | 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, dxyjList, whtjList); |
| | | } else { |
| | | data = WordUtil.GetNotInSeasonOverInfo(totalList, dzkList, overDetailList, szInfoList, totalOverList, totalOver10List); |
| | | |
| | | } |
| | | // 创建响应实体并设置响应头,将输出流作为响应体返回给客户端 |
| | | // InputStreamResource resource = new InputStreamResource(new ByteArrayInputStream(data)); |
| | | String time = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| | | String fileName = time + "全省水库防汛情况.docx"; |
| | | MultipartFile file = new MyMultipartFile("file",fileName, "text/plain", data); |
| | | MultipartFile file = new MyMultipartFile("file", fileName, "text/plain", data); |
| | | String path = ossClient.uploadFile(fileName, file); |
| | | return path; |
| | | } |
| | | |
| | | private void createFile(String filePath,byte[] bytes){ |
| | | private void createFile(String filePath, byte[] bytes) { |
| | | // 将byte[]写入文件 |
| | | try (FileOutputStream fos = new FileOutputStream(filePath)) { |
| | | fos.write(bytes); |