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

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> 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);
this.print.setFormatKorName("폐기처리내역및사진");
@ -47,7 +48,13 @@ public class DisposeProcessDetails extends HWPFormat {
}
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;
if(mod == 0) {
@ -55,12 +62,16 @@ public class DisposeProcessDetails extends HWPFormat {
}
if(mod == 1) {
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);
page = null;
}
@ -68,6 +79,8 @@ public class DisposeProcessDetails extends HWPFormat {
}
}
@Override
public HWPFormat makeFile(){
HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
@ -133,7 +146,7 @@ public class DisposeProcessDetails extends HWPFormat {
DataObject one = data.get(i-1);
return (DataObject) new DataObject()
.set("번호", i)
.set("업소명", one.string("bsshNm"))
.set("업소명", one.string("bsshNm0"))
.set("폐기사유", one.string("dsusePrvNm"))
.set("폐기장소", one.string("dsuseLoc"))
.set("폐기방법", one.string("dsuseMthNm"))

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

@ -94,6 +94,10 @@
<tr id="theadTr--${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: 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: 120.141px;">취급일자</th>
<th class="cmn" style="width: 120.469px;">폐기일자</th>
@ -113,6 +117,10 @@
<template id="${infoPrefix}Row--${pageName}">
<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}">
<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}">{hdr_de}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{dsuse_de}</td>
@ -214,19 +222,45 @@
$P.control.onCurrentChange = (item) => {
if (!item) {
$("#btnCreateDsuseRsltDoc--${pageName}").prop("disabled", true);
$("#btnCreateDsuseRsltListPhoto--${pageName}").prop("disabled", true);
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;
$("#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
$P.control.getInfo = (gdccId) => {
/*let dialogTitle = "신청서 정보 등록";
@ -346,15 +380,20 @@
//한글문서파일 생성을 위한 데이터 조회
$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({
url: '<c:url value="${apiHost}/api/biz/nims/v1/getDsuseMgtListForRptDoc" />',
contentType : "application/json; charset=utf-8",
data: JSON.stringify({
"dscdmngIds" : [dscdmngId],
"dscdmngIds" : dscdmngIds,
"userId" : "${currentUser.account}",
"deptCd": ""
"deptCd": "${currentUser.deptCode}"
}),
success:resp => {
if(!resp.success){
@ -363,7 +402,7 @@
});
return;
}
$P.fnCreateDoc(resp.data[0], ADDS12);
$P.fnCreateDoc(resp.data, ADDS12);
}
});
@ -372,20 +411,28 @@
//한글문서파일 생성 요청
$P.fnCreateDoc = (respData, ADDS12) => {
respData.dsuseMgtDtls.map((dtl) => {
keys = Object.keys(respData);
for(let dsuseMgtMaster of respData){
dsuseMgtMaster.dsuseMgtDtls.map((dtl) => {
keys = Object.keys(dsuseMgtMaster);
for(let key of keys){
if(key == "dsuseMgtDtls"){
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;
});
}
let dtls = respData.dsuseMgtDtls;
let dtls = [];
for(let i=0; i < respData.length; i++){
dtls = dtls.concat(respData[i].dsuseMgtDtls);
}
let url = "";
if(ADDS12 == "01"){
@ -396,12 +443,16 @@
return;
}
let dscdmngId = $P.control.getCurrent().dscdmng_id;
ajax.get({
url: url,
data: { dtls : JSON.stringify(dtls) } ,
success:resp => {
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);
}
}

Loading…
Cancel
Save