Merge branch 'JIWOO' into advc

This commit is contained in:
jiwoo 2023-11-09 17:46:34 +09:00
commit 2aed3f2f45
5 changed files with 221 additions and 11 deletions

View File

@ -581,4 +581,93 @@ public class EgovFileDownloadController {
printwriter.close(); printwriter.close();
} }
} }
/**
* 첨부파일로 등록된 파일에 대하여 다운로드 파일명을 변경하여 다운로드 한다. setDisposition(fvo.getOrignlFileNm()) 파라미터 변경
*
* @param commandMap
* @param response
* @throws Exception
*/
@RequestMapping(value = "/cmm/fms/fileNmChgDown.do")
public void cvplFileNmChgDownload(@RequestParam Map<String, Object> 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("<html>");
printwriter.println("<br><br><br><h2>Could not get file name:<br></h2>");
printwriter.println("<br><br><br><center><h3><a href='javascript: history.go(-1)'>Back</a></h3></center>");
printwriter.println("<br><br><br>&copy; webAccess");
printwriter.println("</html>");
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("<html>");
printwriter.println("<br><br><br><h2>Could not get file name:<br>" + fvo.getOrignlFileNm() + "</h2>");
printwriter.println("<br><br><br><center><h3><a href='javascript: history.go(-1)'>Back</a></h3></center>");
printwriter.println("<br><br><br>&copy; webAccess");
printwriter.println("</html>");
printwriter.flush();
printwriter.close();
}
/*}*/
}
} }

View File

@ -386,4 +386,28 @@ public class EgovFileMngController {
return "cmm/fms/selectRsltRprtFile"; 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<String, Object> commandMap, ModelMap model) throws Exception {
String atchFileId = (String) commandMap.get("param_atchFileId");
String chgNm = (String) commandMap.get("chgNm");
fileVO.setAtchFileId(atchFileId);
List<FileVO> 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";
}
} }

View File

@ -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 옥찬우 <Input> Tag id속성 추가( Line : 68 )
*
* @author 공통서비스 개발팀 이삼섭
* @since 2009.03.26
* @version 1.0
* @see
*
*/
%>
<!-- link href="<c:url value='/css/egovframework/com/com.css' />" rel="stylesheet" type="text/css"-->
<script type="text/javascript">
function fn_egov_downChgNmFile(atchFileId, fileSn){
window.open("<c:url value='/cmm/fms/fileNmChgDown.do?atchFileId="+atchFileId+"&fileSn="+fileSn+"&chgNm="+$("#chgNm").val()+"'/>");
}
/* 등록되어 있는 파일 삭제버튼 클릭시 */
function delRsltRprtFile(itemId , fileSn, rprtFileType){
if(!confirm("삭제하시겠습니까?")){
return false;
}
$.ajax({
type: "POST",
url: "<c:url value='/kccadr/oprtn/cpyrgExprnClsrm/rsltRprtfileDeleteAjax.do' />",
data:{ "atchFileId" : itemId , "fileSn" : fileSn, "eduAplctOrd" : "${eduAplctOrd}", "rprtFileType" : rprtFileType},
dataType:'json',
cache: false,
async: false,
timeout: 600000,
success: function (returnData, status) {
if(status == 'success'){
if(returnData.result == 'fail'){
alert("삭제처리가 실패하였습니다.");
}else if(returnData.result == 'auth_fail'){
alert("세션이 종료되었습니다.");
}else if(returnData.result =='success'){
$('.item_'+returnData.fmsFileVO.atchFileId+"_"+returnData.fmsFileVO.fileSn).remove();
alert("삭제되었습니다.");
window.location.reload()
}
}else{
alert("삭제처리에 실패하였습니다.");
}
},
error: function (e) {
console.log("ERROR : ", e);
alert("삭제처리에 실패하였습니다.");
}
});
}
</script>
<style type="text/css">
.cursor {
cursor: pointer;
vertical-align: middle;
}
</style>
<!-- <form name="fileForm" action="" method="post" > -->
<input type="hidden" name="atchFileId" value="${atchFileId}">
<input type="hidden" name="fileSn" >
<input type="hidden" name="fileListCnt" id="fileListCnt" value="${fileListCnt}">
<input type="hidden" name="chgNm" id="chgNm" value="${chgNm}">
<c:set var="fileCount" value="${fn:length(fileList) }" />
<!-- </form> -->
<!--<title>파일목록</title> -->
<c:forEach var="fileVO" items="${fileList}" varStatus="status">
<a href="javascript:fn_egov_downChgNmFile('<c:out value="${fileVO.atchFileId}"/>','<c:out value="${fileVO.fileSn}"/>')" class="file_download_a" title="다운로드" style="display:inline-block;">
<c:out value="${fileVO.orignlFileNm}"/>
<fmt:parseDate value="${fileVO.creatDt}" var="creatDt" pattern="yyyy-MM-dd HH:mm:ss"/>
(<fmt:formatDate value="${creatDt}" pattern="yyyy년MM월dd일"/>)
</a>
<br/>
</c:forEach>
<c:if test="${fn:length(fileList) == 0}">
</c:if>

View File

@ -160,21 +160,21 @@
<fmt:formatDate value="${sbmtPnttm}" pattern="yyyy.MM.dd"/> <fmt:formatDate value="${sbmtPnttm}" pattern="yyyy.MM.dd"/>
</c:when> --%> </c:when> --%>
<c:when test="${not empty info.sbmtPnttm}"> <c:when test="${not empty info.sbmtPnttm}">
<fmt:parseDate value="${info.sbmtPnttm}" var="sbmtPnttm" pattern="yy-MM-dd"/> <%-- <fmt:parseDate value="${info.sbmtPnttm}" var="sbmtPnttm" pattern="yy-MM-dd"/>
<fmt:formatDate value="${sbmtPnttm}" pattern="20yy.MM.dd"/> <fmt:formatDate value="${sbmtPnttm}" pattern="20yy.MM.dd"/> --%>
<%-- <c:out value="${info.sbmtPnttm}" /> --%> <c:out value="${info.sbmtPnttmDetail}" />
</c:when> </c:when>
<c:otherwise> <c:otherwise>
- -
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
</td> </td>
<th scope="row"> <%-- <th scope="row">
<p>접수종료일</p> <p>접수종료일</p>
</th> </th>
<td> <td>
<c:out value="${endPnttm}"/> <c:out value="${endPnttm}"/>
</td> </td> --%>
</tr> </tr>
<tr> <tr>
<th scope="row"> <th scope="row">
@ -389,9 +389,9 @@
<p>첨부파일</p> <p>첨부파일</p>
</th> </th>
<td class="file_download" colspan="3"> <td class="file_download" colspan="3">
<c:import url="/cmm/fms/selectRsltRprtFile.do" charEncoding="utf-8"> <c:import url="/cmm/fms/selectForNmChgFile.do" charEncoding="utf-8">
<c:param name="param_atchFileId" value="${info.oprtnFileId}" /> <c:param name="param_atchFileId" value="${info.oprtnFileId}" />
<c:param name="designTy" value="EMPTY" /> <c:param name="chgNm" value="${info.scholInsttNm}_${info.chrgNm}_신청서" />
</c:import> </c:import>
</td> </td>
</tr> </tr>

View File

@ -182,9 +182,9 @@
<p>신청일</p> <p>신청일</p>
</th> </th>
<td> <td>
<fmt:parseDate value="${info.frstRegistPnttm}" var="frstRegistPnttm" pattern="yyyy-MM-dd"/> <%-- <fmt:parseDate value="${info.frstRegistPnttm}" var="frstRegistPnttm" pattern="yyyy-MM-dd"/>
<fmt:formatDate value="${frstRegistPnttm}" pattern="yyyy.MM.dd"/> <fmt:formatDate value="${frstRegistPnttm}" pattern="yyyy.MM.dd"/> --%>
<%-- <c:out value="${info.frstRegistPnttm}" /> --%> <c:out value="${info.sbmtPnttmDetail}" />
</td> </td>
<th scope="row"> <th scope="row">
<p>결과보고일</p> <p>결과보고일</p>
@ -248,8 +248,9 @@
<p>첨부파일</p> <p>첨부파일</p>
</th> </th>
<td class="file_download"> <td class="file_download">
<c:import url="/cmm/fms/selectRsltRprtFile.do" charEncoding="utf-8"> <c:import url="/cmm/fms/selectForNmChgFile.do" charEncoding="utf-8">
<c:param name="param_atchFileId" value="${info.scholSealAtchFileId}" /> <c:param name="param_atchFileId" value="${info.scholSealAtchFileId}" />
<c:param name="chgNm" value="${info.scholInsttNm}_${info.chrgNm}_신청서" />
</c:import> </c:import>
</td> </td>
</tr> </tr>