기업회원 첨부파일 뷰어 기능 추가

This commit is contained in:
itn 2023-08-01 15:04:33 +09:00
parent 06fded7a59
commit c71a33ca2a
7 changed files with 210 additions and 20 deletions

View File

@ -132,6 +132,7 @@ public final class PdfUtil {
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());

View File

@ -9,10 +9,6 @@ import java.io.PrintWriter;
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;
@ -25,6 +21,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;
/**
* 파일 다운로드를 위한 컨트롤러 클래스
* @author 공통서비스개발팀 이삼섭
@ -468,6 +467,8 @@ public class EgovFileDownloadController {
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) {

View File

@ -218,6 +218,33 @@ public class EgovFileMngController {
return "cmm/fms/EgovAddrAgencyFileList";
}
/**
* 게시판 첨부파일에 대한 목록을 조회한다.
*
* @param fileVO
* @param commandMap
* @param model
* @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";
}
/**
* 게시판 첨부파일에 대한 목록을 조회한다.
*

View File

@ -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 @@ public class MjonMsgController {
}
@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 = "";
@ -5063,6 +5095,4 @@ public class MjonMsgController {
return "/uss/ion/msg/pdfView";
}
}

View File

@ -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>

View File

@ -21,6 +21,38 @@ $( document ).ready(function() {
});
// 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 @@ function fnSetCalMonth(val) {
</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 @@ function fnSetCalMonth(val) {
<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">

View File

@ -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">