한글 서식 파일명 변경

dev
이범준 6 months ago
parent f8573ceef3
commit 604e63450d

@ -14,7 +14,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import cokr.xit.adds.cmmn.hwp.format.DisposeResultNotice; import cokr.xit.adds.cmmn.hwp.format.DisposeProcessDetails;
import cokr.xit.adds.cmmn.hwp.format.DisposeResultReport; import cokr.xit.adds.cmmn.hwp.format.DisposeResultReport;
import cokr.xit.applib.Print; import cokr.xit.applib.Print;
import cokr.xit.applib.PrintOption; import cokr.xit.applib.PrintOption;
@ -34,8 +34,8 @@ public class DocController extends AbstractController {
private String sggNm = "용인시"; private String sggNm = "용인시";
@RequestMapping(value="/makeDisposeResultNoticeHwp.do") @RequestMapping(value="/makeDisposeResultReportHwp.do")
public ModelAndView makeDisposeResultNoticeHwp(String dscMngId) { public ModelAndView makeDisposeResultReportHwp(String dscMngId) {
ModelAndView mav = new ModelAndView(); ModelAndView mav = new ModelAndView();
mav.setViewName("jsonView"); mav.setViewName("jsonView");
@ -85,8 +85,8 @@ public class DocController extends AbstractController {
} }
DisposeResultNotice disposeResultNotice = new DisposeResultNotice(print, printOption, dataobjectList); DisposeResultReport form = new DisposeResultReport(print, printOption, dataobjectList);
String resultFilePath = disposeResultNotice.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(dscMngId); Relation rel = new Relation().setInfoType("200").setSubType("01").setInfoKey(dscMngId);
@ -117,8 +117,8 @@ public class DocController extends AbstractController {
return result; return result;
} }
@RequestMapping(value="/makeDisposeResultReportHwp.do") @RequestMapping(value="/makeDisposeProcessDetailsHwp.do")
public ModelAndView makeDisposeResultReportHwp(String dscMngId) { public ModelAndView makeDisposeProcessDetailsHwp(String dscMngId) {
ModelAndView mav = new ModelAndView(); ModelAndView mav = new ModelAndView();
mav.setViewName("jsonView"); mav.setViewName("jsonView");
@ -176,8 +176,8 @@ public class DocController extends AbstractController {
} }
DisposeResultReport disposeResultReport = new DisposeResultReport(print, printOption, dataobjectList, dataobjectList2); DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataobjectList, dataobjectList2);
String resultFilePath = disposeResultReport.makeFile().andGetPath(); String resultFilePath = form.makeFile().andGetPath();
File file = new File(resultFilePath); File file = new File(resultFilePath);
Relation rel = new Relation().setInfoType("200").setSubType("02").setInfoKey(dscMngId); Relation rel = new Relation().setInfoType("200").setSubType("02").setInfoKey(dscMngId);

@ -0,0 +1,223 @@
package cokr.xit.adds.cmmn.hwp.format;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.IntStream;
import cokr.xit.applib.Print;
import cokr.xit.applib.PrintOption;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile;
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) {
super(print, printOption, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/dispose_status.hwp";
this.print.setFormatKorName("폐기처리내역");
this.print.setFormatName("disposeProcessDetails");
this.data2 = new ArrayList<DataObject>();
DataObject page = null;
for(int i=0;i<data.size();i++) {
int mod = (i+1) % 6;
if(mod == 0) {
mod = 6;
}
if(mod == 1) {
page = new DataObject();
}
page.set("폐기전사진"+mod+"제목", data.get(i).string("prductNm"));
page.set("폐기전사진"+mod+"경로", data.get(i).string("filePath"));
if(mod == 6 || i == data.size()-1) {
data2.add(page);
page = null;
}
}
this.data3 = new ArrayList<DataObject>();
for(int i=0;i<afterPhotoPaths.size();i++) {
int mod = (i+1) % 6;
if(mod == 0) {
mod = 6;
}
if(mod == 1) {
page = new DataObject();
page.set("폐기증거제목", "폐기 증거");
}
page.set("폐기증거사진"+mod+"경로", afterPhotoPaths.get(i));
if(mod == 6 || i == afterPhotoPaths.size()-1) {
data3.add(page);
page = null;
}
}
}
@Override
public HWPFormat makeFile(){
HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile);
runAsWriter();
String tempPath = this.print.pathForNewFile();
writer.write(tempPath);
resultFilesPath.add(tempPath);
writer = null;
currentRunCount++;
//사진 첨부
formatFilePath = "template/hwp/photo_before_dispose.hwp";
maxRunCount += data2.size();
while(currentRunCount != maxRunCount) {
HWPFile hwpFile_i = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile_i);
runAsWriter();
String tempPath_i = this.print.pathForNewFile();
writer.write(tempPath_i);
resultFilesPath.add(tempPath_i);
writer = null;
currentRunCount++;
}
formatFilePath = "template/hwp/photo_after_dispose.hwp";
maxRunCount += data3.size();
while(currentRunCount != maxRunCount) {
System.out.println(currentRunCount);
System.out.println(maxRunCount);
HWPFile hwpFile_i = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile_i);
runAsWriter();
String tempPath_i = this.print.pathForNewFile();
writer.write(tempPath_i);
resultFilesPath.add(tempPath_i);
writer = null;
currentRunCount++;
}
this.merge();
return this;
}
@Override
protected void runAsWriter() {
if(this.formatFilePath.equals("template/hwp/dispose_status.hwp")) {
List<DataObject> list = IntStream.rangeClosed(1, data.size()).boxed().map(i -> {
DataObject one = data.get(i-1);
return (DataObject) new DataObject()
.set("항목", i)
.set("폐기신청인-업소명", one.string("bsshNm"))
.set("폐기신청인-허가종별", one.string("indutyNm"))
.set("폐기신청인-마약류취급자식별번호", one.string("bsshCd"))
.set("폐기정보-폐기일자", DataFormat.yyyy_mm_dd(one.string("dsuseDe")))
.set("폐기정보-폐기종류", one.string("dsuseSeCdNm"))
.set("폐기정보-폐기사유", one.string("dsusePrvCdNm"))
.set("폐기정보-폐기장소", one.string("dsuseLoc"))
.set("폐기정보-폐기방법", one.string("dsuseMthCd"))
.set("제품정보-구분", one.string("nrcdSeNm"))
.set("제품정보-제품명", one.string("prductNm"))
.set("제품정보-품목코드", one.string("prductCd"))
.set("제품정보-최소유통단위", one.string("minDistbQy")+one.string("stdPackngStleNm"))
.set("제품정보-제조번호", one.string("mnfNo"))
.set("제품정보-유효기한", DataFormat.yyyy_mm_dd(one.string("prdValidDe")))
.set("폐기량-수량", one.string("pceQy")+one.string("pceCoUnitNm"))
;
}).toList();
writer.table(0, 3, 1).setValues(list);
String currentTime = print.getPrintRequestDt();
String year = currentTime.substring(0, 4);
String month = currentTime.substring(4, 6);
String day = currentTime.substring(6, 8);
writer.setValue("연", year);
writer.setValue("월", month);
writer.setValue("일", day);
String gigwanjang = printOption.getGlobalVariable().get("gigwanjang");
writer.setValue("기관장", gigwanjang);
} else if(this.formatFilePath.equals("template/hwp/photo_before_dispose.hwp")){
DataObject one = data2.get(currentRunCount-1);
DataObject newObj = new DataObject();
if(!one.string("폐기전사진1경로").equals("")) {
newObj.set("폐기전사진1제목", one.string("폐기전사진1제목"));
newObj.set("폐기전사진1", writer.image().add(one.string("폐기전사진1경로")));
}
if(!one.string("폐기전사진2경로").equals("")) {
newObj.set("폐기전사진2제목", one.string("폐기전사진2제목"));
newObj.set("폐기전사진2", writer.image().add(one.string("폐기전사진2경로")));
}
if(!one.string("폐기전사진3경로").equals("")) {
newObj.set("폐기전사진3제목", one.string("폐기전사진3제목"));
newObj.set("폐기전사진3", writer.image().add(one.string("폐기전사진3경로")));
}
if(!one.string("폐기전사진4경로").equals("")) {
newObj.set("폐기전사진4제목", one.string("폐기전사진4제목"));
newObj.set("폐기전사진4", writer.image().add(one.string("폐기전사진4경로")));
}
if(!one.string("폐기전사진5경로").equals("")) {
newObj.set("폐기전사진5제목", one.string("폐기전사진5제목"));
newObj.set("폐기전사진5", writer.image().add(one.string("폐기전사진5경로")));
}
if(!one.string("폐기전사진6경로").equals("")) {
newObj.set("폐기전사진6제목", one.string("폐기전사진6제목"));
newObj.set("폐기전사진6", writer.image().add(one.string("폐기전사진6경로")));
}
writer.table(0, 0, 4).setValues(List.of(newObj));
} else if(this.formatFilePath.equals("template/hwp/photo_after_dispose.hwp")){
DataObject one = data3.get(currentRunCount-1-data2.size());
DataObject newObj = new DataObject();
newObj.set("폐기증거제목", one.string("폐기증거제목"));
if(!one.string("폐기증거사진1경로").equals("")) {
newObj.set("폐기증거사진1", writer.image().add(one.string("폐기증거사진1경로")));
}
if(!one.string("폐기증거사진2경로").equals("")) {
newObj.set("폐기증거사진2", writer.image().add(one.string("폐기증거사진2경로")));
}
if(!one.string("폐기증거사진3경로").equals("")) {
newObj.set("폐기증거사진3", writer.image().add(one.string("폐기증거사진3경로")));
}
if(!one.string("폐기증거사진4경로").equals("")) {
newObj.set("폐기증거사진4", writer.image().add(one.string("폐기증거사진4경로")));
}
if(!one.string("폐기증거사진5경로").equals("")) {
newObj.set("폐기증거사진5", writer.image().add(one.string("폐기증거사진5경로")));
}
if(!one.string("폐기증거사진6경로").equals("")) {
newObj.set("폐기증거사진6", writer.image().add(one.string("폐기증거사진6경로")));
}
writer.table(0, 0, 3).setValues(List.of(newObj));
}
}
@Override
public List<String> getDownloadDataNames() {
return null;
}
}

@ -1,65 +0,0 @@
package cokr.xit.adds.cmmn.hwp.format;
import java.util.List;
import java.util.stream.IntStream;
import cokr.xit.applib.Print;
import cokr.xit.applib.PrintOption;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
public class DisposeResultNotice extends HWPFormat {
public DisposeResultNotice(Print print, PrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/dispose_result_notice.hwp";
this.print.setFormatKorName("폐기결과통보서");
this.print.setFormatName("disposeResultNotice");
}
@Override
protected void runAsWriter() {
List<DataObject> list = IntStream.rangeClosed(1, data.size()).boxed().map(i -> {
DataObject one = data.get(i-1);
return (DataObject) new DataObject()
.set("연번-항목", i)
.set("폐기신청인-업소명", one.string("bsshNm"))
.set("폐기신청인-허가종별", one.string("indutyNm"))
.set("폐기신청인-마약류취급자식별번호", one.string("bsshCd"))
.set("폐기정보-폐기일자", DataFormat.yyyy_mm_dd(one.string("dsuseDe")))
.set("폐기정보-폐기종류", one.string("dsuseSeCdNm"))
.set("폐기정보-폐기사유", one.string("dsusePrvCdNm"))
.set("폐기정보-폐기장소", one.string("dsuseLoc"))
.set("폐기정보-폐기방법", one.string("dsuseMthCd"))
.set("제품정보-구분", one.string("nrcdSeNm"))
.set("제품정보-제품명", one.string("prductNm"))
.set("제품정보-품목코드", one.string("prductCd"))
.set("제품정보-최소유통단위", one.string("minDistbQy")+one.string("stdPackngStleNm"))
.set("제품정보-제조번호", one.string("mnfNo"))
.set("제품정보-유효기한", DataFormat.yyyy_mm_dd(one.string("prdValidDe")))
.set("폐기량-수량", one.string("pceQy")+one.string("pceCoUnitNm"))
;
}).toList();
writer.table(0, 2, 1).setValues(list);
String currentTime = print.getPrintRequestDt();
String year = currentTime.substring(0, 4);
String month = currentTime.substring(4, 6);
String day = currentTime.substring(6, 8);
String yyyymmdd = year+month+day;
writer.setValue("연월일", DataFormat.yyyy_mm_dd(yyyymmdd));
String gigwanjang = printOption.getGlobalVariable().get("gigwanjang");
writer.setValue("기관장", gigwanjang);
}
@Override
public List<String> getDownloadDataNames() {
return null;
}
}

@ -1,132 +1,32 @@
package cokr.xit.adds.cmmn.hwp.format; package cokr.xit.adds.cmmn.hwp.format;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import cokr.xit.applib.Print; import cokr.xit.applib.Print;
import cokr.xit.applib.PrintOption; import cokr.xit.applib.PrintOption;
import cokr.xit.applib.hwp.format.HWPFormat; import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.foundation.data.DataFormat; import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile;
public class DisposeResultReport extends HWPFormat { public class DisposeResultReport extends HWPFormat {
private List<DataObject> data2 = null; //폐기전 사진
private List<DataObject> data3 = null; //폐기증거 사진
public DisposeResultReport(Print print, PrintOption printOption, List<DataObject> dataObjectList, List<String> afterPhotoPaths) { public DisposeResultReport(Print print, PrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList); super(print, printOption, dataObjectList);
this.maxRunCount = 1; this.maxRunCount = 1;
this.formatFilePath = "template/hwp/dispose_result_report.hwp"; this.formatFilePath = "template/hwp/dispose_result_report.hwp";
this.print.setFormatKorName("폐기결과보고서"); this.print.setFormatKorName("폐기결과보고서");
this.print.setFormatName("disposeResultReport"); this.print.setFormatName("disposeResultReport");
this.data2 = new ArrayList<DataObject>();
DataObject page = null;
for(int i=0;i<data.size();i++) {
int mod = (i+1) % 6;
if(mod == 0) {
mod = 6;
}
if(mod == 1) {
page = new DataObject();
}
page.set("폐기전사진"+mod+"제목", data.get(i).string("prductNm"));
page.set("폐기전사진"+mod+"경로", data.get(i).string("filePath"));
if(mod == 6 || i == data.size()-1) {
data2.add(page);
page = null;
}
}
this.data3 = new ArrayList<DataObject>();
for(int i=0;i<afterPhotoPaths.size();i++) {
int mod = (i+1) % 6;
if(mod == 0) {
mod = 6;
}
if(mod == 1) {
page = new DataObject();
page.set("폐기증거제목", "폐기 증거");
}
page.set("폐기증거사진"+mod+"경로", afterPhotoPaths.get(i));
if(mod == 6 || i == afterPhotoPaths.size()-1) {
data3.add(page);
page = null;
}
}
}
@Override
public HWPFormat makeFile(){
HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile);
runAsWriter();
String tempPath = this.print.pathForNewFile();
writer.write(tempPath);
resultFilesPath.add(tempPath);
writer = null;
currentRunCount++;
//사진 첨부
formatFilePath = "template/hwp/dispose_result_report_before_photo.hwp";
maxRunCount += data2.size();
while(currentRunCount != maxRunCount) {
HWPFile hwpFile_i = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile_i);
runAsWriter();
String tempPath_i = this.print.pathForNewFile();
writer.write(tempPath_i);
resultFilesPath.add(tempPath_i);
writer = null;
currentRunCount++;
}
formatFilePath = "template/hwp/dispose_result_report_after_photo.hwp";
maxRunCount += data3.size();
while(currentRunCount != maxRunCount) {
System.out.println("123123123132123");
System.out.println(currentRunCount);
System.out.println(maxRunCount);
HWPFile hwpFile_i = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile_i);
runAsWriter();
String tempPath_i = this.print.pathForNewFile();
writer.write(tempPath_i);
resultFilesPath.add(tempPath_i);
writer = null;
currentRunCount++;
}
this.merge();
return this;
} }
@Override @Override
protected void runAsWriter() { protected void runAsWriter() {
if(this.formatFilePath.equals("template/hwp/dispose_result_report.hwp")) {
List<DataObject> list = IntStream.rangeClosed(1, data.size()).boxed().map(i -> { List<DataObject> list = IntStream.rangeClosed(1, data.size()).boxed().map(i -> {
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("bsshNm"))
.set("폐기신청인-허가종별", one.string("indutyNm")) .set("폐기신청인-허가종별", one.string("indutyNm"))
.set("폐기신청인-마약류취급자식별번호", one.string("bsshCd")) .set("폐기신청인-마약류취급자식별번호", one.string("bsshCd"))
@ -144,75 +44,17 @@ public class DisposeResultReport extends HWPFormat {
.set("폐기량-수량", one.string("pceQy")+one.string("pceCoUnitNm")) .set("폐기량-수량", one.string("pceQy")+one.string("pceCoUnitNm"))
; ;
}).toList(); }).toList();
writer.table(0, 3, 1).setValues(list); writer.table(0, 3, 1).setValues(list);
String currentTime = print.getPrintRequestDt(); String currentTime = print.getPrintRequestDt();
String year = currentTime.substring(0, 4); String year = currentTime.substring(0, 4);
String month = currentTime.substring(4, 6); String month = currentTime.substring(4, 6);
String day = currentTime.substring(6, 8); String day = currentTime.substring(6, 8);
writer.setValue("연", year); String yyyymmdd = year+month+day;
writer.setValue("월", month); writer.setValue("연월일", DataFormat.yyyy_mm_dd(yyyymmdd));
writer.setValue("일", day);
String gigwanjang = printOption.getGlobalVariable().get("gigwanjang"); String gigwanjang = printOption.getGlobalVariable().get("gigwanjang");
writer.setValue("기관장", gigwanjang); writer.setValue("기관장", gigwanjang);
} else if(this.formatFilePath.equals("template/hwp/dispose_result_report_before_photo.hwp")){
DataObject one = data2.get(currentRunCount-1);
DataObject newObj = new DataObject();
if(!one.string("폐기전사진1경로").equals("")) {
newObj.set("폐기전사진1제목", one.string("폐기전사진1제목"));
newObj.set("폐기전사진1", writer.image().add(one.string("폐기전사진1경로")));
}
if(!one.string("폐기전사진2경로").equals("")) {
newObj.set("폐기전사진2제목", one.string("폐기전사진2제목"));
newObj.set("폐기전사진2", writer.image().add(one.string("폐기전사진2경로")));
}
if(!one.string("폐기전사진3경로").equals("")) {
newObj.set("폐기전사진3제목", one.string("폐기전사진3제목"));
newObj.set("폐기전사진3", writer.image().add(one.string("폐기전사진3경로")));
}
if(!one.string("폐기전사진4경로").equals("")) {
newObj.set("폐기전사진4제목", one.string("폐기전사진4제목"));
newObj.set("폐기전사진4", writer.image().add(one.string("폐기전사진4경로")));
}
if(!one.string("폐기전사진5경로").equals("")) {
newObj.set("폐기전사진5제목", one.string("폐기전사진5제목"));
newObj.set("폐기전사진5", writer.image().add(one.string("폐기전사진5경로")));
}
if(!one.string("폐기전사진6경로").equals("")) {
newObj.set("폐기전사진6제목", one.string("폐기전사진6제목"));
newObj.set("폐기전사진6", writer.image().add(one.string("폐기전사진6경로")));
}
writer.table(0, 0, 4).setValues(List.of(newObj));
} else if(this.formatFilePath.equals("template/hwp/dispose_result_report_after_photo.hwp")){
DataObject one = data3.get(currentRunCount-1-data2.size());
DataObject newObj = new DataObject();
newObj.set("폐기증거제목", one.string("폐기증거제목"));
if(!one.string("폐기증거사진1경로").equals("")) {
newObj.set("폐기증거사진1", writer.image().add(one.string("폐기증거사진1경로")));
}
if(!one.string("폐기증거사진2경로").equals("")) {
newObj.set("폐기증거사진2", writer.image().add(one.string("폐기증거사진2경로")));
}
if(!one.string("폐기증거사진3경로").equals("")) {
newObj.set("폐기증거사진3", writer.image().add(one.string("폐기증거사진3경로")));
}
if(!one.string("폐기증거사진4경로").equals("")) {
newObj.set("폐기증거사진4", writer.image().add(one.string("폐기증거사진4경로")));
}
if(!one.string("폐기증거사진5경로").equals("")) {
newObj.set("폐기증거사진5", writer.image().add(one.string("폐기증거사진5경로")));
}
if(!one.string("폐기증거사진6경로").equals("")) {
newObj.set("폐기증거사진6", writer.image().add(one.string("폐기증거사진6경로")));
}
writer.table(0, 0, 3).setValues(List.of(newObj));
}
} }
@Override @Override

Loading…
Cancel
Save