From dafe30a358698f2fbefca64042cc1850074bfe14 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Thu, 5 Nov 2020 12:33:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/bigdatamodule/save-bigdatamodule.html | 2 +- .../java/com/cm/plugin/map/pojo/dto/GridPointDTO.java | 5 ++++- .../cm/common/plugin/service/file/IFileService.java | 11 +++++++++++ .../plugin/service/file/impl/FileServiceImpl.java | 7 ++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/cloud-common-bigdata/src/main/resources/templates/bigdatamodule/save-bigdatamodule.html b/cloud-common-bigdata/src/main/resources/templates/bigdatamodule/save-bigdatamodule.html index 0f47a67..ac790e6 100644 --- a/cloud-common-bigdata/src/main/resources/templates/bigdatamodule/save-bigdatamodule.html +++ b/cloud-common-bigdata/src/main/resources/templates/bigdatamodule/save-bigdatamodule.html @@ -22,7 +22,7 @@
- +
diff --git a/cloud-common-plugin-map/src/main/java/com/cm/plugin/map/pojo/dto/GridPointDTO.java b/cloud-common-plugin-map/src/main/java/com/cm/plugin/map/pojo/dto/GridPointDTO.java index 29bb376..98f0c3e 100644 --- a/cloud-common-plugin-map/src/main/java/com/cm/plugin/map/pojo/dto/GridPointDTO.java +++ b/cloud-common-plugin-map/src/main/java/com/cm/plugin/map/pojo/dto/GridPointDTO.java @@ -3,6 +3,8 @@ package com.cm.plugin.map.pojo.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; + /** * When you feel like quitting. Think about why you started * 当你想要放弃的时候,想想当初你为何开始 @@ -14,8 +16,9 @@ import io.swagger.annotations.ApiModelProperty; * @Version: 1.0 **/ @ApiModel -public class GridPointDTO { +public class GridPointDTO implements Serializable { + private static final long serialVersionUID = -2367199018377785048L; @ApiModelProperty(name = "gridId", value = "网格ID") private String gridId; @ApiModelProperty(name = "lng", value = "经度") diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/IFileService.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/IFileService.java index a3e4817..2b31b98 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/IFileService.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/IFileService.java @@ -159,6 +159,17 @@ public interface IFileService { */ void downLoadFile(HttpServletRequest request, HttpServletResponse response, Map params) throws FileException; + /** + * 文件下载 + * + * @param request + * @param response + * @param params + * @param canRange 开启断点续传 + * @throws FileException + */ + void downLoadFile(HttpServletRequest request, HttpServletResponse response, Map params, boolean canRange) throws FileException; + /** * 百度富文本编辑器 * diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java index 77d5193..c5d13ce 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java @@ -227,6 +227,11 @@ public class FileServiceImpl extends AbstractService implements IFileService { @Override public void downLoadFile(HttpServletRequest request, HttpServletResponse response, Map params) throws FileException { + downLoadFile(request, response, params, true); + } + + @Override + public void downLoadFile(HttpServletRequest request, HttpServletResponse response, Map params, boolean canRange) throws FileException { FilePO filePO = fileDao.getFile(params); if (null == filePO) { throw new SearchException("文件获取失败"); @@ -243,7 +248,7 @@ public class FileServiceImpl extends AbstractService implements IFileService { response.setHeader("Content-Disposition", "inline;fileName=" + URLEncoder.encode(filePO.getFileName(), "UTF-8")); } String rangeString = null; - if (request != null) { + if (canRange && request != null) { rangeString = request.getHeader("Range"); LOG.debug("range: {}", rangeString); }