From 1aec5b95ac00418846a5dcf7610da506088a214d Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 21 Mar 2024 11:20:47 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=8A=A4=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/file/etc/OutsourcingFileWriter.java | 2 +- src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java | 17 +++++++++++++++++ .../cmmn/pdf/print/format/PDFPrintFormat.java | 7 +++++-- .../crdn/service/bean/ImportServiceBean.java | 3 ++- .../xit/fims/cvlc/web/Cvlc05Controller.java | 7 ++++--- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/main/java/cokr/xit/base/file/etc/OutsourcingFileWriter.java b/src/main/java/cokr/xit/base/file/etc/OutsourcingFileWriter.java index bea716ce..ac663f56 100644 --- a/src/main/java/cokr/xit/base/file/etc/OutsourcingFileWriter.java +++ b/src/main/java/cokr/xit/base/file/etc/OutsourcingFileWriter.java @@ -96,7 +96,7 @@ public class OutsourcingFileWriter { File modifiedFile = new File(modifiedFilePath); if(dataObject.get("MOS"+fileKey) != null) { - CmmnUtil.createMaskedImage(orgnFileInputStream, modifiedFile, (List)dataObject.get("MOS"+fileKey)); + CmmnUtil.createMaskedImage(orgnFileInputStream, modifiedFile, CmmnUtil.getDataObjectListFromMap(dataObject,"MOS"+fileKey)); } else { Files.copy(orgnFileInputStream, modifiedFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index b809a6ef..e7546da7 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -14,6 +14,7 @@ import java.text.SimpleDateFormat; import java.time.DayOfWeek; import java.time.LocalDate; import java.time.format.TextStyle; +import java.util.ArrayList; import java.util.Calendar; import java.util.Comparator; import java.util.Date; @@ -41,6 +42,22 @@ import cokr.xit.foundation.data.DataObject; public class CmmnUtil { + public static List getDataObjectListFromMap(Map map, String key) { + ArrayList dataObjectList = new ArrayList<>(); + Object list = map.get(key); + if(list == null) { + return null; + } + if(list instanceof ArrayList) { + for(Object o : (ArrayList) list) { + if(o instanceof DataObject) { + dataObjectList.add((DataObject)o); + } + } + } + return dataObjectList; + } + /** * HTML엔티티코드 문자열을 특수문자로 치환한다. * @param HTML엔티티코드 문자열 diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java index 2fb10ae5..d22db94e 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java @@ -3,6 +3,7 @@ package cokr.xit.fims.cmmn.pdf.print.format; import java.util.ArrayList; import java.util.List; +import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.pdf.print.DefaultOtptArtclStng; @@ -113,8 +114,10 @@ public abstract class PDFPrintFormat { public abstract DataObject createSampleData(); public List getMosSet(String imageKey, DataObject dataObject) { - if((List)dataObject.get("MOS"+imageKey) != null) { - return (List)dataObject.get("MOS"+imageKey); + List list = CmmnUtil.getDataObjectListFromMap(dataObject,"MOS"+imageKey); + + if(list != null) { + return list; } else { return null; } diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/ImportServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/ImportServiceBean.java index 95b54648..6a7f84c4 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/ImportServiceBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/ImportServiceBean.java @@ -19,6 +19,7 @@ import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.file.web.FileInfoFactory; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.dao.UserMapper; +import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Team; import cokr.xit.fims.crdn.dao.CrdnTeamMapper; @@ -100,7 +101,7 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ Map dividedInfo = this.divideInformation(linkFileInfoList, fileGroupType); DataObject metaFileInfo = (DataObject) dividedInfo.get("metaInfo"); - List imageFileInfoList = (List) dividedInfo.get("imageInfo"); + List imageFileInfoList = CmmnUtil.getDataObjectListFromMap(dividedInfo,"imageInfo"); DataObject bgngData = (DataObject) dividedInfo.get("bgngData"); DataObject endData = (DataObject) dividedInfo.get("endData"); diff --git a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc05Controller.java b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc05Controller.java index 0931d5d6..d732d79c 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc05Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc05Controller.java @@ -12,6 +12,7 @@ import cokr.xit.base.code.CommonCode; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.web.ApplicationController; +import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.cvlc.CrdnCvlcpt; @@ -77,9 +78,9 @@ public class Cvlc05Controller extends ApplicationController { Map info = crdnCvlcptService.getCvlcptAnswerWordsInfo(crdnQuery); DataObject basicInfo = (DataObject) info.get("basic"); - List levyCaseList = (List) info.get("levyCaseList"); - List warningCaseList = (List) info.get("warningCaseList"); - List nonlevyCaseList = (List) info.get("nonlevyCaseList"); + List levyCaseList = CmmnUtil.getDataObjectListFromMap(info,"levyCaseList"); + List warningCaseList = CmmnUtil.getDataObjectListFromMap(info,"warningCaseList"); + List nonlevyCaseList = CmmnUtil.getDataObjectListFromMap(info,"nonlevyCaseList"); if(basicInfo == null){ mav.addObject("headerCn", "");