|
|
|
@ -5,6 +5,8 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.stream.IntStream;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
@ -232,7 +234,7 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
@RequestMapping(value="/makeDisposeResultReportHwp.do", name="폐기결과보고서 HWP파일 생성")
|
|
|
|
|
public ModelAndView makeDisposeResultReportHwp(String dtls) {
|
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
|
mav.setViewName("jsonView");
|
|
|
|
|
mav.setViewName("downloadView");
|
|
|
|
|
|
|
|
|
|
List<DataObject> dataForDoc = fromJson(dtls, new TypeReference<ArrayList<DataObject>>() {});
|
|
|
|
|
|
|
|
|
@ -271,29 +273,36 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
//1.한글문서파일 데이터 입력
|
|
|
|
|
DisposeResultReport form = new DisposeResultReport(print, printOption, dataForDoc);
|
|
|
|
|
//2.한글문서파일 생성
|
|
|
|
|
String resultFilePath = form.makeFile().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("01").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();
|
|
|
|
|
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("01").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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
file.delete();
|
|
|
|
|
|
|
|
|
|
mav.addObject("fileId", newFileId);
|
|
|
|
|
mav.addObject("saved", true);
|
|
|
|
|
//4.다운로드
|
|
|
|
|
HashMap<String, Object> result = form.andDownload();
|
|
|
|
|
mav.addAllObjects(result);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -302,7 +311,7 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
@RequestMapping(value="/makeDisposeProcessDetailsHwp.do", name="폐기 처리 내역 및 사진 HWP파일 생성")
|
|
|
|
|
public ModelAndView makeDisposeProcessDetailsHwp(String dtls) {
|
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
|
mav.setViewName("jsonView");
|
|
|
|
|
mav.setViewName("downloadView");
|
|
|
|
|
|
|
|
|
|
List<DataObject> dataForDoc = fromJson(dtls, new TypeReference<ArrayList<DataObject>>() {});
|
|
|
|
|
|
|
|
|
@ -383,29 +392,37 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
//1.한글문서파일 데이터 입력
|
|
|
|
|
DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataForDoc, partitions);
|
|
|
|
|
//2.한글문서파일 생성
|
|
|
|
|
String resultFilePath = form.makeFile().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();
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
file.delete();
|
|
|
|
|
|
|
|
|
|
mav.addObject("fileId", newFileId);
|
|
|
|
|
mav.addObject("saved", true);
|
|
|
|
|
//4.다운로드
|
|
|
|
|
HashMap<String, Object> result = form.andDownload();
|
|
|
|
|
mav.addAllObjects(result);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
|