From e3bdc6241f695f0abc4ce6fbd12ca3f9cde37b43 Mon Sep 17 00:00:00 2001 From: leebj Date: Tue, 9 Jul 2024 10:13:28 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=8A=A4=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/adds/nims/web/AddsNimsController.java | 78 ++++++++++--------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java index 5be4166..c209c22 100644 --- a/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java +++ b/src/main/java/cokr/xit/adds/nims/web/AddsNimsController.java @@ -350,6 +350,46 @@ public class AddsNimsController extends ApplicationController { } //폐기증거사진 + List partitions = this.getPartitions(dataForDoc); + + //1.한글문서파일 데이터 입력 + DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataForDoc, partitions); + //2.한글문서파일 생성 + form.makeFile(); + //3.DB 저장, 스토리지 저장 + List dscdmngIds = IntStream.rangeClosed(1, dataForDoc.size()).boxed().map(i -> { + return dataForDoc.get(i-1).string("dscdmngId"); + }).collect(Collectors.toList()); + boolean allEqual = dscdmngIds.stream().distinct().count() <= 1; + if(allEqual) { + String resultFilePath = form.andGetPath(); + File file = new File(resultFilePath); + String newFileId = ""; + String before = ""; + boolean changeDscdmngId = false; + for(DataObject data : dataForDoc) { + if(!before.equals(data.string("dscdmngId"))) { + changeDscdmngId = true; + } else { + changeDscdmngId = false; + } + if(changeDscdmngId) { + Relation rel = new Relation().setInfoType("200").setSubType("02").setInfoKey(data.string("dscdmngId")); + FileInfo fileInfo = new FileInfo.Factory().create(rel, file); + fileInfo.setName(print.getFormatKorName()+".hwp"); + int effected= fileService.create(fileInfo); + newFileId = fileInfo.getId(); + } + } + } + + //4.다운로드 + HashMap result = form.andDownload(); + mav.addAllObjects(result); + return mav; + } + + private List getPartitions(List dataForDoc){ List partitions = new ArrayList<>(); String before = ""; boolean changeDscdmngId = false; @@ -389,43 +429,9 @@ public class AddsNimsController extends ApplicationController { } } - - //1.한글문서파일 데이터 입력 - DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataForDoc, partitions); - //2.한글문서파일 생성 - form.makeFile(); - //3.DB 저장, 스토리지 저장 - List dscdmngIds = IntStream.rangeClosed(1, dataForDoc.size()).boxed().map(i -> { - return dataForDoc.get(i-1).string("dscdmngId"); - }).collect(Collectors.toList()); - boolean allEqual = dscdmngIds.stream().distinct().count() <= 1; - if(allEqual) { - String resultFilePath = form.andGetPath(); - File file = new File(resultFilePath); - String newFileId = ""; - before = ""; - changeDscdmngId = false; - for(DataObject data : dataForDoc) { - if(!before.equals(data.string("dscdmngId"))) { - changeDscdmngId = true; - } else { - changeDscdmngId = false; - } - if(changeDscdmngId) { - Relation rel = new Relation().setInfoType("200").setSubType("02").setInfoKey(data.string("dscdmngId")); - FileInfo fileInfo = new FileInfo.Factory().create(rel, file); - fileInfo.setName(print.getFormatKorName()+".hwp"); - int effected= fileService.create(fileInfo); - newFileId = fileInfo.getId(); - } - } - } - - //4.다운로드 - HashMap result = form.andDownload(); - mav.addAllObjects(result); - return mav; + return partitions; } + //------------------------------------------------------------------------------------------------- // 보고 문서 관리 //-------------------------------------------------------------------------------------------------