|
|
@ -5,6 +5,8 @@ import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import java.util.stream.IntStream;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
@ -232,7 +234,7 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
@RequestMapping(value="/makeDisposeResultReportHwp.do", name="폐기결과보고서 HWP파일 생성")
|
|
|
|
@RequestMapping(value="/makeDisposeResultReportHwp.do", name="폐기결과보고서 HWP파일 생성")
|
|
|
|
public ModelAndView makeDisposeResultReportHwp(String dtls) {
|
|
|
|
public ModelAndView makeDisposeResultReportHwp(String dtls) {
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
mav.setViewName("jsonView");
|
|
|
|
mav.setViewName("downloadView");
|
|
|
|
|
|
|
|
|
|
|
|
List<DataObject> dataForDoc = fromJson(dtls, new TypeReference<ArrayList<DataObject>>() {});
|
|
|
|
List<DataObject> dataForDoc = fromJson(dtls, new TypeReference<ArrayList<DataObject>>() {});
|
|
|
|
|
|
|
|
|
|
|
@ -271,29 +273,36 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
//1.한글문서파일 데이터 입력
|
|
|
|
//1.한글문서파일 데이터 입력
|
|
|
|
DisposeResultReport form = new DisposeResultReport(print, printOption, dataForDoc);
|
|
|
|
DisposeResultReport form = new DisposeResultReport(print, printOption, dataForDoc);
|
|
|
|
//2.한글문서파일 생성
|
|
|
|
//2.한글문서파일 생성
|
|
|
|
String resultFilePath = form.makeFile().andGetPath();
|
|
|
|
form.makeFile();
|
|
|
|
File file = new File(resultFilePath);
|
|
|
|
//3.DB 저장, 스토리지 저장
|
|
|
|
String newFileId = "";
|
|
|
|
List<String> dscdmngIds = IntStream.rangeClosed(1, dataForDoc.size()).boxed().map(i -> {
|
|
|
|
String before = "";
|
|
|
|
return dataForDoc.get(i-1).string("dscdmngId");
|
|
|
|
boolean changeDscdmngId = false;
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
for(DataObject data : dataForDoc) {
|
|
|
|
boolean allEqual = dscdmngIds.stream().distinct().count() <= 1;
|
|
|
|
if(!before.equals(data.string("dscdmngId"))) {
|
|
|
|
if(allEqual) {
|
|
|
|
changeDscdmngId = true;
|
|
|
|
String resultFilePath = form.andGetPath();
|
|
|
|
} else {
|
|
|
|
File file = new File(resultFilePath);
|
|
|
|
changeDscdmngId = false;
|
|
|
|
String newFileId = "";
|
|
|
|
}
|
|
|
|
String before = "";
|
|
|
|
if(changeDscdmngId) {
|
|
|
|
boolean changeDscdmngId = false;
|
|
|
|
Relation rel = new Relation().setInfoType("200").setSubType("01").setInfoKey(data.string("dscdmngId"));
|
|
|
|
for(DataObject data : dataForDoc) {
|
|
|
|
FileInfo fileInfo = new FileInfo.Factory().create(rel, file);
|
|
|
|
if(!before.equals(data.string("dscdmngId"))) {
|
|
|
|
fileInfo.setName(print.getFormatKorName()+".hwp");
|
|
|
|
changeDscdmngId = true;
|
|
|
|
int effected = fileService.create(fileInfo);
|
|
|
|
} else {
|
|
|
|
newFileId = fileInfo.getId();
|
|
|
|
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();
|
|
|
|
//4.다운로드
|
|
|
|
|
|
|
|
HashMap<String, Object> result = form.andDownload();
|
|
|
|
mav.addObject("fileId", newFileId);
|
|
|
|
mav.addAllObjects(result);
|
|
|
|
mav.addObject("saved", true);
|
|
|
|
|
|
|
|
return mav;
|
|
|
|
return mav;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -302,7 +311,7 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
@RequestMapping(value="/makeDisposeProcessDetailsHwp.do", name="폐기 처리 내역 및 사진 HWP파일 생성")
|
|
|
|
@RequestMapping(value="/makeDisposeProcessDetailsHwp.do", name="폐기 처리 내역 및 사진 HWP파일 생성")
|
|
|
|
public ModelAndView makeDisposeProcessDetailsHwp(String dtls) {
|
|
|
|
public ModelAndView makeDisposeProcessDetailsHwp(String dtls) {
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
mav.setViewName("jsonView");
|
|
|
|
mav.setViewName("downloadView");
|
|
|
|
|
|
|
|
|
|
|
|
List<DataObject> dataForDoc = fromJson(dtls, new TypeReference<ArrayList<DataObject>>() {});
|
|
|
|
List<DataObject> dataForDoc = fromJson(dtls, new TypeReference<ArrayList<DataObject>>() {});
|
|
|
|
|
|
|
|
|
|
|
@ -383,29 +392,37 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
//1.한글문서파일 데이터 입력
|
|
|
|
//1.한글문서파일 데이터 입력
|
|
|
|
DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataForDoc, partitions);
|
|
|
|
DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataForDoc, partitions);
|
|
|
|
//2.한글문서파일 생성
|
|
|
|
//2.한글문서파일 생성
|
|
|
|
String resultFilePath = form.makeFile().andGetPath();
|
|
|
|
form.makeFile();
|
|
|
|
File file = new File(resultFilePath);
|
|
|
|
//3.DB 저장, 스토리지 저장
|
|
|
|
String newFileId = "";
|
|
|
|
List<String> dscdmngIds = IntStream.rangeClosed(1, dataForDoc.size()).boxed().map(i -> {
|
|
|
|
before = "";
|
|
|
|
return dataForDoc.get(i-1).string("dscdmngId");
|
|
|
|
changeDscdmngId = false;
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
for(DataObject data : dataForDoc) {
|
|
|
|
boolean allEqual = dscdmngIds.stream().distinct().count() <= 1;
|
|
|
|
if(!before.equals(data.string("dscdmngId"))) {
|
|
|
|
if(allEqual) {
|
|
|
|
changeDscdmngId = true;
|
|
|
|
String resultFilePath = form.andGetPath();
|
|
|
|
} else {
|
|
|
|
File file = new File(resultFilePath);
|
|
|
|
changeDscdmngId = false;
|
|
|
|
String newFileId = "";
|
|
|
|
}
|
|
|
|
before = "";
|
|
|
|
if(changeDscdmngId) {
|
|
|
|
changeDscdmngId = false;
|
|
|
|
Relation rel = new Relation().setInfoType("200").setSubType("02").setInfoKey(data.string("dscdmngId"));
|
|
|
|
for(DataObject data : dataForDoc) {
|
|
|
|
FileInfo fileInfo = new FileInfo.Factory().create(rel, file);
|
|
|
|
if(!before.equals(data.string("dscdmngId"))) {
|
|
|
|
fileInfo.setName(print.getFormatKorName()+".hwp");
|
|
|
|
changeDscdmngId = true;
|
|
|
|
int effected= fileService.create(fileInfo);
|
|
|
|
} else {
|
|
|
|
newFileId = fileInfo.getId();
|
|
|
|
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);
|
|
|
|
//4.다운로드
|
|
|
|
mav.addObject("saved", true);
|
|
|
|
HashMap<String, Object> result = form.andDownload();
|
|
|
|
|
|
|
|
mav.addAllObjects(result);
|
|
|
|
return mav;
|
|
|
|
return mav;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|