|
|
|
@ -15,9 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
import net.minidev.json.JSONObject;
|
|
|
|
|
import net.minidev.json.parser.ParseException;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
|
|
|
|
|
@ -45,6 +42,8 @@ import cokr.xit.base.user.service.SigunguDepartmentService;
|
|
|
|
|
import cokr.xit.base.web.ApplicationController;
|
|
|
|
|
import cokr.xit.foundation.data.DataObject;
|
|
|
|
|
import cokr.xit.foundation.data.JSON;
|
|
|
|
|
import net.minidev.json.JSONObject;
|
|
|
|
|
import net.minidev.json.parser.ParseException;
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
|
@RequestMapping(
|
|
|
|
@ -232,7 +231,6 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/makeDisposeResultReportHwp.do", name="폐기결과보고서 HWP파일 생성")
|
|
|
|
|
public ModelAndView makeDisposeResultReportHwp(String dtls) {
|
|
|
|
|
|
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
|
mav.setViewName("jsonView");
|
|
|
|
|
|
|
|
|
@ -270,18 +268,31 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//1.한글문서파일 데이터 입력
|
|
|
|
|
DisposeResultReport form = new DisposeResultReport(print, printOption, dataForDoc);
|
|
|
|
|
//2.한글문서파일 생성
|
|
|
|
|
String resultFilePath = form.makeFile().andGetPath();
|
|
|
|
|
|
|
|
|
|
File file = new File(resultFilePath);
|
|
|
|
|
Relation rel = new Relation().setInfoType("200").setSubType("01").setInfoKey(dataForDoc.get(0).string("dscdmngId"));
|
|
|
|
|
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);
|
|
|
|
|
String fileId = fileInfo.getId();
|
|
|
|
|
newFileId = fileInfo.getId();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
file.delete();
|
|
|
|
|
|
|
|
|
|
mav.addObject("fileId",fileId);
|
|
|
|
|
mav.addObject("fileId", newFileId);
|
|
|
|
|
mav.addObject("saved", true);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
@ -290,7 +301,6 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/makeDisposeProcessDetailsHwp.do", name="폐기 처리 내역 및 사진 HWP파일 생성")
|
|
|
|
|
public ModelAndView makeDisposeProcessDetailsHwp(String dtls) {
|
|
|
|
|
|
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
|
mav.setViewName("jsonView");
|
|
|
|
|
|
|
|
|
@ -306,25 +316,8 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
Map<String,String> globalVariable = new HashMap<String,String>();
|
|
|
|
|
printOption.setGlobalVariable(globalVariable);
|
|
|
|
|
|
|
|
|
|
//폐기증거사진
|
|
|
|
|
List<DataObject> dsuseimgs = fileService.getFileList(
|
|
|
|
|
new FileQuery().setInfoType("110").setInfoKeys(dataForDoc.get(0).string("dscdmngId"))
|
|
|
|
|
);
|
|
|
|
|
if(dsuseimgs == null) { dsuseimgs = new ArrayList<DataObject>(); }
|
|
|
|
|
dsuseimgs = dsuseimgs.stream()
|
|
|
|
|
.filter((item) -> item.string("USE_YN").equals("Y"))
|
|
|
|
|
.sorted((item1, item2) -> {
|
|
|
|
|
int a = item1.number("SRT_ORD").intValue();
|
|
|
|
|
int b = item2.number("SRT_ORD").intValue();
|
|
|
|
|
return (a < b) ? -1 : ((a == b) ? 0 : 1);
|
|
|
|
|
})
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
List<String> dsuseimgPaths = new ArrayList<>();
|
|
|
|
|
for(DataObject dsuseimg : dsuseimgs) {
|
|
|
|
|
dsuseimgPaths.add(dsuseimg.string("FILE_PATH"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//제품사진
|
|
|
|
|
for(DataObject data : dataForDoc) {
|
|
|
|
|
String infKey = data.string("dscdmngId");
|
|
|
|
|
String subType = data.string("dscdmngSn");
|
|
|
|
@ -346,18 +339,72 @@ public class AddsNimsController extends ApplicationController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataForDoc, dsuseimgPaths);
|
|
|
|
|
String resultFilePath = form.makeFile().andGetPath();
|
|
|
|
|
//폐기증거사진
|
|
|
|
|
List<DataObject> partitions = new ArrayList<>();
|
|
|
|
|
String before = "";
|
|
|
|
|
boolean changeDscdmngId = false;
|
|
|
|
|
for(DataObject data : dataForDoc) {
|
|
|
|
|
if(!before.equals(data.string("dscdmngId"))) {
|
|
|
|
|
changeDscdmngId = true;
|
|
|
|
|
before = data.string("dscdmngId");
|
|
|
|
|
} else {
|
|
|
|
|
changeDscdmngId = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(changeDscdmngId) {
|
|
|
|
|
DataObject partition = new DataObject();
|
|
|
|
|
partition.set("dsuseMthNm", data.string("dsuseMthNm"));
|
|
|
|
|
partition.set("bsshNm0", data.string("bsshNm0"));
|
|
|
|
|
|
|
|
|
|
List<DataObject> dsuseimgs = fileService.getFileList(
|
|
|
|
|
new FileQuery().setInfoType("110").setInfoKeys(data.string("dscdmngId"))
|
|
|
|
|
);
|
|
|
|
|
if(dsuseimgs == null) { dsuseimgs = new ArrayList<DataObject>(); }
|
|
|
|
|
dsuseimgs = dsuseimgs.stream()
|
|
|
|
|
.filter((item) -> item.string("USE_YN").equals("Y"))
|
|
|
|
|
.sorted((item1, item2) -> {
|
|
|
|
|
int a = item1.number("SRT_ORD").intValue();
|
|
|
|
|
int b = item2.number("SRT_ORD").intValue();
|
|
|
|
|
return (a < b) ? -1 : ((a == b) ? 0 : 1);
|
|
|
|
|
})
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
List<String> dsuseimgPaths = new ArrayList<String>();
|
|
|
|
|
for(DataObject dsuseimg : dsuseimgs) {
|
|
|
|
|
dsuseimgPaths.add(dsuseimg.string("FILE_PATH"));
|
|
|
|
|
}
|
|
|
|
|
partition.set("dsuseimgPaths", dsuseimgPaths);
|
|
|
|
|
|
|
|
|
|
partitions.add(partition);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//1.한글문서파일 데이터 입력
|
|
|
|
|
DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataForDoc, partitions);
|
|
|
|
|
//2.한글문서파일 생성
|
|
|
|
|
String resultFilePath = form.makeFile().andGetPath();
|
|
|
|
|
File file = new File(resultFilePath);
|
|
|
|
|
Relation rel = new Relation().setInfoType("200").setSubType("02").setInfoKey(dataForDoc.get(0).string("dscdmngId"));
|
|
|
|
|
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);
|
|
|
|
|
String fileId = fileInfo.getId();
|
|
|
|
|
newFileId = fileInfo.getId();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
file.delete();
|
|
|
|
|
|
|
|
|
|
mav.addObject("fileId",fileId);
|
|
|
|
|
mav.addObject("fileId", newFileId);
|
|
|
|
|
mav.addObject("saved", true);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|