diff --git a/src/main/java/cokr/xit/adds/DocController.java b/src/main/java/cokr/xit/adds/DocController.java index acb65e3..f930437 100644 --- a/src/main/java/cokr/xit/adds/DocController.java +++ b/src/main/java/cokr/xit/adds/DocController.java @@ -14,7 +14,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; 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.applib.Print; import cokr.xit.applib.PrintOption; @@ -34,8 +34,8 @@ public class DocController extends AbstractController { private String sggNm = "용인시"; - @RequestMapping(value="/makeDisposeResultNoticeHwp.do") - public ModelAndView makeDisposeResultNoticeHwp(String dscMngId) { + @RequestMapping(value="/makeDisposeResultReportHwp.do") + public ModelAndView makeDisposeResultReportHwp(String dscMngId) { ModelAndView mav = new ModelAndView(); mav.setViewName("jsonView"); @@ -85,8 +85,8 @@ public class DocController extends AbstractController { } - DisposeResultNotice disposeResultNotice = new DisposeResultNotice(print, printOption, dataobjectList); - String resultFilePath = disposeResultNotice.makeFile().andGetPath(); + DisposeResultReport form = new DisposeResultReport(print, printOption, dataobjectList); + String resultFilePath = form.makeFile().andGetPath(); File file = new File(resultFilePath); Relation rel = new Relation().setInfoType("200").setSubType("01").setInfoKey(dscMngId); @@ -117,8 +117,8 @@ public class DocController extends AbstractController { return result; } - @RequestMapping(value="/makeDisposeResultReportHwp.do") - public ModelAndView makeDisposeResultReportHwp(String dscMngId) { + @RequestMapping(value="/makeDisposeProcessDetailsHwp.do") + public ModelAndView makeDisposeProcessDetailsHwp(String dscMngId) { ModelAndView mav = new ModelAndView(); mav.setViewName("jsonView"); @@ -176,8 +176,8 @@ public class DocController extends AbstractController { } - DisposeResultReport disposeResultReport = new DisposeResultReport(print, printOption, dataobjectList, dataobjectList2); - String resultFilePath = disposeResultReport.makeFile().andGetPath(); + DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataobjectList, dataobjectList2); + String resultFilePath = form.makeFile().andGetPath(); File file = new File(resultFilePath); Relation rel = new Relation().setInfoType("200").setSubType("02").setInfoKey(dscMngId); diff --git a/src/main/java/cokr/xit/adds/cmmn/hwp/format/DisposeProcessDetails.java b/src/main/java/cokr/xit/adds/cmmn/hwp/format/DisposeProcessDetails.java new file mode 100644 index 0000000..fc6b55d --- /dev/null +++ b/src/main/java/cokr/xit/adds/cmmn/hwp/format/DisposeProcessDetails.java @@ -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 data2 = null; //폐기전 사진 + private List data3 = null; //폐기증거 사진 + + public DisposeProcessDetails(Print print, PrintOption printOption, List dataObjectList, List 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 page = null; + for(int i=0;i(); + for(int i=0;i 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 getDownloadDataNames() { + return null; + } + +} diff --git a/src/main/java/cokr/xit/adds/cmmn/hwp/format/DisposeResultNotice.java b/src/main/java/cokr/xit/adds/cmmn/hwp/format/DisposeResultNotice.java deleted file mode 100644 index 186986b..0000000 --- a/src/main/java/cokr/xit/adds/cmmn/hwp/format/DisposeResultNotice.java +++ /dev/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 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 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 getDownloadDataNames() { - return null; - } - -} diff --git a/src/main/java/cokr/xit/adds/cmmn/hwp/format/DisposeResultReport.java b/src/main/java/cokr/xit/adds/cmmn/hwp/format/DisposeResultReport.java index 9de3fcd..ef024db 100644 --- a/src/main/java/cokr/xit/adds/cmmn/hwp/format/DisposeResultReport.java +++ b/src/main/java/cokr/xit/adds/cmmn/hwp/format/DisposeResultReport.java @@ -1,218 +1,60 @@ 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 DisposeResultReport extends HWPFormat { - private List data2 = null; //폐기전 사진 - private List data3 = null; //폐기증거 사진 - public DisposeResultReport(Print print, PrintOption printOption, List dataObjectList, List afterPhotoPaths) { + public DisposeResultReport(Print print, PrintOption printOption, List dataObjectList) { super(print, printOption, dataObjectList); this.maxRunCount = 1; this.formatFilePath = "template/hwp/dispose_result_report.hwp"; this.print.setFormatKorName("폐기결과보고서"); this.print.setFormatName("disposeResultReport"); - - this.data2 = new ArrayList(); - - DataObject page = null; - for(int i=0;i(); - for(int i=0;i 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/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)); - } + List 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); + String yyyymmdd = year+month+day; + writer.setValue("연월일", DataFormat.yyyy_mm_dd(yyyymmdd)); + + String gigwanjang = printOption.getGlobalVariable().get("gigwanjang"); + writer.setValue("기관장", gigwanjang); } @Override diff --git a/src/main/resources/template/hwp/dispose_result_notice.hwp b/src/main/resources/template/hwp/dispose_result_notice.hwp deleted file mode 100644 index b313932..0000000 Binary files a/src/main/resources/template/hwp/dispose_result_notice.hwp and /dev/null differ diff --git a/src/main/resources/template/hwp/dispose_status.hwp b/src/main/resources/template/hwp/dispose_status.hwp new file mode 100644 index 0000000..d33cf4b Binary files /dev/null and b/src/main/resources/template/hwp/dispose_status.hwp differ diff --git a/src/main/resources/template/hwp/dispose_result_report_after_photo.hwp b/src/main/resources/template/hwp/photo_after_dispose.hwp similarity index 100% rename from src/main/resources/template/hwp/dispose_result_report_after_photo.hwp rename to src/main/resources/template/hwp/photo_after_dispose.hwp diff --git a/src/main/resources/template/hwp/dispose_result_report_before_photo.hwp b/src/main/resources/template/hwp/photo_before_dispose.hwp similarity index 100% rename from src/main/resources/template/hwp/dispose_result_report_before_photo.hwp rename to src/main/resources/template/hwp/photo_before_dispose.hwp