itn 2023-08-01
기업회원 첨부파일 뷰어 기능 추가
@c71a33ca2ab630015acfdc49c30898ba5995b446
src/main/java/itn/com/cmm/util/PdfUtil.java
--- src/main/java/itn/com/cmm/util/PdfUtil.java
+++ src/main/java/itn/com/cmm/util/PdfUtil.java
@@ -132,6 +132,7 @@
             contents.drawImage(pdImage, pageWidthPosition, pageHeightPosition, imgWidth, imgHeight);
             contents.close();
             doc.save("/usr/local/tomcat/file/sht/pdf/" + uuid + ".pdf");
+            //doc.save("C:/TEST/" + uuid + ".pdf");
             
         } catch (Exception e) {
             System.out.println("Exception! : " + e.getMessage());
src/main/java/itn/com/cmm/web/EgovFileDownloadController.java
--- src/main/java/itn/com/cmm/web/EgovFileDownloadController.java
+++ src/main/java/itn/com/cmm/web/EgovFileDownloadController.java
@@ -9,10 +9,6 @@
 import java.net.URLEncoder;
 import java.util.Map;
 
-import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
-import itn.com.cmm.service.EgovFileMngService;
-import itn.com.cmm.service.FileVO;
-
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -24,6 +20,9 @@
 import org.springframework.util.FileCopyUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
+
+import itn.com.cmm.service.EgovFileMngService;
+import itn.com.cmm.service.FileVO;
 
 /**
  * 파일 다운로드를 위한 컨트롤러 클래스
@@ -468,6 +467,8 @@
 				
 			
 			File uFile = new File("/usr/local/tomcat/file/sht/pdf/", fileNm);
+			//File uFile = new File("C:/TEST/", fileNm);
+			
 			long fSize = uFile.length();
 
 			if (fSize > 0) {
src/main/java/itn/com/cmm/web/EgovFileMngController.java
--- src/main/java/itn/com/cmm/web/EgovFileMngController.java
+++ src/main/java/itn/com/cmm/web/EgovFileMngController.java
@@ -227,6 +227,33 @@
 	 * @return
 	 * @throws Exception
 	 */
+	@RequestMapping("/cmm/fms/selectMberFileInfs.do")
+	public String selectMberFileInfs(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map<String, Object> commandMap, ModelMap model) throws Exception {
+		String atchFileId = (String) commandMap.get("param_atchFileId");
+		String pdfView = (String) commandMap.get("pdf_view"); //'Y' 이면  pdf 직접 보여주기
+		
+		fileVO.setAtchFileId(atchFileId);
+		List<FileVO> result = fileService.selectFileInfs(fileVO);
+		model.addAttribute("fileList", result);
+		model.addAttribute("updateFlag", "N");
+		model.addAttribute("fileListCnt", result.size());
+		model.addAttribute("atchFileId", atchFileId);
+		if("Y".equals(pdfView)){
+			model.addAttribute("pdfView", pdfView);
+		}
+
+		return "cmm/fms/EgovMberFileList";
+	}
+	
+	/**
+	 * 게시판 첨부파일에 대한 목록을 조회한다.
+	 *
+	 * @param fileVO
+	 * @param commandMap
+	 * @param model
+	 * @return
+	 * @throws Exception
+	 */
 	@RequestMapping("/cmm/fms/selectBBSFileInfsMjon.do")
 	public String selectBBSFileInfsMjon(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map<String, Object> commandMap, ModelMap model) throws Exception {
 		String atchFileId = (String) commandMap.get("param_atchFileId");
src/main/java/itn/let/mjo/msg/web/MjonMsgController.java
--- src/main/java/itn/let/mjo/msg/web/MjonMsgController.java
+++ src/main/java/itn/let/mjo/msg/web/MjonMsgController.java
@@ -1,6 +1,5 @@
 package itn.let.mjo.msg.web;
 
-import java.io.File;
 import java.io.OutputStream;
 import java.net.URL;
 import java.text.SimpleDateFormat;
@@ -5044,7 +5043,40 @@
     }
     
     @RequestMapping(value = {"/uss/ion/msg/pdfView.do"})
-   	public String pdfView(FileVO fileVO, ModelMap model) throws Exception {
+   	public String pdfView(FileVO fileVO
+   			, ModelMap model
+   			, HttpServletRequest request) throws Exception {
+    	
+		FileVO fvo = fileService.selectFileInf(fileVO);
+		String path = "";
+		
+		if(fvo != null) {
+			if("pdf".equals(fvo.getFileExtsn())) {
+				path = "/cmm/fms/FileDown.do?atchFileId="+ fvo.getAtchFileId() + "&fileSn=" + fvo.getFileSn();
+			}else {
+				String storePath = fvo.getFileStreCours() + fvo.getStreFileNm();
+				path = "/cmm/fms/FileDowntest.do?fileNm="+ PdfUtil.makeImgPdf(storePath, fvo.getFileExtsn());
+			}
+		}
+		
+		String mberNm = request.getParameter("mberNm");
+		String bizNo = request.getParameter("bizNo");
+		String ceoNm = request.getParameter("ceoNm");
+		String hstManagerNm = request.getParameter("hstManagerNm");
+		String hstMbtlNum = request.getParameter("hstMbtlNum");
+		
+		model.addAttribute("pdfPath", path);
+		model.addAttribute("mberNm", mberNm);
+		model.addAttribute("bizNo", bizNo);
+		model.addAttribute("ceoNm", ceoNm);
+		model.addAttribute("hstManagerNm", hstManagerNm);
+		model.addAttribute("hstMbtlNum", hstMbtlNum);		
+    	
+    	return "/uss/ion/msg/pdfView";
+    }
+	
+    @RequestMapping(value = {"/uss/ion/msg/pdfViewAjax.do"})
+   	public String pdfViewAjax(FileVO fileVO, ModelMap model) throws Exception {
     	
 		FileVO fvo = fileService.selectFileInf(fileVO);
 		String path = "";
@@ -5061,8 +5093,6 @@
 		model.addAttribute("pdfPath", path);
     	
     	return "/uss/ion/msg/pdfView";
-    }
-	
-	
+    }	
 	
 }
(No newline at end of file)
 
src/main/webapp/WEB-INF/jsp/cmm/fms/EgovMberFileList.jsp (added)
+++ src/main/webapp/WEB-INF/jsp/cmm/fms/EgovMberFileList.jsp
@@ -0,0 +1,40 @@
+<%@ 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"%>
+<%
+
+/**
+  * @Class Name : EgovFileList.jsp
+  * @Description : 파일 목록화면
+  * @Modification Information
+  * @
+  * @  수정일   	수정자		수정내용
+  * @ ----------	------		---------------------------
+  * @ 2009.03.26	이삼섭		최초 생성
+  * @ 2011.07.20	옥찬우		<Input> Tag id속성 추가( Line : 68 )
+  *
+  *  @author 공통서비스 개발팀 이삼섭
+  *  @since 2009.03.26
+  *  @version 1.0
+  *  @see
+  *
+  */
+%>
+
+<script type="text/javascript">
+
+	function fn_egov_downFile(atchFileId, fileSn){
+		window.open("<c:url value='/cmm/fms/FileDown.do?atchFileId="+atchFileId+"&fileSn="+fileSn+"'/>","hiddenframe");
+	}
+	
+</script>
+
+	<c:forEach var="fileVO" items="${fileList}" varStatus="status">					
+		<a href="javascript:fn_egov_downFile('<c:out value="${fileVO.atchFileId}"/>','<c:out value="${fileVO.fileSn}"/>')" class="fileName" title="다운로드"><img src="/publish/images/content/file_img2.png" alt="첨부파일"></a>
+	</c:forEach>
+
+<iframe width=0 height=0 name='hiddenframe' style='display:none;'></iframe>
+
src/main/webapp/WEB-INF/jsp/cmm/uss/umt/EgovMberCmpHstListByType.jsp
--- src/main/webapp/WEB-INF/jsp/cmm/uss/umt/EgovMberCmpHstListByType.jsp
+++ src/main/webapp/WEB-INF/jsp/cmm/uss/umt/EgovMberCmpHstListByType.jsp
@@ -21,6 +21,38 @@
 
 });
 
+// PdfView
+function pdfViewPop(atchFileId,mberNm,bizNo,ceoNm,hstManagerNm,hstMbtlNum) {
+	document.pdfForm.atchFileId.value = atchFileId;
+	document.pdfForm.mberNm.value = mberNm;
+	document.pdfForm.bizNo.value = bizNo;
+	document.pdfForm.ceoNm.value = ceoNm;
+	document.pdfForm.hstManagerNm.value = hstManagerNm;
+	document.pdfForm.hstMbtlNum.value = hstMbtlNum;
+	document.pdfForm.fileSn.value = 0;
+	window.open("about:blank", 'taxListPopup', 'width=1020, height=800, top=100, left=0, fullscreen=no, menubar=no, status=no, toolbar=no, titlebar=no, location=no, scrollbar=no');
+    document.pdfForm.action = "<c:url value='/uss/ion/msg/pdfView.do'/>";
+    document.pdfForm.target = "taxListPopup";
+    document.pdfForm.submit();	
+}
+
+// 첨부파일 PdfView
+function pdfViewPop2(atchFileId) {
+	$.ajax({
+        type: "POST",
+        url: "/uss/ion/msg/pdfViewAjax.do",
+        data: {"atchFileId" : atchFileId, "fileSn" : "0"},
+        dataType:'html',
+        async: true,
+        success: function (data) {
+        	alert(data);
+		},
+        error: function (e) { 
+        	//alert("ERROR : " + JSON.stringify(e)); 
+        }
+    });	
+}	
+
 function fnChkAll() {
 	if($("#chkAll").is(':checked') ){
 	  $("input[name=chkSttusY]").prop("checked", true);
@@ -268,6 +300,16 @@
 </head>
 <body>
 
+<form name="pdfForm" action="<c:url value='/uss/ion/msg/pdfView.do'/>" method="post">
+	<input type="hidden" name="atchFileId"/>
+	<input type="hidden" name="fileSn"/>
+	<input type="hidden" name="mberNm"/>
+	<input type="hidden" name="bizNo"/>
+	<input type="hidden" name="ceoNm"/>
+	<input type="hidden" name="hstManagerNm"/>
+	<input type="hidden" name="hstMbtlNum"/>	
+</form>
+
 <form name="popupForm" action="<c:url value='/uss/umt/user/EgovMberCmpHstListPop.do'/>" method="post">
 	<input type="hidden" name="pageIndex" value="1"/>
 	<input type="hidden" name="searchSortCnd" value="<c:out value="${searchVO.searchSortCnd}" />" />
@@ -427,24 +469,32 @@
 		                            <c:if test="${result.bizType == item.code}"><c:out value="${fn:substring(item.codeNm,0,2)}"/></c:if>
 		                        </c:forEach>
 							</td>
-							<td><c:out value="${result.mberNm}"/></td>
+							<td>
+								<c:out value="${result.mberNm}"/>
+							</td>
 							<td><a href="https://www.bizno.net/article/${result.bizNo}" target="_blank"><c:out value="${result.bizNo}"/></a></td>
 							<td><c:out value="${result.ceoNm}"/></td>
 							<td><c:out value="${result.hstManagerNm}"/></td>
 							<td><c:out value="${result.hstMbtlNum}"/></td>
-				            <td class="td_file">		            	
+				            <td class="td_file" style="vertical-align:middle;">		            	
                                 <c:if test="${result.atchFileId ne '' || result.atchFileId ne null}">
-				            		<c:import url="/cmm/fms/selectAddrAgencyFileInfs.do" charEncoding="utf-8">
+				            		<c:import url="/cmm/fms/selectMberFileInfs.do" charEncoding="utf-8">
 										<c:param name="param_atchFileId" value="${result.atchFileId}" />
 									</c:import>	
 					            </c:if>
+                                <c:if test="${result.atchFileId ne '' && result.atchFileId ne null}">
+									<button class="btnType btnType20" onclick="pdfViewPop('${result.atchFileId}','${result.mberNm}','${result.bizNo}','${result.ceoNm}','${result.hstManagerNm}','${result.hstMbtlNum}')" style="height:20px !important; padding:0 2px !important;">V</button>
+					            </c:if>					            
 				            </td>							
 				            <td class="td_file">		            	
                                 <c:if test="${result.workAtchFileId ne '' || result.workAtchFileId ne null}">
-				            		<c:import url="/cmm/fms/selectAddrAgencyFileInfs.do" charEncoding="utf-8">
+				            		<c:import url="/cmm/fms/selectMberFileInfs.do" charEncoding="utf-8">
 										<c:param name="param_atchFileId" value="${result.workAtchFileId}" />
 									</c:import>	
 					            </c:if>
+                                <c:if test="${result.workAtchFileId ne '' && result.workAtchFileId ne null}">
+									<button class="btnType btnType20" onclick="pdfViewPop('${result.workAtchFileId}','${result.mberNm}','${result.bizNo}','${result.ceoNm}','${result.hstManagerNm}','${result.hstMbtlNum}')" style="height:20px !important; padding:0 2px !important;">V</button>
+					            </c:if>					            
 				            </td>											            							
 							<td>
 		                        <c:forEach var="item" items="${hstTypeList}" varStatus="status">
src/main/webapp/WEB-INF/jsp/uss/ion/msg/pdfView.jsp
--- src/main/webapp/WEB-INF/jsp/uss/ion/msg/pdfView.jsp
+++ src/main/webapp/WEB-INF/jsp/uss/ion/msg/pdfView.jsp
@@ -26,18 +26,59 @@
 <html lang="ko">
 
 <head>
+	<link rel="stylesheet" href="/pb/css/reset.css">
+	<link rel="stylesheet" href="/pb/css/common.css">
+	<link rel="stylesheet" href="/pb/css/content.css?date=202301160001">
+	<link rel="stylesheet" href="/pb/css/popup.css">
+
 	<script type="text/javascript" src="<c:url value='/js/EgovMultiFile.js'/>"></script>
 	<script src="//mozilla.github.io/pdf.js/build/pdf.js"></script>
 </head>
 <body>
 
-<div>
-  <button id="prev">Previous</button>
-  <button id="next">Next</button>
-  &nbsp; &nbsp;
-  <span>Page: <span id="page_num"></span> / <span id="page_count"></span></span>
-</div>
-<canvas id="the-canvas" name="the-canvas"></canvas>
+	<div class="pageCont" style="text-align: center; width: 1000px;">
+		<div class="tableWrap">
+			<table class="tbType1">
+				<colgroup>
+					<col style="width: *%">
+					<col style="width: 20%">
+					<col style="width: 20%">
+					<col style="width: 20%">
+					<col style="width: 20%">
+				</colgroup>
+				<thead>
+					<tr>
+						<th>기업명</th>
+						<th>사업자번호</th>
+						<th>대표자</th>
+						<th>담당자</th>
+						<th>휴대폰</th>
+					</tr>
+				</thead>
+				<tbody>
+					<tr>
+						<td>${mberNm}</td>
+						<td>${bizNo}</td>
+						<td>${ceoNm}</td>
+						<td>${hstManagerNm}</td>
+						<td>${hstMbtlNum}</td>
+					</tr>
+				</tbody>
+			</table>	
+		</div>
+		
+		<canvas id="the-canvas" name="the-canvas" style="max-width: 1000px; margin-top: 25px; margin-bottom: 25px;"></canvas>
+	
+		<div>
+		  <button class="btnType" id="prev">Previous</button>
+		  &nbsp;<span>Page: <span id="page_num"></span> / <span id="page_count"></span></span>&nbsp;
+		  <button class="btnType" id="next">Next</button>
+		  
+		  <div style="float: right; margin-right: 10px;"><button onclick="javascript:self.close()" class="btnType">CLOSE</button></div>
+		</div>
+		
+	</div>
+
 </body>
 </html>
 	<script type="text/javaScript" language="javascript">
Add a comment
List