From bd419b3f2a149a1d4a731bc8ceff996641c318c0 Mon Sep 17 00:00:00 2001 From: jiwoo Date: Thu, 9 Nov 2023 17:16:14 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=9A=B0=20-=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=EC=9E=90=20=EC=A0=80=EC=9E=91=EA=B6=8C=EC=B2=B4?= =?UTF-8?q?=ED=97=98=EA=B5=90=EC=8B=A4=20=EC=83=81=EC=84=B8=20>=20?= =?UTF-8?q?=EC=9A=B4=EC=98=81=EA=B3=84=ED=9A=8D=20=EC=B2=A8=EB=B6=80?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20?= =?UTF-8?q?=EC=8B=9C=20=ED=8C=8C=EC=9D=BC=EB=AA=85=20'=ED=95=99=EA=B5=90?= =?UTF-8?q?=5F=EA=B5=90=EC=82=AC=5F=EC=8B=A0=EC=B2=AD=EC=84=9C'=20?= =?UTF-8?q?=ED=98=95=ED=83=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cmm/web/EgovFileDownloadController.java | 89 +++++++++++++++++ .../com/cmm/web/EgovFileMngController.java | 24 +++++ .../jsp/cmm/fms/selectForNmChgFile.jsp | 96 +++++++++++++++++++ .../cpyrgExprnClsrm/oprtnAplctMngDetail.jsp | 14 +-- .../cpyrgExprnClsrm/oprtnStateMngDetail.jsp | 9 +- 5 files changed, 221 insertions(+), 11 deletions(-) create mode 100644 src/main/webapp/WEB-INF/jsp/cmm/fms/selectForNmChgFile.jsp diff --git a/src/main/java/kcc/com/cmm/web/EgovFileDownloadController.java b/src/main/java/kcc/com/cmm/web/EgovFileDownloadController.java index fe5d3973..3989e07f 100644 --- a/src/main/java/kcc/com/cmm/web/EgovFileDownloadController.java +++ b/src/main/java/kcc/com/cmm/web/EgovFileDownloadController.java @@ -581,4 +581,93 @@ public class EgovFileDownloadController { printwriter.close(); } } + + /** + * 첨부파일로 등록된 파일에 대하여 다운로드 시 파일명을 변경하여 다운로드 한다. setDisposition(fvo.getOrignlFileNm()) 파라미터 변경 + * + * @param commandMap + * @param response + * @throws Exception + */ + @RequestMapping(value = "/cmm/fms/fileNmChgDown.do") + public void cvplFileNmChgDownload(@RequestParam Map commandMap, HttpServletRequest request, HttpServletResponse response) throws Exception { + + String atchFileId = (String) commandMap.get("atchFileId"); + String fileSn = (String) commandMap.get("fileSn"); + String chgNm = (String) commandMap.get("chgNm"); //변경 할 파일명 + + /*Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();*/ + + /*if (isAuthenticated) {*/ + + FileVO fileVO = new FileVO(); + fileVO.setAtchFileId(atchFileId); + fileVO.setFileSn(fileSn); + FileVO fvo = fileService.selectFileInf(fileVO); + if(fvo == null){ + response.setContentType("application/x-msdownload"); + PrintWriter printwriter = response.getWriter(); + printwriter.println(""); + printwriter.println("


Could not get file name:

"); + printwriter.println("


Back

"); + printwriter.println("


© webAccess"); + printwriter.println(""); + printwriter.flush(); + printwriter.close(); + return ; + } + + File uFile = new File(fvo.getFileStreCours(), fvo.getStreFileNm()); + long fSize = uFile.length(); + + if (fSize > 0) { + String mimetype = "application/x-msdownload"; + + response.setContentType(mimetype); + fvo.setOrignlFileNm(chgNm+"."+fvo.getFileExtsn()); //파일명 변경 처리 + setDisposition(fvo.getOrignlFileNm(), request, response); + //response.setContentLength(fSize); + + BufferedInputStream in = null; + BufferedOutputStream out = null; + + try { + in = new BufferedInputStream(new FileInputStream(uFile)); + out = new BufferedOutputStream(response.getOutputStream()); + + FileCopyUtils.copy(in, out); + out.flush(); + } catch (Exception ex) { + LOGGER.debug("IGNORED: {}", ex.getMessage()); + } finally { + if (in != null) { + try { + in.close(); + } catch (Exception ignore) { + LOGGER.debug("IGNORED: {}", ignore.getMessage()); + } + } + if (out != null) { + try { + out.close(); + } catch (Exception ignore) { + LOGGER.debug("IGNORED: {}", ignore.getMessage()); + } + } + } + + } else { + response.setContentType("application/x-msdownload"); + + PrintWriter printwriter = response.getWriter(); + printwriter.println(""); + printwriter.println("


Could not get file name:
" + fvo.getOrignlFileNm() + "

"); + printwriter.println("


Back

"); + printwriter.println("


© webAccess"); + printwriter.println(""); + printwriter.flush(); + printwriter.close(); + } + /*}*/ + } } diff --git a/src/main/java/kcc/com/cmm/web/EgovFileMngController.java b/src/main/java/kcc/com/cmm/web/EgovFileMngController.java index c169c194..67246c8e 100644 --- a/src/main/java/kcc/com/cmm/web/EgovFileMngController.java +++ b/src/main/java/kcc/com/cmm/web/EgovFileMngController.java @@ -386,4 +386,28 @@ public class EgovFileMngController { return "cmm/fms/selectRsltRprtFile"; } + + /** + * 파일명을 변경하여 다운로드하기 위한 첨부파일 조회, 목록에 업로드 일자 추가 ex) 관리자 - 저작권체험교실 - 신청 상세 + * + * @param fileVO + * @param commandMap + * @param model + * @return + * @throws Exception + */ + @RequestMapping("/cmm/fms/selectForNmChgFile.do") + public String selectForNmChgFile(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map commandMap, ModelMap model) throws Exception { + String atchFileId = (String) commandMap.get("param_atchFileId"); + String chgNm = (String) commandMap.get("chgNm"); + + fileVO.setAtchFileId(atchFileId); + List result = fileService.selectFileInfs(fileVO); + model.addAttribute("fileList", result); + model.addAttribute("fileListCnt", result.size()); + model.addAttribute("atchFileId", atchFileId); + model.addAttribute("chgNm", chgNm); + + return "cmm/fms/selectForNmChgFile"; + } } diff --git a/src/main/webapp/WEB-INF/jsp/cmm/fms/selectForNmChgFile.jsp b/src/main/webapp/WEB-INF/jsp/cmm/fms/selectForNmChgFile.jsp new file mode 100644 index 00000000..da384f16 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/cmm/fms/selectForNmChgFile.jsp @@ -0,0 +1,96 @@ +<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> +<% + +/** + * @Class Name : selectScholSealInfs.jsp + * @Description : 파일 목록화면 + * @Modification Information + * @ + * @ 수정일 수정자 수정내용 + * @ ---------- ------ --------------------------- + * @ 2009.03.26 이삼섭 최초 생성 + * @ 2011.07.20 옥찬우 Tag id속성 추가( Line : 68 ) + * + * @author 공통서비스 개발팀 이삼섭 + * @since 2009.03.26 + * @version 1.0 + * @see + * + */ +%> + + + + + + + + + + + + + + ','')" class="file_download_a" title="다운로드" style="display:inline-block;"> + + + () + +
+
+ + + + diff --git a/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnAplctMngDetail.jsp b/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnAplctMngDetail.jsp index d706d5fd..ed585f66 100644 --- a/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnAplctMngDetail.jsp +++ b/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnAplctMngDetail.jsp @@ -160,21 +160,21 @@ --%> - - -<%-- --%> + <%-- + --%> + - - + <%--

접수종료일

- + --%> @@ -389,9 +389,9 @@

첨부파일

- + - + diff --git a/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnStateMngDetail.jsp b/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnStateMngDetail.jsp index ba0bc9d1..f6176727 100644 --- a/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnStateMngDetail.jsp +++ b/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnStateMngDetail.jsp @@ -182,9 +182,9 @@

신청일

- - - <%-- --%> + <%-- + --%> +

결과보고일

@@ -248,8 +248,9 @@

첨부파일

- + +