Commit 2bcc04212ef904020a2b4dda4879caf26cf8ff30
1 parent
02dfba2e
险情管理导出
Showing
3 changed files
with
22 additions
and
12 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/EmergencyTaskController.java
| ... | ... | @@ -124,7 +124,7 @@ public class EmergencyTaskController { |
| 124 | 124 | emergencyExportHandler |
| 125 | 125 | ); |
| 126 | 126 | // 直接返回成功通知 |
| 127 | - return CommonResult.success("导出任务已提交,数据正在后台生成,请稍后下载"); | |
| 127 | + return CommonResult.success("数据生成中,请稍后下载"); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | @GetMapping("/export-excel-new") |
| ... | ... | @@ -135,7 +135,7 @@ public class EmergencyTaskController { |
| 135 | 135 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 136 | 136 | List<EmergencyTaskRespVO> list = emergencyTaskService.getEmergencyTaskPage(pageReqVO).getList(); |
| 137 | 137 | if (CollectionUtil.isEmpty(list)) { |
| 138 | - return null; | |
| 138 | + return CommonResult.error(1 ,"暂无数据,无法导出"); | |
| 139 | 139 | } |
| 140 | 140 | // 创建异步任务 |
| 141 | 141 | // 2. 调用调度服务创建任务 |
| ... | ... | @@ -145,6 +145,6 @@ public class EmergencyTaskController { |
| 145 | 145 | emergencyExportNewHandler |
| 146 | 146 | ); |
| 147 | 147 | // 返回成功提示 |
| 148 | - return success("导出任务已提交,数据正在后台生成,请稍后下载"); | |
| 148 | + return success("数据生成中,请稍后下载"); | |
| 149 | 149 | } |
| 150 | 150 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ExportBusiCodeEnum.java
| ... | ... | @@ -12,9 +12,9 @@ import java.time.format.DateTimeFormatter; |
| 12 | 12 | public enum ExportBusiCodeEnum { |
| 13 | 13 | |
| 14 | 14 | /** 旧版抢险案件导出 */ |
| 15 | - EMERGENCY_TASK_OLD("EmergencyTaskExcle", "险情管理", "抢险案件表", "险情案件", ".xlsx"), | |
| 15 | + EMERGENCY_TASK_OLD("EmergencyTaskExcle", "险情管理", "应急抢险列表", "抢险案件表", ".xlsx"), | |
| 16 | 16 | /** 新版抢险案件导出 */ |
| 17 | - EMERGENCY_TASK_NEW("EmergencyTaskExcleNew", "险情管理", "抢险案件表", "险情案件", ".xlsx"); | |
| 17 | + EMERGENCY_TASK_NEW("EmergencyTaskExcleNew", "险情管理", "应急抢险", "抢险案件表", ".xlsx"); | |
| 18 | 18 | |
| 19 | 19 | /** 业务编码 */ |
| 20 | 20 | private final String busiCode; | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/filedownload/FileDownloadServiceImpl.java
| ... | ... | @@ -97,15 +97,17 @@ public class FileDownloadServiceImpl implements FileDownloadService { |
| 97 | 97 | // 1. 查询下载任务记录 |
| 98 | 98 | FileDownloadDO fileDownload = fileDownloadMapper.selectById(id); |
| 99 | 99 | if (fileDownload == null) { |
| 100 | - try { | |
| 101 | - response.setContentType("text/plain;charset=UTF-8"); | |
| 102 | - response.getWriter().write("下载任务不存在"); | |
| 103 | - } catch (IOException e) { | |
| 104 | - throw exception0( 400, e.getMessage()); | |
| 105 | - } | |
| 100 | + writeMsg(response, "下载任务不存在"); | |
| 101 | + return; | |
| 102 | + } | |
| 103 | + if (fileDownload.getStatus() == 1 || fileDownload.getStatus() == 0) { | |
| 104 | + writeMsg(response, "任务正在下载中,请稍后重试"); | |
| 105 | + return; | |
| 106 | + } | |
| 107 | + if (fileDownload.getStatus() == 3) { | |
| 108 | + writeMsg(response, "导出文件异常,请重新导出"); | |
| 106 | 109 | return; |
| 107 | 110 | } |
| 108 | - | |
| 109 | 111 | // 2. 组装文件对象(替换为你DO中实际的文件路径/文件名字段) |
| 110 | 112 | String filePath = fileDownload.getFilePath(); |
| 111 | 113 | String fileName = fileDownload.getFileName(); |
| ... | ... | @@ -163,4 +165,12 @@ public class FileDownloadServiceImpl implements FileDownloadService { |
| 163 | 165 | } |
| 164 | 166 | } |
| 165 | 167 | |
| 168 | + private void writeMsg(HttpServletResponse response, String msg) { | |
| 169 | + try { | |
| 170 | + response.setContentType("text/plain;charset=UTF-8"); | |
| 171 | + response.getWriter().write(msg); | |
| 172 | + } catch (IOException e) { | |
| 173 | + throw exception0(400, e.getMessage()); | |
| 174 | + } | |
| 175 | + } | |
| 166 | 176 | } | ... | ... |