보고문서관리 수정(다건 출력)

dev
이범준 4 months ago
parent e0a024a381
commit 455ced0953

@ -16,7 +16,8 @@ public class DisposeProcessDetails extends HWPFormat {
private List<DataObject> data2 = null; //폐기전 사진 private List<DataObject> data2 = null; //폐기전 사진
private List<DataObject> data3 = null; //폐기증거 사진 private List<DataObject> data3 = null; //폐기증거 사진
public DisposeProcessDetails(Print print, PrintOption printOption, List<DataObject> dataObjectList, List<String> afterPhotoPaths) { public DisposeProcessDetails(Print print, PrintOption printOption, List<DataObject> dataObjectList
, List<DataObject> partitions) {
super(print, printOption, dataObjectList); super(print, printOption, dataObjectList);
this.print.setFormatKorName("폐기처리내역및사진"); this.print.setFormatKorName("폐기처리내역및사진");
@ -47,7 +48,13 @@ public class DisposeProcessDetails extends HWPFormat {
} }
this.data3 = new ArrayList<DataObject>(); this.data3 = new ArrayList<DataObject>();
for(int i=0;i<afterPhotoPaths.size();i++) { for(int a=0;a<partitions.size();a++) {
DataObject partitionN = partitions.get(a);
String titleArg1 = partitionN.string("dsuseMthNm");
String titleArg2 = partitionN.string("bsshNm0");
List<String> photos = (List<String>)partitionN.get("dsuseimgPaths");
for(int i=0;i<photos.size();i++) {
int mod = (i+1) % 6; int mod = (i+1) % 6;
if(mod == 0) { if(mod == 0) {
@ -55,12 +62,16 @@ public class DisposeProcessDetails extends HWPFormat {
} }
if(mod == 1) { if(mod == 1) {
page = new DataObject(); page = new DataObject();
page.set("폐기증거제목", "사고마약류 등 가수분해 사진"); if(i == 0) {
page.set("폐기증거제목", "사고마약류 등 "+titleArg1+" 사진"+"("+titleArg2+")");
} else {
page.set("폐기증거제목", "");
}
} }
page.set("폐기증거사진"+mod+"경로", afterPhotoPaths.get(i)); page.set("폐기증거사진"+mod+"경로", photos.get(i));
if(mod == 6 || i == afterPhotoPaths.size()-1) { if(mod == 6 || i == photos.size()-1) {
data3.add(page); data3.add(page);
page = null; page = null;
} }
@ -68,6 +79,8 @@ public class DisposeProcessDetails extends HWPFormat {
} }
}
@Override @Override
public HWPFormat makeFile(){ public HWPFormat makeFile(){
HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath); HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
@ -133,7 +146,7 @@ public class DisposeProcessDetails extends HWPFormat {
DataObject one = data.get(i-1); DataObject one = data.get(i-1);
return (DataObject) new DataObject() return (DataObject) new DataObject()
.set("번호", i) .set("번호", i)
.set("업소명", one.string("bsshNm")) .set("업소명", one.string("bsshNm0"))
.set("폐기사유", one.string("dsusePrvNm")) .set("폐기사유", one.string("dsusePrvNm"))
.set("폐기장소", one.string("dsuseLoc")) .set("폐기장소", one.string("dsuseLoc"))
.set("폐기방법", one.string("dsuseMthNm")) .set("폐기방법", one.string("dsuseMthNm"))

@ -29,9 +29,9 @@ public class DisposeResultReport extends HWPFormat {
DataObject one = data.get(i-1); DataObject one = data.get(i-1);
return (DataObject) new DataObject() return (DataObject) new DataObject()
.set("연번-항목", i) .set("연번-항목", i)
.set("폐기신청인-업소명", one.string("bsshNm")) .set("폐기신청인-업소명", one.string("bsshNm0"))
.set("폐기신청인-허가종별", one.string("indutyNm")) .set("폐기신청인-허가종별", one.string("indutyNm"))
.set("폐기신청인-마약류취급자식별번호", one.string("bsshCd")) .set("폐기신청인-마약류취급자식별번호", one.string("bsshCd0"))
.set("폐기정보-폐기일자", DataFormat.yyyy_mm_dd(one.string("dsuseDe"))) .set("폐기정보-폐기일자", DataFormat.yyyy_mm_dd(one.string("dsuseDe")))
.set("폐기정보-폐기종류", one.string("dsuseSeNm")) .set("폐기정보-폐기종류", one.string("dsuseSeNm"))
.set("폐기정보-폐기사유", one.string("dsusePrvNm")) .set("폐기정보-폐기사유", one.string("dsusePrvNm"))

@ -15,9 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; 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.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; 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.base.web.ApplicationController;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.data.JSON; import cokr.xit.foundation.data.JSON;
import net.minidev.json.JSONObject;
import net.minidev.json.parser.ParseException;
@Controller @Controller
@RequestMapping( @RequestMapping(
@ -232,7 +231,6 @@ 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("jsonView");
@ -270,18 +268,31 @@ public class AddsNimsController extends ApplicationController {
} }
//1.한글문서파일 데이터 입력
DisposeResultReport form = new DisposeResultReport(print, printOption, dataForDoc); DisposeResultReport form = new DisposeResultReport(print, printOption, dataForDoc);
//2.한글문서파일 생성
String resultFilePath = form.makeFile().andGetPath(); String resultFilePath = form.makeFile().andGetPath();
File file = new File(resultFilePath); 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 fileInfo = new FileInfo.Factory().create(rel, file);
fileInfo.setName(print.getFormatKorName()+".hwp"); fileInfo.setName(print.getFormatKorName()+".hwp");
int effected= fileService.create(fileInfo); int effected = fileService.create(fileInfo);
String fileId = fileInfo.getId(); newFileId = fileInfo.getId();
}
}
file.delete(); file.delete();
mav.addObject("fileId",fileId); mav.addObject("fileId", newFileId);
mav.addObject("saved", true); mav.addObject("saved", true);
return mav; return mav;
} }
@ -290,7 +301,6 @@ 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("jsonView");
@ -306,25 +316,8 @@ public class AddsNimsController extends ApplicationController {
Map<String,String> globalVariable = new HashMap<String,String>(); Map<String,String> globalVariable = new HashMap<String,String>();
printOption.setGlobalVariable(globalVariable); 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) { for(DataObject data : dataForDoc) {
String infKey = data.string("dscdmngId"); String infKey = data.string("dscdmngId");
String subType = data.string("dscdmngSn"); 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); 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 fileInfo = new FileInfo.Factory().create(rel, file);
fileInfo.setName(print.getFormatKorName()+".hwp"); fileInfo.setName(print.getFormatKorName()+".hwp");
int effected= fileService.create(fileInfo); int effected= fileService.create(fileInfo);
String fileId = fileInfo.getId(); newFileId = fileInfo.getId();
}
}
file.delete(); file.delete();
mav.addObject("fileId",fileId); mav.addObject("fileId", newFileId);
mav.addObject("saved", true); mav.addObject("saved", true);
return mav; return mav;
} }

@ -94,6 +94,10 @@
<tr id="theadTr--${pageName}" <tr id="theadTr--${pageName}"
data-by="by--${pageName}" data-by-output="byOutput--${pageName}" data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}"> data-by="by--${pageName}" data-by-output="byOutput--${pageName}" data-main-option="mainOption--${pageName}" data-sub-option="subOption--${pageName}">
<th class="cmn" style="width: 72px;">No.</th> <th class="cmn" style="width: 72px;">No.</th>
<th class="cmn" style="width: 50px;">
<input type="checkbox" class="form-check-input" id="gridAllCheckbox--${pageName}"
onchange="pageObject['${pageName}'].control.select(this.checked);" />
</th>
<th class="cmn" style="width: 130.141px;">폐기관리번호</th> <th class="cmn" style="width: 130.141px;">폐기관리번호</th>
<th class="cmn" style="width: 120.141px;">취급일자</th> <th class="cmn" style="width: 120.141px;">취급일자</th>
<th class="cmn" style="width: 120.469px;">폐기일자</th> <th class="cmn" style="width: 120.469px;">폐기일자</th>
@ -113,6 +117,10 @@
<template id="${infoPrefix}Row--${pageName}"> <template id="${infoPrefix}Row--${pageName}">
<tr data-key="{dscdmng_id}"> <tr data-key="{dscdmng_id}">
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ROW_NUM}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{ROW_NUM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">
<input type="checkbox" class="form-check-input" name="gridCheckbox" value="{dscdmng_id}"
onchange="pageObject['${pageName}'].control.select('{dscdmng_id}', this.checked);">
</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{dscdmng_id}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{dscdmng_id}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{hdr_de}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{hdr_de}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{dsuse_de}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{dsuse_de}</td>
@ -214,19 +222,45 @@
$P.control.onCurrentChange = (item) => { $P.control.onCurrentChange = (item) => {
if (!item) { if (!item) {
$("#btnCreateDsuseRsltDoc--${pageName}").prop("disabled", true);
$("#btnCreateDsuseRsltListPhoto--${pageName}").prop("disabled", true);
return; return;
} }
if(!${currentUser.hasAuthorities("ROLE_MANAGER")} && !${currentUser.hasAuthorities("ROLE_ADMIN")}) {
$("#btnCreateDsuseRsltDoc--${pageName}").prop("disabled", false);
$("#btnCreateDsuseRsltListPhoto--${pageName}").prop("disabled", false);
}
let key = item.data.dscdmng_id; let key = item.data.dscdmng_id;
$("#tbody--${pageName}").setCurrentRow(key); $("#tbody--${pageName}").setCurrentRow(key);
}; };
// 체크 자료 변경 이벤트
$P.control.onSelectionChange = (selected) => {
let list = $P.control.dataset;
let keys = selected.map(e => list.getKey(e));
//버튼
$("#btnCreateDsuseRsltDoc--${pageName}").prop("disabled", keys.length < 1);
$("#btnCreateDsuseRsltListPhoto--${pageName}").prop("disabled", keys.length < 1);
if(${currentUser.hasAuthorities("ROLE_MANAGER")} || ${currentUser.hasAuthorities("ROLE_ADMIN")}) {
$("#btnCreateDsuseRsltDoc--${pageName}").prop("disabled", true);
$("#btnCreateDsuseRsltListPhoto--${pageName}").prop("disabled", true);
}
//그리드 체크박스
$("#tbody--${pageName}").find("td input[type='checkbox']").each(function() {
let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val()));
});
//그리드 제목 체크박스
if (keys.length < 1) {
$("#theadTr--${pageName}").find("input[type='checkbox']").prop("checked", false); // 체크 해제
} else if (keys.length == list.length) {
$("#theadTr--${pageName}").find("input[type='checkbox']").prop("checked", true); // 체크 설정
} else {
$("#theadTr--${pageName}").find("input[type='checkbox']").prop("checked", false); // 체크 해제
}
}
// 신청서 정보 dialog // 신청서 정보 dialog
$P.control.getInfo = (gdccId) => { $P.control.getInfo = (gdccId) => {
/*let dialogTitle = "신청서 정보 등록"; /*let dialogTitle = "신청서 정보 등록";
@ -346,15 +380,20 @@
//한글문서파일 생성을 위한 데이터 조회 //한글문서파일 생성을 위한 데이터 조회
$P.getDataForDocument = (ADDS12) => { $P.getDataForDocument = (ADDS12) => {
let dscdmngId = $P.control.getCurrent().dscdmng_id; let dscdmngIds = $P.control.dataset.getKeys("selected");
if(dscdmngIds.length < 1){
alert("체크된 자료가 없습니다.");
return;
}
ajax.post({ ajax.post({
url: '<c:url value="${apiHost}/api/biz/nims/v1/getDsuseMgtListForRptDoc" />', url: '<c:url value="${apiHost}/api/biz/nims/v1/getDsuseMgtListForRptDoc" />',
contentType : "application/json; charset=utf-8", contentType : "application/json; charset=utf-8",
data: JSON.stringify({ data: JSON.stringify({
"dscdmngIds" : [dscdmngId], "dscdmngIds" : dscdmngIds,
"userId" : "${currentUser.account}", "userId" : "${currentUser.account}",
"deptCd": "" "deptCd": "${currentUser.deptCode}"
}), }),
success:resp => { success:resp => {
if(!resp.success){ if(!resp.success){
@ -363,7 +402,7 @@
}); });
return; return;
} }
$P.fnCreateDoc(resp.data[0], ADDS12); $P.fnCreateDoc(resp.data, ADDS12);
} }
}); });
@ -372,20 +411,28 @@
//한글문서파일 생성 요청 //한글문서파일 생성 요청
$P.fnCreateDoc = (respData, ADDS12) => { $P.fnCreateDoc = (respData, ADDS12) => {
respData.dsuseMgtDtls.map((dtl) => { for(let dsuseMgtMaster of respData){
keys = Object.keys(respData); dsuseMgtMaster.dsuseMgtDtls.map((dtl) => {
keys = Object.keys(dsuseMgtMaster);
for(let key of keys){ for(let key of keys){
if(key == "dsuseMgtDtls"){ if(key == "dsuseMgtDtls"){
continue; continue;
} }
if(dtl[key] == undefined){
dtl[key] = respData[key]; if(key == "bsshNm" || key == "bsshCd"){
dtl[key+"0"] = dsuseMgtMaster[key];
} else if(dtl[key] == undefined){
dtl[key] = dsuseMgtMaster[key];
} }
} }
return dtl; return dtl;
}); });
}
let dtls = respData.dsuseMgtDtls; let dtls = [];
for(let i=0; i < respData.length; i++){
dtls = dtls.concat(respData[i].dsuseMgtDtls);
}
let url = ""; let url = "";
if(ADDS12 == "01"){ if(ADDS12 == "01"){
@ -396,12 +443,16 @@
return; return;
} }
let dscdmngId = $P.control.getCurrent().dscdmng_id;
ajax.get({ ajax.get({
url: url, url: url,
data: { dtls : JSON.stringify(dtls) } , data: { dtls : JSON.stringify(dtls) } ,
success:resp => { success:resp => {
if(resp.saved){ if(resp.saved){
let downloadUrl = wctx.url("/file/download.do");
let downloadParam = "fileID="+resp.fileId;
document.location.href = downloadUrl+"?"+downloadParam;
$P.control.load($P.control.pageNum); $P.control.load($P.control.pageNum);
} }
} }

Loading…
Cancel
Save