From 3353aad7038cffdeaaa663fc49e50e54ef28161c Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 28 Jul 2023 17:21:38 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=9C=EA=B8=80=20=EC=84=9C=EC=8B=9D?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fims/crdn/service/bean/Crdn01ServiceBean.java | 14 +++++++++++--- .../cokr/xit/fims/crdn/web/Crdn01Controller.java | 5 ++--- .../resources/format/cvlcptOrgnl_photo.hwp | Bin .../resources/format/cvlcptOrgnl_text.hwp | Bin 4 files changed, 13 insertions(+), 6 deletions(-) rename src/main/{webapp => }/resources/format/cvlcptOrgnl_photo.hwp (100%) rename src/main/{webapp => }/resources/format/cvlcptOrgnl_text.hwp (100%) 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 a1638a0b..adc457b3 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 @@ -9,6 +9,7 @@ import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; +import org.springframework.util.ResourceUtils; import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.file.service.FileQuery; @@ -65,7 +66,10 @@ public class Crdn01ServiceBean extends AbstractServiceBean implements CrdnServic return crdn01Bean.removeCivilComplaint(crdnIDs); } - public ModelAndView makeFileFromHwpFormat(CrdnQuery crdnQuery, String baseFormatFilePath, String attachFormatFilePath) { + public ModelAndView makeFileFromHwpFormat(CrdnQuery crdnQuery) { + + String baseFormatFilePath = ("classpath:format/cvlcptOrgnl_text.hwp"); + String attachFormatFilePath = ("classpath:format/cvlcptOrgnl_photo.hwp"); crdnQuery.setView("hwp"); DataObject dataObject = crdn01Bean.getCivilComplaintOriginalInfo(crdnQuery); @@ -74,7 +78,10 @@ public class Crdn01ServiceBean extends AbstractServiceBean implements CrdnServic SimpleDateFormat ymdHypenFormat = new SimpleDateFormat("yyyy-MM-dd"); try { - HWPFile baseFormatFile = HWPReader.fromFile(baseFormatFilePath); + + File file = ResourceUtils.getFile(baseFormatFilePath); + + HWPFile baseFormatFile = HWPReader.fromFile(file); ArrayList strings = new ArrayList(); strings.add(dataObject.string("CVLCPT_APLCNT_NM")); @@ -136,7 +143,8 @@ public class Crdn01ServiceBean extends AbstractServiceBean implements CrdnServic int PHOTO_COUNT_PER_PAGE = 4; for(int i=0; i < photoCnt; i += PHOTO_COUNT_PER_PAGE) { - HWPFile attachFormatFile = HWPReader.fromFile(attachFormatFilePath); + file = ResourceUtils.getFile(attachFormatFilePath); + HWPFile attachFormatFile = HWPReader.fromFile(file); InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "왼쪽위사진", fileInfoList.get(i).string("URL")); if(i+1 < photoCnt) InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "오른쪽위사진", fileInfoList.get(i+1).string("URL")); diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java index 06d80884..453aaded 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn01Controller.java @@ -189,10 +189,9 @@ public class Crdn01Controller extends ApplicationController { @RequestMapping(name="민원내역 원본 한글 파일 생성", value="/050/makeFileFromHwpFormat.do") public ModelAndView makeFileFromHwpFormat(CrdnQuery crdnQuery, HttpServletRequest request) { - String baseFormatFilePath = request.getServletContext().getRealPath("resources/format/cvlcptOrgnl_text.hwp"); - String attachFormatFilePath = request.getServletContext().getRealPath("resources/format/cvlcptOrgnl_photo.hwp"); - return crdn01Service.makeFileFromHwpFormat(crdnQuery, baseFormatFilePath, attachFormatFilePath); + + return crdn01Service.makeFileFromHwpFormat(crdnQuery); } /** 민원답변내용 미리보기 화면을 연다. diff --git a/src/main/webapp/resources/format/cvlcptOrgnl_photo.hwp b/src/main/resources/format/cvlcptOrgnl_photo.hwp similarity index 100% rename from src/main/webapp/resources/format/cvlcptOrgnl_photo.hwp rename to src/main/resources/format/cvlcptOrgnl_photo.hwp diff --git a/src/main/webapp/resources/format/cvlcptOrgnl_text.hwp b/src/main/resources/format/cvlcptOrgnl_text.hwp similarity index 100% rename from src/main/webapp/resources/format/cvlcptOrgnl_text.hwp rename to src/main/resources/format/cvlcptOrgnl_text.hwp