From 5a0674464b16bc2209bfe245be311745ac8a4209 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 28 Jul 2023 10:57:21 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8F=99=EC=98=81=EC=83=81=20=EC=BA=A1?= =?UTF-8?q?=EC=B3=90=20=EC=88=98=EC=A0=95(=EC=84=9C=EB=B2=84=EC=97=90=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=EB=90=9C=20=EB=8F=99=EC=98=81=EC=83=81=20?= =?UTF-8?q?=EC=BA=A1=EC=B3=90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crdn/service/bean/Crdn01ServiceBean.java | 68 ++++++++++++------- .../xit/fims/sprt/web/Sprt03Controller.java | 43 +++++++++++- .../cokr/xit/fims/task/web/CmnController.java | 4 +- .../sql/mapper/fims/crdn/crdn01-mapper.xml | 2 + .../WEB-INF/jsp/fims/crdn/crdn01020-info.jsp | 12 +++- .../WEB-INF/jsp/fims/sprt/sprt03010-main.jsp | 30 +++++--- 6 files changed, 122 insertions(+), 37 deletions(-) diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java index 4e42af8b..000d5461 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java @@ -16,7 +16,6 @@ import cokr.xit.base.file.service.FileService; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.hwp.AddingParagraphBetweenHWPFile; import cokr.xit.fims.cmmn.hwp.InsertingImageCell; -import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.dao.Crdn01Mapper; import cokr.xit.fims.crdn.service.CrdnService; @@ -115,36 +114,48 @@ public class Crdn01ServiceBean extends AbstractServiceBean implements CrdnServic HWPFile resultFile = HWPReader.fromFile(resultPath); - FileQuery fileQuery = new FileQuery(); - fileQuery.setInfoType(Crdn.INF_TYPE); - fileQuery.setInfoKeys(crdnQuery.getCrdnId()); - List fileInfoList = fileService.getFileList(fileQuery); - - if(fileInfoList != null && fileInfoList.size() > 0) { - int photoCnt = fileInfoList.size(); - int PHOTO_COUNT_PER_PAGE = 4; - - for(int i=0; i < photoCnt; i += PHOTO_COUNT_PER_PAGE) { - HWPFile attachFormatFile = HWPReader.fromFile(attachFormatFilePath); - InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "왼쪽위사진", fileInfoList.get(i).string("URL")); - if(i+1 < photoCnt) - InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "오른쪽위사진", fileInfoList.get(i+1).string("URL")); - if(i+2 < photoCnt) - InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "왼쪽아래사진", fileInfoList.get(i+2).string("URL")); - if(i+3 < photoCnt) - InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "오른쪽아래사진", fileInfoList.get(i+3).string("URL")); - AddingParagraphBetweenHWPFile.fileMerge(attachFormatFile, resultFile); + String linkTblNm = dataObject.string("LINK_TBL_NM"); + if(!linkTblNm.equals("")) { + FileQuery fileQuery = new FileQuery(); + + if(linkTblNm.equals("TB_ESB_INTERFACE")) { + fileQuery.setInfoType("010"); + } else if(linkTblNm.equals("TB_SAEOL")) { + fileQuery.setInfoType("020"); + } else { + return new ModelAndView("errorView"); } - HWPWriter.toFile(resultFile, resultPath); - } + fileQuery.setInfoKeys(dataObject.string("LINK_ID")); + + List fileInfoList = fileService.getFileList(fileQuery); + if(fileInfoList != null && fileInfoList.size() > 0) { + int photoCnt = fileInfoList.size(); + int PHOTO_COUNT_PER_PAGE = 4; + + for(int i=0; i < photoCnt; i += PHOTO_COUNT_PER_PAGE) { + HWPFile attachFormatFile = HWPReader.fromFile(attachFormatFilePath); + InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "왼쪽위사진", fileInfoList.get(i).string("URL")); + if(i+1 < photoCnt) + InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "오른쪽위사진", fileInfoList.get(i+1).string("URL")); + if(i+2 < photoCnt) + InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "왼쪽아래사진", fileInfoList.get(i+2).string("URL")); + if(i+3 < photoCnt) + InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "오른쪽아래사진", fileInfoList.get(i+3).string("URL")); + AddingParagraphBetweenHWPFile.fileMerge(attachFormatFile, resultFile); + } + + HWPWriter.toFile(resultFile, resultPath); + } + } String downlaodFileName = "민원내역원본_" + currentTime + ".hwp"; ModelAndView mav = new ModelAndView("jsonView"); mav.addObject("filePath", resultPath); mav.addObject("fileName", downlaodFileName); return mav; + } catch (Exception e) { return new ModelAndView("errorView"); @@ -157,7 +168,18 @@ public class Crdn01ServiceBean extends AbstractServiceBean implements CrdnServic } public DataObject getCivilComplaintReceiptInitialDataInfo(CrdnQuery req) { - return crdn01Mapper.selectCivilComplaintReceiptInitialDataInfo(req); + DataObject dataObject = crdn01Mapper.selectCivilComplaintReceiptInitialDataInfo(req); + + FileQuery fileQuery = new FileQuery(); + fileQuery.setInfoKeys(dataObject.string("CRDN_ID")); + fileQuery.setInfoType("190"); + List fileList = fileService.getFileList(fileQuery); + if(fileList != null && !fileList.isEmpty()) { + dataObject.set("videoExist", "Y"); + } else { + dataObject.set("videoExist", "N"); + } + return dataObject; } diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt03Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt03Controller.java index af9a687c..aa876214 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt03Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt03Controller.java @@ -1,16 +1,55 @@ package cokr.xit.fims.sprt.web; +import java.util.List; + +import javax.annotation.Resource; + +import org.assertj.core.util.Arrays; import org.springframework.web.servlet.ModelAndView; -public class Sprt03Controller { +import cokr.xit.base.file.service.FileQuery; +import cokr.xit.base.file.service.FileService; +import cokr.xit.base.web.ApplicationController; +import cokr.xit.foundation.data.DataObject; + +public class Sprt03Controller extends ApplicationController { + + @Resource(name="fileService") + FileService fileService; + + public String VIDEO_INF_TYPE = "190"; + public String[] VIDEO_MIME_TYPE = { + "video/mp4", "video/webm", "video/ogg" + }; + /** 동영상 재생 메인화면을 연다. * @return fims/sprt/sprt03010-main */ - public ModelAndView videoMain(String openerPageName) { + public ModelAndView videoMain(String openerPageName, String crdnId) { ModelAndView mav = new ModelAndView(); + mav.setViewName("fims/sprt/sprt03010-main"); mav.addObject("openerPageName", openerPageName); + if(crdnId != null && !crdnId.equals("")) { + mav.addObject("crdnId", crdnId); + + FileQuery fileQuery = new FileQuery(); + fileQuery.setInfoKeys(crdnId); + fileQuery.setInfoType(VIDEO_INF_TYPE); + List fileList = fileService.getFileList(fileQuery); + if(fileList != null && !fileList.isEmpty()) { + for(int i=0; i < fileList.size() ;i++) { + DataObject file = fileList.get(i); + String mimeType = file.string("MIME_TYPE"); + if(Arrays.asList(VIDEO_MIME_TYPE).contains(mimeType)){ + mav.addObject("fileInfo", toJson(file)); + break; + } + } + } + } + return mav; } } diff --git a/src/main/java/cokr/xit/fims/task/web/CmnController.java b/src/main/java/cokr/xit/fims/task/web/CmnController.java index 5726890f..02b6c85a 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -127,8 +127,8 @@ public class CmnController { */ @Override @RequestMapping(name="동영상 재생 메인", value="/010/main.do") - public ModelAndView videoMain(String openerPageName) { - return super.videoMain(openerPageName); + public ModelAndView videoMain(String openerPageName, String crdnId) { + return super.videoMain(openerPageName, crdnId); } } diff --git a/src/main/resources/sql/mapper/fims/crdn/crdn01-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/crdn01-mapper.xml index 74935852..8926ddd2 100644 --- a/src/main/resources/sql/mapper/fims/crdn/crdn01-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/crdn01-mapper.xml @@ -300,6 +300,8 @@ SELECT C.CRDN_ID , CC.CVLCPT_RCPT_YMD , CC.CVLCPT_PRCS_PRNMNT_DT , CC.CVLCPT_APLY_CN + , C.LINK_TBL_NM + , C.LINK_ID FROM TB_CRDN C INNER JOIN TB_CRDN_CVLCPT CC ON (C.CRDN_ID = CC.CRDN_ID) WHERE C.DEL_YN = 'N' AND CC.DEL_YN = 'N' diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp index 3b9d8030..e7d3367d 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn01020-info.jsp @@ -4,7 +4,7 @@
- +
@@ -271,6 +271,7 @@
+
@@ -418,7 +419,9 @@ $(document).ready(function(){ $("#btnInst--${pageName}").on('click', () => $P.fnSave()); $("#btnAddFile--${pageName}").on('click', () => { $("#uploadFileList--${pageName}").trigger("click"); }); $("#btnOpenVideoCapture--${pageName}").on('click', () => { - window.open(wctx.url("/sprt/sprt03/010/main.do?openerPageName=${pageName}") + var crdnId = $("#crdnId--${pageName}").val(); + + window.open(wctx.url("/sprt/sprt03/010/main.do?openerPageName=${pageName}&crdnId="+crdnId) ,"newVideoCapture" ,"width=1800,height=950" ); @@ -466,6 +469,11 @@ $(document).ready(function(){ var crdnInfo = ${crdnInfo}; crdnInfo.CVLCPT_APLY_CN = escapeHTMLEntity(crdnInfo.CVLCPT_APLY_CN); $P.crdnControl.setData([crdnInfo]); + + if(crdnInfo.videoExist == "N"){ + $("#btnOpenVideoCapture--${pageName}").hide(); + $("#display2--${pageName}").hide(); + } }); diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03010-main.jsp index 885d11ba..85b57a19 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03010-main.jsp @@ -114,14 +114,6 @@ document.getElementById("video").addEventListener('play', function () { document.getElementById("btnCapture").focus(); }); -$(document).ready(function(){ - if(openerPageName == "crdn01020-info"){ - $("#btnLoad").removeClass("d-block"); - $("#btnLoad").addClass("d-none"); - } -}); - - function capture(video, scaleFactor) { if(scaleFactor == null){ @@ -192,6 +184,28 @@ $("#btnSave").on("click",function(){ window.close(); } }); + + +$(document).ready(function(){ + if(openerPageName == "crdn01020-info"){ + $("#btnLoad").removeClass("d-block"); + $("#btnLoad").addClass("d-none"); + + var fileInfo = [${fileInfo}]; + + if(fileInfo.length > 0){ + var fileUrl = fileInfo[0].URL; + + $("#video").removeAttr("hidden"); + + $("#video").html(""); + + } else { + alert("동영상 파일이 없습니다."); + } + } +}); + \ No newline at end of file