한글 서식 파일명 변경
parent
f8573ceef3
commit
604e63450d
@ -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;
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue