diff --git a/src/main/java/cokr/xit/fims/cmmn/Print.java b/src/main/java/cokr/xit/fims/cmmn/Print.java index 52bbbcf8..e80c6614 100644 --- a/src/main/java/cokr/xit/fims/cmmn/Print.java +++ b/src/main/java/cokr/xit/fims/cmmn/Print.java @@ -1,13 +1,12 @@ package cokr.xit.fims.cmmn; +import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; -import java.util.List; import java.util.Map; import cokr.xit.foundation.UserInfo; -import cokr.xit.foundation.data.DataObject; public class Print { @@ -22,10 +21,15 @@ public class Print { protected int fileNameIndex = 0; - private String formatName; + protected String extension; - private String formatKorName; + protected String formatName; + protected String formatKorName; + + public String setExtension(String extension) { + return this.extension = extension; + } public String getFormatName() { return this.formatName; @@ -68,11 +72,6 @@ public class Print { } - public int getTotalDataCount(List dataObjectList) { - int totalDataCount = dataObjectList.size(); - return totalDataCount; - } - public boolean getPrivateInfoYn(PrintOption printOption) { boolean privateInfoYn = true; @@ -91,4 +90,24 @@ public class Print { return map; } + public String pathForNewFile(){ + + SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String currentTime = ymdhmsFormat.format(new Date()); + String year = currentTime.substring(0, 4); + String month = currentTime.substring(4, 6); + String day = currentTime.substring(6, 8); + String formatFileResultRootPath = "files" + File.separator + "result" + File.separator + "print"; + String formatFileResultFolderPath = formatFileResultRootPath + + File.separator + year + File.separator + month + File.separator + day; + File formatFileResultFolder = new File(formatFileResultFolderPath); + if(!formatFileResultFolder.exists()) { + formatFileResultFolder.mkdirs(); + } + String resultPath = formatFileResultFolderPath + File.separator + currentTime +"_"+ this.getFileNameIndex() + "."+this.extension; + + this.setFileNameIndex(this.getFileNameIndex()+1); + + return resultPath; + } } diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/CrdnConfirm.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/CrdnConfirm.java index a1066660..706f299f 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/CrdnConfirm.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/CrdnConfirm.java @@ -74,10 +74,6 @@ public class CrdnConfirm extends HWPFormat { writer.table(0, 0, 13).setValues(List.of(newObj)); - - String tempPath = this.pathForNewFile(currentRunCount+1); - writer.write(tempPath); - resultFilesPath.add(tempPath); } diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/CrdnList.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/CrdnList.java index b165d49f..46dcb93a 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/CrdnList.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/CrdnList.java @@ -65,7 +65,7 @@ public class CrdnList extends HWPFormat { writer.setValue("주민번호", "*************"); } writer.setValue("주소", globalRtpyrFullAddr); - writer.setValue("총건수", DataFormat.n_nn0(print.getTotalDataCount(this.data))); + writer.setValue("총건수", DataFormat.n_nn0(this.data.size())); writer.setValue("총금액", DataFormat.n_nn0(globalTotalAmount)); String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm"); @@ -93,7 +93,7 @@ public class CrdnList extends HWPFormat { writer.table(2, 0, 3).setValues(list); - String tempPath = this.pathForNewFile(currentRunCount+1); + String tempPath = this.print.pathForNewFile(); writer.write(tempPath); resultFilesPath.add(tempPath); diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/CvlcptOrgn.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/CvlcptOrgn.java index 7a9ba3c1..e69070e5 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/CvlcptOrgn.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/CvlcptOrgn.java @@ -54,6 +54,10 @@ public class CvlcptOrgn extends HWPFormat { @Override public HashMap makeFile(){ runAsWriter(); + String tempPath = this.print.pathForNewFile(); + writer.write(tempPath); + resultFilesPath.add(tempPath); + writer = null; currentRunCount++; @@ -63,6 +67,10 @@ public class CvlcptOrgn extends HWPFormat { maxRunCount = data2.size()+1; while(currentRunCount != maxRunCount) { runAsWriter(); + String tempPath_i = this.print.pathForNewFile(); + writer.write(tempPath_i); + resultFilesPath.add(tempPath_i); + writer = null; currentRunCount++; } @@ -120,9 +128,6 @@ public class CvlcptOrgn extends HWPFormat { } - String tempPath = this.pathForNewFile(currentRunCount+1); - writer.write(tempPath); - resultFilesPath.add(tempPath); } diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/DlbrDecsnList.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/DlbrDecsnList.java index 6b5dbdaa..fa5098f8 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/DlbrDecsnList.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/DlbrDecsnList.java @@ -74,9 +74,6 @@ public class DlbrDecsnList extends HWPFormat { writer.setValue("심의회원명7", one.string("DLBR_MBR_NM7")); writer.setValue("담당자검토의견", one.string("PIC_RVW_OPNN")); - String tempPath = this.pathForNewFile(currentRunCount+1); - writer.write(tempPath); - resultFilesPath.add(tempPath); } diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/HWPFormat.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/HWPFormat.java index 73d96f5e..e5612e18 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/HWPFormat.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/HWPFormat.java @@ -1,9 +1,7 @@ package cokr.xit.fims.cmmn.hwp.format; import java.io.File; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Date; import java.util.HashMap; import java.util.List; @@ -35,11 +33,16 @@ public abstract class HWPFormat { this.data = dataObjectList; this.printOption = printOption; this.print = print; + this.print.setExtension("hwp"); } public HashMap makeFile(){ while(currentRunCount != maxRunCount) { runAsWriter(); + String tempPath = this.print.pathForNewFile(); + writer.write(tempPath); + resultFilesPath.add(tempPath); + writer = null; currentRunCount++; } @@ -91,29 +94,6 @@ public abstract class HWPFormat { public abstract List getDownloadDataNames(); - public String pathForNewFile(int fileIndex) { - try { - - SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss"); - String currentTime = ymdhmsFormat.format(new Date()); - String year = currentTime.substring(0, 4); - String month = currentTime.substring(4, 6); - String day = currentTime.substring(6, 8); - String formatFileResultRootPath = "files" + File.separator + "result" + File.separator + "print"; - String formatFileResultFolderPath = formatFileResultRootPath - + File.separator + year + File.separator + month + File.separator + day; - File formatFileResultFolder = new File(formatFileResultFolderPath); - if(!formatFileResultFolder.exists()) { - formatFileResultFolder.mkdirs(); - } - String resultHwpPath = formatFileResultFolderPath + File.separator + currentTime +"_"+fileIndex+ ".hwp"; - - return resultHwpPath; - } catch (Exception e){ - throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다."); - } - - } } diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/RcvmtConfirm.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/RcvmtConfirm.java index d93c2387..28d66a37 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/RcvmtConfirm.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/RcvmtConfirm.java @@ -77,10 +77,6 @@ public class RcvmtConfirm extends HWPFormat { writer.table(0, 0, 12).setValues(List.of(newObj)); - String tempPath = this.pathForNewFile(currentRunCount+1); - writer.write(tempPath); - resultFilesPath.add(tempPath); - } diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/ReportOnClaims.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/ReportOnClaims.java index 1813675c..edc894a4 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/ReportOnClaims.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/ReportOnClaims.java @@ -108,10 +108,6 @@ public class ReportOnClaims extends HWPFormat { }).toList(); writer.table(0, 9, 2).setValues(list); - String tempPath = this.pathForNewFile(currentRunCount+1); - writer.write(tempPath); - resultFilesPath.add(tempPath); - } diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/RequestForDelivery.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/RequestForDelivery.java index 639b8ad7..1d0dcacd 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/RequestForDelivery.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/RequestForDelivery.java @@ -111,10 +111,6 @@ public class RequestForDelivery extends HWPFormat { }).toList(); writer.table(0, 9, 1).setValues(list); - String tempPath = this.pathForNewFile(currentRunCount+1); - writer.write(tempPath); - resultFilesPath.add(tempPath); - } diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/SvbtcList.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/SvbtcList.java index 0a5d7a57..6dcd728c 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/SvbtcList.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/SvbtcList.java @@ -81,9 +81,6 @@ public class SvbtcList extends HWPFormat { }).toList(); writer.table(2, 2, 2).setValues(list); - String tempPath = this.pathForNewFile(currentRunCount+1); - writer.write(tempPath); - resultFilesPath.add(tempPath); } 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 595e8714..cdccacbd 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 @@ -4,10 +4,8 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Comparator; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -54,6 +52,7 @@ public abstract class PDFPrintFormat { initDefaultStng(); this.print = print; + this.print.setExtension("pdf"); this.printOption = printOption; this.otptBscStng = otptBscStng; this.otptArtclStngList = otptArtclStngList; @@ -231,7 +230,7 @@ public abstract class PDFPrintFormat { PDFWriter writer = new PDFWriter(); - String resultFilePath = this.filePathForNewFile(); + String resultFilePath = this.print.pathForNewFile(); //폰트 로드 @@ -466,36 +465,6 @@ public abstract class PDFPrintFormat { - - - - - - public String filePathForNewFile() { - - SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss"); - String currentTime = ymdhmsFormat.format(new Date()); - String year = currentTime.substring(0, 4); - String month = currentTime.substring(4, 6); - String day = currentTime.substring(6, 8); - - String fileResultRootPath = "files" + File.separator + "result" + File.separator + "print"; - - String fileResultFolderPath = fileResultRootPath - + File.separator + year + File.separator + month + File.separator + day; - File formatFileResultFolder = new File(fileResultFolderPath); - if(!formatFileResultFolder.exists()) { - formatFileResultFolder.mkdirs(); - } - String resultPdfPath = fileResultFolderPath - + File.separator + currentTime + "_" + (print.getFileNameIndex()) + ".pdf"; - - this.print.setFileNameIndex(this.print.getFileNameIndex()+1); - - return resultPdfPath; - - } - /** * mm단위로 입력된 값을 pdf좌표계 형식으로 변환한다. */ diff --git a/src/main/java/cokr/xit/fims/cmmn/xls/FormatMaker.java b/src/main/java/cokr/xit/fims/cmmn/xls/FormatMaker.java index d0d39fdd..4e272d98 100644 --- a/src/main/java/cokr/xit/fims/cmmn/xls/FormatMaker.java +++ b/src/main/java/cokr/xit/fims/cmmn/xls/FormatMaker.java @@ -12,6 +12,7 @@ import cokr.xit.foundation.data.DataFormat; public class FormatMaker { + @SuppressWarnings("rawtypes") public static Format photoCellForApproval(Format format, Comment comment, String key) { return format.of(key) .value(obj -> { @@ -47,6 +48,7 @@ public class FormatMaker { } + @SuppressWarnings("rawtypes") public static Format yyyy_mm_dd_hh_mm_ss(Format format, String key) { return format.of(key).value(o -> { return DataFormat.yyyy_mm_dd_hh_mm_ss(((Map) o).get(key)); @@ -54,6 +56,7 @@ public class FormatMaker { } + @SuppressWarnings("rawtypes") public static Format yyyy_mm_dd(Format format, String key) { return format.of(key).value(o -> { return DataFormat.yyyy_mm_dd(((Map) o).get(key)); diff --git a/src/main/java/cokr/xit/fims/nxrp/service/bean/NisIndivBean.java b/src/main/java/cokr/xit/fims/nxrp/service/bean/NisIndivBean.java index d170d478..4c4ffb54 100644 --- a/src/main/java/cokr/xit/fims/nxrp/service/bean/NisIndivBean.java +++ b/src/main/java/cokr/xit/fims/nxrp/service/bean/NisIndivBean.java @@ -19,7 +19,6 @@ import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper;