From 52a3f301e18dc40a0704566a05f97f629a6fede0 Mon Sep 17 00:00:00 2001 From: jiwoo Date: Wed, 17 Jan 2024 12:31:19 +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=84=9C=EC=95=BD=EC=84=9C=20?= =?UTF-8?q?=EC=9D=BC=EA=B4=84=20=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eduInfo/service/VEEduMIXService.java | 2 + .../eduInfo/service/impl/VEEduMIXDAO.java | 6 +- .../service/impl/VEEduMIXServiceImpl.java | 4 + .../web/OprtnAplctMngController.java | 284 ++++++++++-------- .../sqlmap/ve/edu/VEEdu_MIX_SQL_Tibero.xml | 15 + .../cpyrgExprnClsrm/oprtnAplctMngDetail.jsp | 12 + .../cpyrgExprnClsrm/oprtnAplctMngList.jsp | 42 ++- .../cpyrgExprnClsrm/oprtnStateMngDetail.jsp | 12 + .../cpyrgExprnClsrm/oprtnStateMngList.jsp | 36 +++ .../WEB-INF/jsp/web/my/myPageDashBoard.jsp | 2 +- .../exprnClsrmInfo/eduInfo.jsp | 2 +- 11 files changed, 279 insertions(+), 138 deletions(-) diff --git a/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/VEEduMIXService.java b/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/VEEduMIXService.java index 0abc0de3..20582fb9 100644 --- a/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/VEEduMIXService.java +++ b/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/VEEduMIXService.java @@ -105,4 +105,6 @@ public interface VEEduMIXService { List selectCndtnList(VEEduAplctVO paramVO); List selectAdultRsltRprtList(VEEduAplctVO paramVO) throws Exception; + + List selectExprnAtchFileDownList(VEEduAplctVO paramVO) throws Exception; } diff --git a/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/impl/VEEduMIXDAO.java b/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/impl/VEEduMIXDAO.java index dcf3b791..39c0997c 100644 --- a/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/impl/VEEduMIXDAO.java +++ b/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/impl/VEEduMIXDAO.java @@ -261,5 +261,9 @@ public class VEEduMIXDAO extends EgovAbstractDAO { return tlist; } - + public List selectExprnAtchFileDownList(VEEduAplctVO paramVO) throws Exception { + @SuppressWarnings("unchecked") + List tlist = (List) list("VEEduMIXDAO.selectExprnAtchFileDownList", paramVO); + return tlist; + } } diff --git a/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/impl/VEEduMIXServiceImpl.java b/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/impl/VEEduMIXServiceImpl.java index dfd4f861..37c90706 100644 --- a/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/impl/VEEduMIXServiceImpl.java +++ b/src/main/java/kcc/ve/instr/tngrVisitEdu/eduInfo/service/impl/VEEduMIXServiceImpl.java @@ -232,4 +232,8 @@ public class VEEduMIXServiceImpl implements VEEduMIXService { public List selectAdultRsltRprtList(VEEduAplctVO paramVO) throws Exception{ return vEEduMIXDAO.selectAdultRsltRprtList(paramVO); } + + public List selectExprnAtchFileDownList(VEEduAplctVO paramVO) throws Exception{ + return vEEduMIXDAO.selectExprnAtchFileDownList(paramVO); + } } diff --git a/src/main/java/kcc/ve/oprtn/cpyrgExprnClsrm/oprtnAplctMng/web/OprtnAplctMngController.java b/src/main/java/kcc/ve/oprtn/cpyrgExprnClsrm/oprtnAplctMng/web/OprtnAplctMngController.java index c482d7e2..b7f67e46 100644 --- a/src/main/java/kcc/ve/oprtn/cpyrgExprnClsrm/oprtnAplctMng/web/OprtnAplctMngController.java +++ b/src/main/java/kcc/ve/oprtn/cpyrgExprnClsrm/oprtnAplctMng/web/OprtnAplctMngController.java @@ -11,9 +11,10 @@ import java.io.PrintWriter; import java.net.URLEncoder; import java.time.LocalDate; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Properties; import javax.annotation.Resource; @@ -32,7 +33,6 @@ import org.springframework.ui.ModelMap; import org.springframework.util.FileCopyUtils; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; @@ -525,6 +525,38 @@ String[] order = { return modelAndView; } + /** + * 저작권 체험교실 운영신청 목록 업로드 파일 체크 + * @param model + * @return + * @throws Exception + */ + @RequestMapping(value = "oprtnAplctFileAllChkAjax.do") + public ModelAndView oprtnAplctFileAllChkAjax(VEEduAplctVO vEEduAplctVO + , HttpServletRequest request, HttpServletResponse response) throws Exception { + + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("jsonView"); + + vEEduAplctVO.setEduAplctOrdList(Arrays.asList(vEEduAplctVO.getChk().split(","))); + List vEEduAplctVOList = vEEduMIXService.selectExprnAtchFileDownList(vEEduAplctVO); + + List atchFileIdList = new ArrayList(); + vEEduAplctVOList.forEach( vo -> { + if(vo.getOathAtchFileId() != null) { + atchFileIdList.add(vo.getOathAtchFileId()); + } + }); + + if(atchFileIdList.size() < 1) { + modelAndView.addObject("result", "fail"); + modelAndView.addObject("msg", "첨부 파일이 없습니다."); + }else { + modelAndView.addObject("result", "success"); + } + + return modelAndView; + } /** * 저작권 체험교실 운영신청 목록 업로드 파일 일괄 다운로드 * @param model @@ -532,70 +564,37 @@ String[] order = { * @throws Exception */ @RequestMapping(value = "oprtnAplctFileAllDownLoad.do") - public void oprtnAplctFileAllDownLoad(@RequestParam Map commandMap + public void oprtnAplctFileAllDownLoad(VEEduAplctVO vEEduAplctVO , HttpServletRequest request, HttpServletResponse response) throws Exception { - //파일 SN을 리스트에 담기 + + vEEduAplctVO.setEduAplctOrdList(Arrays.asList(vEEduAplctVO.getChk().split(","))); + List vEEduAplctVOList = vEEduMIXService.selectExprnAtchFileDownList(vEEduAplctVO); + vEEduAplctVOList = egovCryptoUtil.decryptVEEduAplctVOList(vEEduAplctVOList); + //첨부파일있는 항목만 재배치 + String orgnZipNm = "체험교실 신청서.zip"; + String downloadType = "A"; + //첨부파일있는 항목만 재배치 List atchFileIdList = new ArrayList(); - //파일 SN을 리스트에 담기 - List atchFileSnList = new ArrayList(); - - //split을 이용해 아이디를 각자 배열에 담기 - String[] splitIdStr = commandMap.get("atchFileId").toString().split(","); - String[] splitSnStr = commandMap.get("fileSn").toString().split(","); - //zip파일 이름 - String orgnZipNm = commandMap.get("orgnZipNm").toString(); - //downloadType (A:ID가 여러개고 fileSn이 1개인 경우 || B:ID는 하나이고 fileSn이 여러개인 경우) - String downloadType = commandMap.get("downloadType").toString(); - - String atchFileId = new String(); - String fileSn = new String(); - - - //ID가 여러개고 fileSn이 1개인 경우 - if("A".equals(downloadType)) { - fileSn = "0"; - for(int i=0; i { + if(vo.getOathAtchFileId() != null) { + atchFileIdList.add(vo.getOathAtchFileId()); } - } + }); - //ID는 하나이고 fileSn이 여러개인 경우 - if("B".equals(downloadType)) { - atchFileId = splitIdStr[0]; - for(int i=0; i fileYEduList = new ArrayList(); + vEEduAplctVOList.forEach( vo -> { + if(vo.getOathAtchFileId() != null) { + fileYEduList.add(vo); } - } + }); FileVO fileVO = new FileVO(); fileVO.setDownloadType(downloadType); - - if("A".equals(downloadType)) { - fileVO.setAtchFileIdList(atchFileIdList); - fileVO.setFileSn(fileSn); - } else if("B".equals(downloadType)) { - fileVO.setAtchFileId(atchFileId); - fileVO.setAtchFileSnList(atchFileSnList); - } - + + fileVO.setAtchFileIdList(atchFileIdList); List fvoList = fileService.selectZipFileList(fileVO); // 해당 기능에 맞게 파일 조회 - if(fvoList.size() == 0){ - 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 ; - } - - - // buffer size int size = 1024; byte[] buf = new byte[size]; @@ -603,39 +602,66 @@ String[] order = { FileInputStream fis = null; ZipArchiveOutputStream zos = null; BufferedInputStream bis = null; - + + + + + int fileCnt = 0; try { + System.out.println("outZipNm : "+ outZipNm); // Zip 파일생성 zos = new ZipArchiveOutputStream(new BufferedOutputStream(new FileOutputStream(outZipNm))); - for ( FileVO vo : fvoList ){ + Iterator fvoIterator = fvoList.iterator(); + Iterator fileYEduIterator = fileYEduList.iterator(); + + while (fvoIterator.hasNext() && fileYEduIterator.hasNext() ){ + FileVO vo = fvoIterator.next(); + VEEduAplctVO eduVO = fileYEduIterator.next(); zos.setEncoding("UTF-8"); - + + // Create a file object + File file = new File(vo.getFileStreCours() + "/" + vo.getStreFileNm()); + // 1. check if the file exists or not + boolean isExists = file.exists(); + if(isExists) { + System.out.println("getStreFileNm() " + vo.getStreFileNm()); + System.out.println("I find the existFile.txt"); + fileCnt++; + } else { + continue; + } + + /*String renamedFileName = generateRenamedFileName(vo.getOrignlFileNm());*/ + String renamedFileName = eduVO.getScholInsttNm() + "_" + eduVO.getChrgNm() + "_신청서."+ vo.getFileExtsn(); + vo.setOrignlFileNm(renamedFileName); + //buffer에 해당파일의 stream을 입력한다. fis = new FileInputStream(vo.getFileStreCours() + "/" + vo.getStreFileNm()); + bis = new BufferedInputStream(fis,size); - + //zip에 넣을 다음 entry 를 가져온다. zos.putArchiveEntry(new ZipArchiveEntry(vo.getOrignlFileNm())); - + //준비된 버퍼에서 집출력스트림으로 write 한다. - int len; - while((len = bis.read(buf,0,size)) != -1) zos.write(buf,0,len); - - bis.close(); - fis.close(); - zos.closeArchiveEntry(); + int len; + while((len = bis.read(buf,0,size)) != -1) zos.write(buf,0,len); + + bis.close(); + fis.close(); + zos.closeArchiveEntry(); + } + + zos.close(); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + }finally{ + if( zos != null ) zos.close(); + if( fis != null ) fis.close(); + if( bis != null ) bis.close(); } - - zos.close(); - - } catch (FileNotFoundException e) { - e.printStackTrace(); - }finally{ - if( zos != null ) zos.close(); - if( fis != null ) fis.close(); - if( bis != null ) bis.close(); - } File uFile = new File(fvoList.get(0).getFileStreCours(), orgnZipNm); long fSize = uFile.length(); @@ -690,6 +716,59 @@ String[] order = { } } + ////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // + // private function + // + // + + //페이징을 위한 처리 step1 - 페이징 기본 정보 설정 + private PaginationInfo setPagingStep1( + VEEduAplctVO p_vEEduAplctVO + )throws Exception{ + // pageing step1 + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(p_vEEduAplctVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(p_vEEduAplctVO.getPageUnit()); + paginationInfo.setPageSize(p_vEEduAplctVO.getPageSize()); + + return paginationInfo; + } + + + //페이징을 위한 처리 step2 - 게시물 리스트 수량 설정 및 검색 조건 초기화 + private VEEduAplctVO setPagingStep2( + VEEduAplctVO p_vEEduAplctVO + , PaginationInfo p_paginationInfo + )throws Exception{ + // pageing step2 + p_vEEduAplctVO.setFirstIndex(p_paginationInfo.getFirstRecordIndex()); + p_vEEduAplctVO.setLastIndex(p_paginationInfo.getLastRecordIndex()); + p_vEEduAplctVO.setRecordCountPerPage(p_paginationInfo.getRecordCountPerPage()); + + if("".equals(p_vEEduAplctVO.getSearchSortCnd())){ //최초조회시 최신것 조회List + p_vEEduAplctVO.setSearchSortCnd("prcs_ord"); + p_vEEduAplctVO.setSearchSortOrd("desc"); + } + + return p_vEEduAplctVO; + } + + + //페이징을 위한 처리 step3 - 전체 게시물 수량 설정하기 + private PaginationInfo setPagingStep3( + List p_vEEduAplctVOList + + , PaginationInfo p_paginationInfo + )throws Exception{ + // pageing step3 + int totCnt = 0; + if(p_vEEduAplctVOList.size() > 0) totCnt = p_vEEduAplctVOList.get(0).getTotCnt(); + p_paginationInfo.setTotalRecordCount(totCnt); + + return p_paginationInfo; + } private void setDisposition(String filename, HttpServletRequest request, HttpServletResponse response) throws Exception { String browser = getBrowser(request); @@ -741,57 +820,4 @@ String[] order = { } return "Firefox"; } - ////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // - // private function - // - // - - //페이징을 위한 처리 step1 - 페이징 기본 정보 설정 - private PaginationInfo setPagingStep1( - VEEduAplctVO p_vEEduAplctVO - )throws Exception{ - // pageing step1 - PaginationInfo paginationInfo = new PaginationInfo(); - paginationInfo.setCurrentPageNo(p_vEEduAplctVO.getPageIndex()); - paginationInfo.setRecordCountPerPage(p_vEEduAplctVO.getPageUnit()); - paginationInfo.setPageSize(p_vEEduAplctVO.getPageSize()); - - return paginationInfo; - } - - - //페이징을 위한 처리 step2 - 게시물 리스트 수량 설정 및 검색 조건 초기화 - private VEEduAplctVO setPagingStep2( - VEEduAplctVO p_vEEduAplctVO - , PaginationInfo p_paginationInfo - )throws Exception{ - // pageing step2 - p_vEEduAplctVO.setFirstIndex(p_paginationInfo.getFirstRecordIndex()); - p_vEEduAplctVO.setLastIndex(p_paginationInfo.getLastRecordIndex()); - p_vEEduAplctVO.setRecordCountPerPage(p_paginationInfo.getRecordCountPerPage()); - - if("".equals(p_vEEduAplctVO.getSearchSortCnd())){ //최초조회시 최신것 조회List - p_vEEduAplctVO.setSearchSortCnd("prcs_ord"); - p_vEEduAplctVO.setSearchSortOrd("desc"); - } - - return p_vEEduAplctVO; - } - - - //페이징을 위한 처리 step3 - 전체 게시물 수량 설정하기 - private PaginationInfo setPagingStep3( - List p_vEEduAplctVOList - - , PaginationInfo p_paginationInfo - )throws Exception{ - // pageing step3 - int totCnt = 0; - if(p_vEEduAplctVOList.size() > 0) totCnt = p_vEEduAplctVOList.get(0).getTotCnt(); - p_paginationInfo.setTotalRecordCount(totCnt); - - return p_paginationInfo; - } } diff --git a/src/main/resources/egovframework/sqlmap/ve/edu/VEEdu_MIX_SQL_Tibero.xml b/src/main/resources/egovframework/sqlmap/ve/edu/VEEdu_MIX_SQL_Tibero.xml index be57dabd..434f9882 100644 --- a/src/main/resources/egovframework/sqlmap/ve/edu/VEEdu_MIX_SQL_Tibero.xml +++ b/src/main/resources/egovframework/sqlmap/ve/edu/VEEdu_MIX_SQL_Tibero.xml @@ -8047,4 +8047,19 @@ VALUES a.LCTR_DIV_CD = '20' #rsltList[]# + + 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 a90e5c3c..b6fe604a 100644 --- a/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnAplctMngDetail.jsp +++ b/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnAplctMngDetail.jsp @@ -309,6 +309,18 @@ + + + +

서약서

+ + + + + + + +
diff --git a/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnAplctMngList.jsp b/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnAplctMngList.jsp index e3e6b3f7..cda185a8 100644 --- a/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnAplctMngList.jsp +++ b/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnAplctMngList.jsp @@ -140,12 +140,40 @@ input:read-only { } } + function fileChk() { + var chkLen = $(listForm).find("input[name=chk]:checked").length; + if(chkLen ==0){ + alert("선택된 항목이 없습니다."); + return; + } + var downForm = new FormData(document.getElementById("listForm")); + $.ajax({ + type:"POST", + url: "", + data: downForm, + dataType:'json', + async: false, + processData: false, + contentType: false, + cache: false, + success:function(returnData){ + console.log('returnData : ', returnData); + if(returnData.result == 'fail'){ + alert(returnData.msg); + }else{ + fileDownLoad(); + } + + }, + error:function(request , status, error){ + alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); + } + }); + } function fileDownLoad() { - /* alert("개발전"); - return; */ - var listForm = document.listForm; - listForm.action = ""; - listForm.submit(); + var downForm = document.listForm; + downForm.action = ""; + downForm.submit(); } function fncCreate() { @@ -167,6 +195,8 @@ input:read-only { value="" /> + +
@@ -305,7 +335,7 @@ input:read-only { selected>100줄 + onclick="fileChk();">첨부파일 다운로드
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 4d532af2..e2a2b1ef 100644 --- a/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnStateMngDetail.jsp +++ b/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnStateMngDetail.jsp @@ -332,6 +332,18 @@ + + + +

서약서

+ + + + + + + +
diff --git a/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnStateMngList.jsp b/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnStateMngList.jsp index 019c7980..171c10b3 100644 --- a/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnStateMngList.jsp +++ b/src/main/webapp/WEB-INF/jsp/oprtn/cpyrgExprnClsrm/oprtnStateMngList.jsp @@ -131,6 +131,41 @@ , $("#listForm") ); } + function fileChk() { + var chkLen = $(listForm).find("input[name=chk]:checked").length; + if(chkLen ==0){ + alert("선택된 항목이 없습니다."); + return; + } + var downForm = new FormData(document.getElementById("listForm")); + $.ajax({ + type:"POST", + url: "", + data: downForm, + dataType:'json', + async: false, + processData: false, + contentType: false, + cache: false, + success:function(returnData){ + console.log('returnData : ', returnData); + if(returnData.result == 'fail'){ + alert(returnData.msg); + }else{ + fileDownLoad(); + } + + }, + error:function(request , status, error){ + alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); + } + }); + } + function fileDownLoad() { + var downForm = document.listForm; + downForm.action = ""; + downForm.submit(); + } 교육과정관리 @@ -276,6 +311,7 @@ + diff --git a/src/main/webapp/WEB-INF/jsp/web/my/myPageDashBoard.jsp b/src/main/webapp/WEB-INF/jsp/web/my/myPageDashBoard.jsp index bdf92542..20df7438 100644 --- a/src/main/webapp/WEB-INF/jsp/web/my/myPageDashBoard.jsp +++ b/src/main/webapp/WEB-INF/jsp/web/my/myPageDashBoard.jsp @@ -143,7 +143,7 @@