Leeyh1121 4 months ago
commit c581168dea

@ -350,6 +350,46 @@ public class AddsNimsController extends ApplicationController {
}
//폐기증거사진
List<DataObject> partitions = this.getPartitions(dataForDoc);
//1.한글문서파일 데이터 입력
DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataForDoc, partitions);
//2.한글문서파일 생성
form.makeFile();
//3.DB 저장, 스토리지 저장
List<String> 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<String, Object> result = form.andDownload();
mav.addAllObjects(result);
return mav;
}
private List<DataObject> getPartitions(List<DataObject> dataForDoc){
List<DataObject> 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<String> 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();
}
}
return partitions;
}
//4.다운로드
HashMap<String, Object> result = form.andDownload();
mav.addAllObjects(result);
return mav;
}
//-------------------------------------------------------------------------------------------------
// 보고 문서 관리
//-------------------------------------------------------------------------------------------------

Loading…
Cancel
Save