한글파일 생성 경로 수정(연월일 추가)

main
이범준 1 year ago
parent 6e82c29613
commit 956aadf74e

@ -144,17 +144,23 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv
FieldFinder.setClickHereText(baseFormatFile, "민원내용", strings); FieldFinder.setClickHereText(baseFormatFile, "민원내용", strings);
String currentTime = ymdhmsFormat.format(new Date()); 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"; String formatFileResultRootPath = "files" + File.separator + "result" + File.separator + "print";
File formatFileResultRootFolder = new File(formatFileResultRootPath); String formatFileResultFolderPath = formatFileResultRootPath
if(!formatFileResultRootFolder.exists()) { + File.separator + year + File.separator + month + File.separator + day;
formatFileResultRootFolder.mkdirs();
File formatFileResultFolder = new File(formatFileResultFolderPath);
if(!formatFileResultFolder.exists()) {
formatFileResultFolder.mkdirs();
} }
String resultPath = formatFileResultRootPath + File.separator + currentTime + ".hwp"; String resultHwpPath = formatFileResultFolderPath + File.separator + currentTime + ".hwp";
HWPWriter.toFile(baseFormatFile, resultPath); HWPWriter.toFile(baseFormatFile, resultHwpPath);
HWPFile resultFile = HWPReader.fromFile(resultPath); HWPFile resultFile = HWPReader.fromFile(resultHwpPath);
String linkTblNm = dataObject.string("LINK_TBL_NM"); String linkTblNm = dataObject.string("LINK_TBL_NM");
if(!linkTblNm.equals("")) { if(!linkTblNm.equals("")) {
@ -193,13 +199,13 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv
AddingParagraphBetweenHWPFile.fileMerge(attachFormatFile, resultFile); AddingParagraphBetweenHWPFile.fileMerge(attachFormatFile, resultFile);
} }
HWPWriter.toFile(resultFile, resultPath); HWPWriter.toFile(resultFile, resultHwpPath);
} }
} }
String downlaodFileName = "민원내역원본_" + currentTime + ".hwp"; String downlaodFileName = "민원내역원본_" + currentTime + ".hwp";
Map<String, String> result = Map.of( Map<String, String> result = Map.of(
"filePath", resultPath, "filePath", resultHwpPath,
"fileName", downlaodFileName "fileName", downlaodFileName
); );

Loading…
Cancel
Save