From da6764ff726353e11aa4b10ff0065a1b1cbf4bbe Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 3 Apr 2023 10:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/sale/admin/idc/controller/IdcController.java | 11 +++++++++++ .../com/glxp/sale/admin/idc/service/IdcService.java | 2 ++ .../sale/admin/idc/service/impl/IdcServiceImpl.java | 7 ++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/IdcController.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/IdcController.java index c70bee6..5a41b38 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/IdcController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/IdcController.java @@ -1,5 +1,7 @@ package com.glxp.sale.admin.idc.controller; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; @@ -84,6 +86,15 @@ public class IdcController { return idcService.downlaodSuccess(request, params); } + @RequestMapping(value = "/spssync/common/downloadFile") + public void downloadFile(HttpServletResponse response,@RequestParam String fileName) throws UnsupportedEncodingException { + if (fileName != null) { + response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8")); + } + idcService.downloadFile(fileName, response); + } + + @RequestMapping("/mapi/**") public Object mapi(HttpServletRequest request, HttpServletResponse httpServletResponse) { String uri = uriUtils.parseUri(request.getRequestURL().toString()); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/IdcService.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/IdcService.java index a244750..4d2afad 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/IdcService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/IdcService.java @@ -3,6 +3,7 @@ package com.glxp.sale.admin.idc.service; import java.util.Map; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.springframework.web.multipart.MultipartFile; @@ -32,4 +33,5 @@ public interface IdcService { void asyncUdiTask(); void asyncSpsTask(); + void downloadFile(String fileName,HttpServletResponse response) ; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java index a31f426..7fcb61c 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java @@ -13,6 +13,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.WordUtils; @@ -407,7 +408,11 @@ public class IdcServiceImpl implements IdcService { return ResultVOUtils.error(9999, ""); } - + + @Override + public void downloadFile(String fileName,HttpServletResponse response) { + + } private void saveUploadStatus(Map params) { Map map = new HashMap();