한컴한글 파일 생성 처리방법 변경

main
이범준 7 months ago
parent e64a95c3cd
commit 1a9fbb4aa6

@ -1,128 +0,0 @@
package cokr.xit.base.file.hwp;
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.core.io.ClassPathResource;
import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.AddUtil;
import cokr.xit.fims.cmmn.hwp.format.HWPFormat;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.reader.HWPReader;
public class HWPWriter {
protected Print print;
protected HWPFormat format;
public void setFormat(HWPFormat format) {
this.format = format;
};
public HWPFormat getFormat() {
return this.format;
};
public void setPrint(Print print) {
this.print = print;
};
public Map<String, Object> makeFileFromHwpFormat(String formatType, PrintOption printOption, List<DataObject> dataObjectList) {
Map<String, Object> result = new HashMap<>();
this.format.setting(this.print);
int totalDataCount = dataObjectList.size();
List<String> partFileList = new ArrayList<>();
this.format.calcTotalPartFileCount(totalDataCount);
try {
int dataIndex = 0;
for(int partFileIndex = 0; partFileIndex < this.format.getTotalPartFileCount(); partFileIndex++) {
//새 파일 생성
String resultHwpPath = this.format.newFileFromFormatFile(this.print);
HWPFile resultFile = HWPReader.fromFile(resultHwpPath);
//공통사항 세팅
this.format.writeGlobalInfo(resultFile, dataObjectList, printOption, this.print);
kr.dogfoot.hwplib.writer.HWPWriter.toFile(resultFile, resultHwpPath);
//데이터 건별 처리
for(int recordIndex = 0; recordIndex < this.format.getRecordPerPartFile(); recordIndex++) {
if(dataIndex < dataObjectList.size()) {
DataObject dataObject = dataObjectList.get(dataIndex);
if(formatType.equals("list")) {
InputStream attachFormatIS = new ClassPathResource(this.format.getAttachFormatFilePath()).getInputStream();
HWPFile attachFormatFile = HWPReader.fromInputStream(attachFormatIS);
this.format.writeSingleDataInfo(null, attachFormatFile, dataObject, this.print);
AddUtil.insertTableInCell(attachFormatFile, resultFile, "내부");
} else if(formatType.equals("info")){
this.format.writeSingleDataInfo(resultFile, null, dataObject, this.print);
}
}
if(formatType.equals("list")) {
dataIndex++;
}
}
if(!formatType.equals("list")) {
dataIndex++;
}
kr.dogfoot.hwplib.writer.HWPWriter.toFile(resultFile, resultHwpPath);
partFileList.add(resultHwpPath);
}
//결과파일 병합
if(partFileList.size() >= 2) {
String basePath = partFileList.get(0);
HWPFile baseFile = HWPReader.fromFile(basePath);
for(int i=2; i <= partFileList.size();i++) {
String attachPath = partFileList.get(i-1);
HWPFile attachFile = HWPReader.fromFile(attachPath);
AddUtil.appendToLast(attachFile, baseFile);
}
kr.dogfoot.hwplib.writer.HWPWriter.toFile(baseFile, basePath);
for(int i=2; i <= partFileList.size();i++) {
if(!(new File(partFileList.get(i-1))).delete()) {
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
}
}
String downlaodFileName = this.print.getFormatKorName()+"_"+this.print.getPrintRequestDt()+".hwp";
result.put("filename", downlaodFileName);
String filePath = partFileList.get(0);
result.put("filePath", filePath);
result.put("file", new File(filePath));
} catch (Exception e) {
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
return result;
}
}

@ -38,6 +38,7 @@ import org.springframework.core.io.ClassPathResource;
import cokr.xit.base.file.xls.XLSWriter; import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CommentSupport; import cokr.xit.base.file.xls.XLSWriter.CommentSupport;
import cokr.xit.fims.cmmn.xls.CellDecorator;
import cokr.xit.fims.sndb.service.bean.SndngBean; import cokr.xit.fims.sndb.service.bean.SndngBean;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.util.DateFormats; import cokr.xit.foundation.util.DateFormats;

@ -1,53 +0,0 @@
package cokr.xit.fims.cmmn.hwp;
import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.object.bodytext.ParagraphListInterface;
import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph;
import kr.dogfoot.hwplib.object.bodytext.paragraph.ParagraphList;
import kr.dogfoot.hwplib.tool.objectfinder.CellFinder;
import kr.dogfoot.hwplib.tool.paragraphadder.ParagraphAdder;
import kr.dogfoot.hwplib.tool.paragraphadder.ParagraphMerger;
public class AddUtil {
/** .
* @param attachHWPFile , baseHWPFile
* @return
*/
public static void appendToLast(HWPFile attachHWPFile, HWPFile baseHWPFile) throws Exception {
if (attachHWPFile != null && baseHWPFile != null) {
Paragraph[] ps = attachHWPFile.getBodyText().getSectionList().get(0).getParagraphs();
ParagraphListInterface baseSection = baseHWPFile.getBodyText().getLastSection();
ParagraphAdder paraAdder = new ParagraphAdder(baseHWPFile, baseSection);
for(int i=0; i<ps.length; i++) {
Paragraph p = ps[i];
paraAdder.add(attachHWPFile, p);
}
}
}
/** .
* @param attachHWPFile , baseHWPFile , cell
* @return
*/
public static void insertTableInCell(HWPFile attachHWPFile, HWPFile baseHWPFile, String cellFieldName) throws Exception {
ParagraphList cpl = CellFinder.findAll(baseHWPFile, cellFieldName).get(0).getParagraphList();
Paragraph attachParagraph = attachHWPFile.getBodyText().getSectionList().get(0).getParagraph(0);
ParagraphAdder paraAdder = new ParagraphAdder(baseHWPFile, cpl);
paraAdder.add(attachHWPFile, attachParagraph);
ParagraphList cpl0 = CellFinder.findAll(baseHWPFile, cellFieldName).get(0).getParagraphList();
ParagraphMerger paraMerger = new ParagraphMerger();
paraMerger.merge(cpl0.getParagraph(1), cpl0.getParagraph(0));
cpl0.deleteParagraph(1);
}
}

@ -1,25 +0,0 @@
package cokr.xit.fims.cmmn.hwp;
import java.util.ArrayList;
import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.tool.objectfinder.FieldFinder;
public class ClickHereEditor {
private HWPFile whpFile;
public ClickHereEditor(HWPFile whpFile){
this.whpFile = whpFile;
}
public void set(String clickHereName, String value) {
try {
ArrayList<String> strings = new ArrayList<String>();
strings.add(value);
FieldFinder.setClickHereText(whpFile, clickHereName, strings);
} catch (Exception e){
throw new RuntimeException("한글 문서 생성 중 오류가 발생하였습니다.");
}
}
}

@ -0,0 +1,32 @@
package cokr.xit.fims.cmmn.hwp;
import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.object.bodytext.ParagraphListInterface;
import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph;
import kr.dogfoot.hwplib.tool.paragraphadder.ParagraphAdder;
public class HwpMerge {
/** .
* @param attachHWPFile , baseHWPFile
* @return
*/
public static void appendToLast(HWPFile attachHWPFile, HWPFile baseHWPFile) throws Exception {
if (attachHWPFile != null && baseHWPFile != null) {
Paragraph[] ps = attachHWPFile.getBodyText().getSectionList().get(0).getParagraphs();
ParagraphListInterface baseSection = baseHWPFile.getBodyText().getLastSection();
ParagraphAdder paraAdder = new ParagraphAdder(baseHWPFile, baseSection);
for(int i=0; i<ps.length; i++) {
Paragraph p = ps[i];
paraAdder.add(attachHWPFile, p);
}
}
}
}

@ -1,261 +0,0 @@
package cokr.xit.fims.cmmn.hwp;
import java.awt.Rectangle;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.CtrlHeaderGso;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.gso.GsoHeaderProperty;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.gso.HeightCriterion;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.gso.HorzRelTo;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.gso.ObjectNumberSort;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.gso.RelativeArrange;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.gso.TextFlowMethod;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.gso.TextHorzArrange;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.gso.VertRelTo;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.gso.WidthCriterion;
import kr.dogfoot.hwplib.object.bodytext.control.gso.ControlRectangle;
import kr.dogfoot.hwplib.object.bodytext.control.gso.GsoControlType;
import kr.dogfoot.hwplib.object.bodytext.control.gso.shapecomponent.ShapeComponentNormal;
import kr.dogfoot.hwplib.object.bodytext.control.gso.shapecomponent.lineinfo.LineArrowShape;
import kr.dogfoot.hwplib.object.bodytext.control.gso.shapecomponent.lineinfo.LineArrowSize;
import kr.dogfoot.hwplib.object.bodytext.control.gso.shapecomponent.lineinfo.LineEndShape;
import kr.dogfoot.hwplib.object.bodytext.control.gso.shapecomponent.lineinfo.LineInfo;
import kr.dogfoot.hwplib.object.bodytext.control.gso.shapecomponent.lineinfo.LineType;
import kr.dogfoot.hwplib.object.bodytext.control.gso.shapecomponent.lineinfo.OutlineStyle;
import kr.dogfoot.hwplib.object.bodytext.control.gso.shapecomponent.shadowinfo.ShadowInfo;
import kr.dogfoot.hwplib.object.bodytext.control.gso.shapecomponent.shadowinfo.ShadowType;
import kr.dogfoot.hwplib.object.bodytext.control.gso.shapecomponenteach.ShapeComponentRectangle;
import kr.dogfoot.hwplib.object.bodytext.control.table.Cell;
import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph;
import kr.dogfoot.hwplib.object.bodytext.paragraph.text.ParaText;
import kr.dogfoot.hwplib.object.docinfo.BinData;
import kr.dogfoot.hwplib.object.docinfo.bindata.BinDataCompress;
import kr.dogfoot.hwplib.object.docinfo.bindata.BinDataState;
import kr.dogfoot.hwplib.object.docinfo.bindata.BinDataType;
import kr.dogfoot.hwplib.object.docinfo.borderfill.fillinfo.FillInfo;
import kr.dogfoot.hwplib.object.docinfo.borderfill.fillinfo.ImageFill;
import kr.dogfoot.hwplib.object.docinfo.borderfill.fillinfo.ImageFillType;
import kr.dogfoot.hwplib.object.docinfo.borderfill.fillinfo.PictureEffect;
import kr.dogfoot.hwplib.tool.objectfinder.CellFinder;
public class InsertingImageCell {
public static void IMPL_InsertPicture(HWPFile hwpFile, String fieldName, String imgFilePath) throws IOException {
if(imgFilePath != null && !imgFilePath.equals("")) {
File file = new File(imgFilePath);
if(file.exists()) {
InsertingImageCell tii = new InsertingImageCell();
tii.insertShapeWithImage(hwpFile, fieldName, imgFilePath);
}
}
}
private final String imageFileExt = "jpg";
private final BinDataCompress compressMethod = BinDataCompress.ByStorageDefault;
private int instanceID = 0x5bb840e1;
private HWPFile hwpFile;
private String imageFilePath;
private String fieldName;
private int streamIndex;
private int binDataID;
private ControlRectangle rectangle;
private Rectangle shapePosition = new Rectangle(1, 1, 20, 20);
private void insertShapeWithImage(HWPFile hwpFile, String fieldName, String imgFilePath) throws IOException {
this.hwpFile = hwpFile;
this.fieldName = fieldName;
this.imageFilePath = imgFilePath;
addBinData();
binDataID = addBinDataInDocInfo(streamIndex);
addGsoControl();
}
private void addBinData() throws IOException {
streamIndex = hwpFile.getBinData().getEmbeddedBinaryDataList().size() + 1;
String streamName = getStreamName();
byte[] fileBinary = loadFile();
hwpFile.getBinData().addNewEmbeddedBinaryData(streamName, fileBinary, compressMethod);
}
private String getStreamName() {
return "Bin" + String.format("%04X", streamIndex) + "." + imageFileExt;
}
private byte[] loadFile() throws IOException {
File file = new File(imageFilePath);
byte[] buffer = new byte[(int) file.length()];
InputStream ios = null;
try {
ios = new FileInputStream(file);
int count = ios.read(buffer);
if(count != file.length()) {
throw new RuntimeException("[F]파일 로드 오류");
}
} finally {
try {
if (ios != null)
ios.close();
} catch (IOException e) {
}
}
return buffer;
}
private int addBinDataInDocInfo(int streamIndex) {
BinData bd = new BinData();
bd.getProperty().setType(BinDataType.Embedding);
bd.getProperty().setCompress(compressMethod);
bd.getProperty().setState(BinDataState.NotAccess);
bd.setBinDataID(streamIndex);
bd.setExtensionForEmbedding(imageFileExt);
hwpFile.getDocInfo().getBinDataList().add(bd);
return hwpFile.getDocInfo().getBinDataList().size();
}
private void addGsoControl() {
createRectangleControlAtCell();
setCtrlHeaderGso();
setShapeComponent();
setShapeComponentRectangle();
}
private void createRectangleControlAtCell() {
ArrayList<Cell> cellList = CellFinder.findAll(hwpFile, fieldName);
if(cellList != null && !cellList.isEmpty()) {
Cell c = cellList.get(0);
int cellWidth = (int)c.getListHeader().getWidth();
int cellHeight = (int)c.getListHeader().getHeight();
shapePosition = new Rectangle(1, 1, cellWidth, cellHeight);
Paragraph firstPara = c.getParagraphList().getParagraph(0);
ParaText paraText = firstPara.getText();
if (paraText == null) {
firstPara.createText();
paraText = firstPara.getText();
}
// 문단에서 사각형 컨트롤의 위치를 표현하기 위한 확장 문자를 넣는다.
paraText.addExtendCharForGSO();
// 문단에 사각형 컨트롤 추가한다.
rectangle = (ControlRectangle) firstPara.addNewGsoControl(GsoControlType.Rectangle);
}
}
private void setCtrlHeaderGso() {
CtrlHeaderGso hdr = rectangle.getHeader();
GsoHeaderProperty prop = hdr.getProperty();
prop.setLikeWord(false);
prop.setApplyLineSpace(false);
prop.setVertRelTo(VertRelTo.Para);
prop.setVertRelativeArrange(RelativeArrange.TopOrLeft);
prop.setHorzRelTo(HorzRelTo.Para);
prop.setHorzRelativeArrange(RelativeArrange.TopOrLeft);
prop.setVertRelToParaLimit(true);
prop.setAllowOverlap(true);
prop.setWidthCriterion(WidthCriterion.Absolute);
prop.setHeightCriterion(HeightCriterion.Absolute);
prop.setProtectSize(false);
prop.setTextFlowMethod(TextFlowMethod.FitWithText);
prop.setTextHorzArrange(TextHorzArrange.BothSides);
prop.setObjectNumberSort(ObjectNumberSort.Figure);
hdr.setyOffset(shapePosition.y);
hdr.setxOffset(shapePosition.x);
hdr.setWidth(shapePosition.width);
hdr.setHeight(shapePosition.height);
hdr.setzOrder(0);
hdr.setOutterMarginLeft(0);
hdr.setOutterMarginRight(0);
hdr.setOutterMarginTop(0);
hdr.setOutterMarginBottom(0);
hdr.setInstanceId(instanceID);
hdr.setPreventPageDivide(false);
hdr.getExplanation().setBytes(null);
}
public int fromMM(int mm) {
if (mm == 0) {
return 1;
}
return (int) ((double) mm * 72000.0f / 254.0f + 0.5f);
}
private void setShapeComponent() {
ShapeComponentNormal sc = (ShapeComponentNormal) rectangle.getShapeComponent();
sc.setOffsetX(0);
sc.setOffsetY(0);
sc.setGroupingCount(0);
sc.setLocalFileVersion(1);
sc.setWidthAtCreate(shapePosition.width);
sc.setHeightAtCreate(shapePosition.height);
sc.setWidthAtCurrent(shapePosition.width);
sc.setHeightAtCurrent(shapePosition.height);
sc.setRotateAngle(0);
sc.setRotateXCenter((shapePosition.width / 2));
sc.setRotateYCenter((shapePosition.height / 2));
sc.createLineInfo();
LineInfo li = sc.getLineInfo();
li.getProperty().setLineEndShape(LineEndShape.Flat);
li.getProperty().setStartArrowShape(LineArrowShape.None);
li.getProperty().setStartArrowSize(LineArrowSize.MiddleMiddle);
li.getProperty().setEndArrowShape(LineArrowShape.None);
li.getProperty().setEndArrowSize(LineArrowSize.MiddleMiddle);
li.getProperty().setFillStartArrow(true);
li.getProperty().setFillEndArrow(true);
li.getProperty().setLineType(LineType.None);
li.setOutlineStyle(OutlineStyle.Normal);
li.setThickness(0);
li.getColor().setValue(0);
sc.createFillInfo();
FillInfo fi = sc.getFillInfo();
fi.getType().setPatternFill(false);
fi.getType().setImageFill(true);
fi.getType().setGradientFill(false);
fi.createImageFill();
ImageFill imgF = fi.getImageFill();
imgF.setImageFillType(ImageFillType.FitSize);
imgF.getPictureInfo().setBrightness((byte) 0);
imgF.getPictureInfo().setContrast((byte) 0);
imgF.getPictureInfo().setEffect(PictureEffect.RealPicture);
imgF.getPictureInfo().setBinItemID(binDataID);
sc.createShadowInfo();
ShadowInfo si = sc.getShadowInfo();
si.setType(ShadowType.None);
si.getColor().setValue(0xc4c4c4);
si.setOffsetX(283);
si.setOffsetY(283);
si.setTransparent((short) 0);
sc.setMatrixsNormal();
}
private void setShapeComponentRectangle() {
ShapeComponentRectangle scr = rectangle.getShapeComponentRectangle();
scr.setRoundRate((byte) 0);
scr.setX1(0);
scr.setY1(0);
scr.setX2(shapePosition.width);
scr.setY2(0);
scr.setX3(shapePosition.width);
scr.setY3(shapePosition.height);
scr.setX4(0);
scr.setY4(shapePosition.height);
}
}

@ -0,0 +1,43 @@
package cokr.xit.fims.cmmn.hwp;
import java.util.ArrayList;
import cokr.xit.base.docs.hwp.HWPWriter;
import kr.dogfoot.hwplib.object.bodytext.control.Control;
import kr.dogfoot.hwplib.object.bodytext.control.ControlTable;
import kr.dogfoot.hwplib.object.bodytext.control.ControlType;
import kr.dogfoot.hwplib.object.bodytext.control.table.Cell;
import kr.dogfoot.hwplib.object.bodytext.control.table.Row;
import kr.dogfoot.hwplib.tool.objectfinder.ControlFinder;
public class OffcsCellFinder {
public static Cell find(HWPWriter writer) {
ArrayList<Control> find = ControlFinder.find(writer.getFile(), (control, paragrpah, section) -> {
if(control.getType().equals(ControlType.Table)) {
ArrayList<Row> rl = ((ControlTable)control).getRowList();
if(rl.size() == 1) {
ArrayList<Cell> cl = rl.get(0).getCellList();
if(cl.size() == 1) {
String fn = cl.get(0).getListHeader().getFieldName();
if(fn != null && !fn.equals("")) {
if(fn.equals("직인")) {
return true;
}
}
}
}
}
return false;
});
if(find != null && !find.isEmpty()) {
ControlTable tableForOffcs = (ControlTable) find.get(0);
Cell cell = tableForOffcs.getRowList().get(0).getCellList().get(0);
return cell;
}
return null;
}
}

@ -2,11 +2,10 @@ package cokr.xit.fims.cmmn.hwp.format;
import java.util.List; import java.util.List;
import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.cmmn.hwp.InsertingImageCell;
import cokr.xit.fims.mngt.FactionUtil; import cokr.xit.fims.mngt.FactionUtil;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile; import kr.dogfoot.hwplib.object.HWPFile;
@ -16,92 +15,71 @@ import kr.dogfoot.hwplib.object.HWPFile;
*/ */
public class CrdnConfirm extends HWPFormat { public class CrdnConfirm extends HWPFormat {
@Override public CrdnConfirm(PrintOption printOption, Print print, List<DataObject> dataObjectList) {
public List<String> getDownloadDataNames() { super(printOption, print, dataObjectList);
return List.of("과태료구분","차량번호","단속일시","위반내용","단속장소","단속동","단속조","소유자명","소유자주소"); this.maxRunCount = dataObjectList.size();
this.formatFilePath = "template/hwp/crdnConfirm.hwp";
this.print.setFormatKorName("단속확인서");
this.print.setFormatName("crdnConfirm");
} }
@Override @Override
public void setting(Print print) { public List<String> getDownloadDataNames() {
print.setFormatName("crdnConfirm"); return List.of("과태료구분","차량번호","단속일시","위반내용","단속장소","단속동","단속조","소유자명","소유자주소");
print.setFormatKorName("단속확인서");
this.setFormatType("info");
this.setRecordPerPartFile(1);
this.setBaseFormatFilePath("template/hwp/crdnConfirm.hwp");
this.setAttachFormatFilePath("");
} }
@Override
public void setting(Print print, int recordCnt) {
print.setFormatName("crdnConfirm");
print.setFormatKorName("단속확인서");
this.setFormatType("info");
this.setRecordPerPartFile(recordCnt);
this.setBaseFormatFilePath("template/hwp/crdnConfirm.hwp");
this.setAttachFormatFilePath("");
}
@Override @Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption, public void runAsWriter() {
Print print) { HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
} this.writer = new HWPWriter(hwpFile);
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile,
DataObject dataObject, Print print) {
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
baseFileEditor.set("과태료", dataObject.string("TASK_SE_NM"));
baseFileEditor.set("차량번호", dataObject.string("VHRNO"));
String crdnYmdTm = dataObject.string("CRDN_YMD_TM");
crdnYmdTm = CmmnUtil.yyyy_mm_dd_hh_mm_ss(crdnYmdTm);
baseFileEditor.set("단속일시", crdnYmdTm);
baseFileEditor.set("위반내용", dataObject.string("VLTN_ARTCL"));
baseFileEditor.set("단속장소", dataObject.string("CRDN_PLC"));
baseFileEditor.set("단속동", dataObject.string("CRDN_STDG_NM"));
baseFileEditor.set("단속조", dataObject.string("TEAM_NM"));
baseFileEditor.set("소유자", dataObject.string("RTPYR_NM"));
baseFileEditor.set("주소", dataObject.string("RTPYR_FULL_ADDR"));
baseFileEditor.set("우편번호", dataObject.string("RTPYR_ZIP"));
String printRequestYmd = print.getPrintRequestDt().substring(0, 8); String printRequestYmd = print.getPrintRequestDt().substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4); String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6); String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8); String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일"; String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
baseFileEditor.set("연월일", ymd);
String instNm = FactionUtil.getInstituteLeader((String)print.getPrintRequestUserInfo().getInfo().get("instNm"), false);
String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm); DataObject one = data.get(currentRunCount);
DataObject newObj = (DataObject) new DataObject()
try { .set("과태료", one.string("TASK_SE_NM"))
if(!dataObject.string("PHOTO1").equals("")) { .set("차량번호", one.string("VHRNO"))
InsertingImageCell.IMPL_InsertPicture(baseFile, "왼쪽위사진", dataObject.string("PHOTO1")); .set("단속일시", CmmnUtil.yyyy_mm_dd_hh_mm_ss(one.string("CRDN_YMD_TM")))
} .set("위반내용", one.string("VLTN_ARTCL"))
if(!dataObject.string("PHOTO2").equals("")) { .set("단속장소", one.string("CRDN_PLC"))
InsertingImageCell.IMPL_InsertPicture(baseFile, "오른쪽위사진", dataObject.string("PHOTO2")); .set("단속동", one.string("CRDN_STDG_NM"))
} .set("단속조", one.string("TEAM_NM"))
if(!dataObject.string("PHOTO3").equals("")) { .set("소유자", one.string("RTPYR_NM"))
InsertingImageCell.IMPL_InsertPicture(baseFile, "왼쪽아래사진", dataObject.string("PHOTO3")); .set("주소", one.string("RTPYR_FULL_ADDR"))
} .set("우편번호", one.string("RTPYR_ZIP"))
if(!dataObject.string("PHOTO4").equals("")) { .set("연월일", ymd)
InsertingImageCell.IMPL_InsertPicture(baseFile, "오른쪽아래사진", dataObject.string("PHOTO4")); .set("발신", instNm);
}
} catch(Exception e) { if(!one.string("PHOTO1").equals("")) {
newObj.set("왼쪽위사진", writer.image().add(one.string("PHOTO1")));
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다."); }
if(!one.string("PHOTO2").equals("")) {
newObj.set("오른쪽위사진", writer.image().add(one.string("PHOTO2")));
} }
if(!one.string("PHOTO3").equals("")) {
newObj.set("왼쪽아래사진", writer.image().add(one.string("PHOTO3")));
}
if(!one.string("PHOTO4").equals("")) {
newObj.set("오른쪽아래사진", writer.image().add(one.string("PHOTO4")));
}
writer.table(0, 0, 13).setValues(List.of(newObj));
String tempPath = this.pathForNewFile(currentRunCount+1);
writer.write(tempPath);
resultFilesPath.add(tempPath);
} }
} }

@ -2,11 +2,12 @@ package cokr.xit.fims.cmmn.hwp.format;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.IntStream;
import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.mngt.FactionUtil; import cokr.xit.fims.mngt.FactionUtil;
import cokr.xit.foundation.data.DataFormat; import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
@ -17,6 +18,14 @@ import kr.dogfoot.hwplib.object.HWPFile;
*/ */
public class CrdnList extends HWPFormat { public class CrdnList extends HWPFormat {
public CrdnList(PrintOption printOption, Print print, List<DataObject> dataObjectList){
super(printOption, print, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/crdnList.hwp";
this.print.setFormatKorName("단속내역서");
this.print.setFormatName("crdnList");
}
@Override @Override
public List<String> getDownloadDataNames() { public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
@ -37,86 +46,59 @@ public class CrdnList extends HWPFormat {
return list; return list;
} }
@Override
public void setting(Print print) {
print.setFormatName("crdnList");
print.setFormatKorName("단속내역서");
this.setFormatType("list");
this.setRecordPerPartFile(6);
this.setBaseFormatFilePath("template/hwp/crdnList_root.hwp");
this.setAttachFormatFilePath("template/hwp/crdnList_inner.hwp");
}
@Override
public void setting(Print print, int recordCnt) {
print.setFormatName("crdnList");
print.setFormatKorName("단속내역서");
this.setFormatType("list");
this.setRecordPerPartFile(recordCnt);
this.setBaseFormatFilePath("template/hwp/crdnList_root.hwp");
this.setAttachFormatFilePath("template/hwp/crdnList_inner.hwp");
}
@Override @Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, public void runAsWriter() {
PrintOption printOption, Print print) { HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile);
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile); String globalRtpyrNm = data.get(0).string("RTPYR_NM");
String globalRtpyrNo = data.get(0).string("RTPYR_NO");
String globalRtpyrFullAddr = data.get(0).string("RTPYR_FULL_ADDR");
int globalTotalAmount = data.stream().mapToInt(i -> i.number("LEVY_AMT").intValue()).sum();
String globalRtpyrNm = dataObjectList.get(0).string("RTPYR_NM"); writer.setValue("출력일시", CmmnUtil.yyyy_mm_dd_hh_mm_ss(print.getPrintRequestDt()));
String globalRtpyrNo = dataObjectList.get(0).string("RTPYR_NO"); writer.setValue("성명", globalRtpyrNm);
String globalRtpyrFullAddr = dataObjectList.get(0).string("RTPYR_FULL_ADDR");
int globalTotalAmount = dataObjectList.stream().mapToInt(i -> i.number("LEVY_AMT").intValue()).sum();
//상단
baseFileEditor.set("성명", globalRtpyrNm);
if(print.getPrivateInfoYn(printOption)) { if(print.getPrivateInfoYn(printOption)) {
baseFileEditor.set("주민번호", globalRtpyrNo); writer.setValue("주민번호", globalRtpyrNo);
} else { } else {
baseFileEditor.set("주민번호", "*************"); writer.setValue("주민번호", "*************");
} }
writer.setValue("주소", globalRtpyrFullAddr);
baseFileEditor.set("주소", globalRtpyrFullAddr); writer.setValue("총건수", DataFormat.n_nn0(print.getTotalDataCount(this.data)));
baseFileEditor.set("총건수", CmmnUtil.addCommaToNumber(print.getTotalDataCount(dataObjectList))); writer.setValue("총금액", DataFormat.n_nn0(globalTotalAmount));
baseFileEditor.set("총금액", CmmnUtil.addCommaToNumber(globalTotalAmount));
baseFileEditor.set("출력일시", CmmnUtil.yyyy_mm_dd_hh_mm_ss(print.getPrintRequestDt()));
String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm"); String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = FactionUtil.getLastWord(instNm); instNm = FactionUtil.getLastWord(instNm);
baseFileEditor.set("발신", instNm); writer.setValue("발신", instNm);
}
List<DataObject> list = IntStream.rangeClosed(1, this.data.size()).boxed().map(i -> {
DataObject one = data.get(i-1);
return (DataObject) new DataObject()
.set("과태료", one.string("TASK_SE_NM"))
.set("시군구명", one.string("SGG_NM"))
.set("단속일시", CmmnUtil.yyyy_mm_dd_hh_mm_ss(one.string("CRDN_YMD_TM")))
.set("단속장소", one.string("CRDN_PLC"))
.set("차량번호", one.string("VHRNO"))
.set("대체차량번호", one.string("RPM_SZR_VHRNO"))
.set("고지번호", one.string("GOJI_NO"))
.set("금액", DataFormat.n_nn0(one.string("LEVY_AMT")))
.set("가상계좌번호", one.string("VR_ACTNO"))
.set("전자납부번호", one.string("EPAYNO"))
.set("처리상태", one.string("CRDN_STTS_NM"))
.set("처리일자", DataFormat.yyyy_mm_dd(one.string("CRDN_STTS_CHG_DT").substring(0, 8)))
.set("납부기한", DataFormat.yyyy_mm_dd(one.string("DUDT_YMD")))
.set("수납일자", DataFormat.yyyy_mm_dd(one.string("RCVMT_YMD")));
}).toList();
writer.table(2, 0, 3).setValues(list);
String tempPath = this.pathForNewFile(currentRunCount+1);
writer.write(tempPath);
resultFilesPath.add(tempPath);
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile,
DataObject dataObject, Print print) {
ClickHereEditor attachFileEditor = new ClickHereEditor(attachFile);
attachFileEditor.set("과태료", dataObject.string("TASK_SE_NM"));
attachFileEditor.set("시군구명", dataObject.string("SGG_NM"));
String crdnYmdTm = dataObject.string("CRDN_YMD_TM");
crdnYmdTm = CmmnUtil.yyyy_mm_dd_hh_mm_ss(crdnYmdTm);
attachFileEditor.set("단속일시", crdnYmdTm);
attachFileEditor.set("단속장소", dataObject.string("CRDN_PLC"));
attachFileEditor.set("차량번호", dataObject.string("VHRNO"));
attachFileEditor.set("대체차량번호", dataObject.string("RPM_SZR_VHRNO"));
attachFileEditor.set("고지번호", dataObject.string("GOJI_NO"));
attachFileEditor.set("금액", CmmnUtil.addCommaToNumber(dataObject.string("LEVY_AMT")));
attachFileEditor.set("가상계좌번호", dataObject.string("VR_ACTNO"));
attachFileEditor.set("전자납부번호", dataObject.string("EPAYNO"));
attachFileEditor.set("처리상태", dataObject.string("CRDN_STTS_NM"));
String crdnSttsChgDt = dataObject.string("CRDN_STTS_CHG_DT");
crdnSttsChgDt = DataFormat.yyyy_mm_dd(crdnSttsChgDt.substring(0, 8));
attachFileEditor.set("처리일자", crdnSttsChgDt);
attachFileEditor.set("납부기한", DataFormat.yyyy_mm_dd(dataObject.string("DUDT_YMD")));
attachFileEditor.set("수납일자", DataFormat.yyyy_mm_dd(dataObject.string("RCVMT_YMD")));
} }
} }

@ -1,98 +1,130 @@
package cokr.xit.fims.cmmn.hwp.format; package cokr.xit.fims.cmmn.hwp.format;
import java.io.InputStream; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import org.springframework.core.io.ClassPathResource; import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.AddUtil;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.cmmn.hwp.InsertingImageCell;
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; import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.reader.HWPReader;
public class CvlcptOrgn extends HWPFormat { public class CvlcptOrgn extends HWPFormat {
private List<DataObject> data2 = null;
@Override public CvlcptOrgn(PrintOption printOption, Print print, List<DataObject> dataObjectList) {
public List<String> getDownloadDataNames() { super(printOption, print, dataObjectList);
return List.of("접수번호","신청자","접수일자","처리기한","민원목록번호","민원내용"); this.maxRunCount = 1;
} this.formatFilePath = "template/hwp/cvlcptOrgnl_text.hwp";
this.print.setFormatKorName("민원원본내역");
this.print.setFormatName("cvlcptOrgnl");
@Override this.data2 = new ArrayList<DataObject>();
public void setting(Print print) { if(!dataObjectList.get(0).string("PHOTO0").equals("")) {
print.setFormatName("cvlcptOrgn");
print.setFormatKorName("민원원본내역"); int photoCnt = dataObjectList.get(0).number("ORGN_PHOTO_CNT").intValue();
int PHOTO_COUNT_PER_PAGE = 4;
this.setFormatType("info"); for(int i=0; i < photoCnt; i += PHOTO_COUNT_PER_PAGE) {
this.setRecordPerPartFile(1);
this.setBaseFormatFilePath("template/hwp/cvlcptOrgnl_text.hwp"); DataObject photoObj = new DataObject();
this.setAttachFormatFilePath("template/hwp/cvlcptOrgnl_photo.hwp");
photoObj.set("PHOTO1", dataObjectList.get(0).string("PHOTO"+i));
if(i+1 < photoCnt)
photoObj.set("PHOTO2", dataObjectList.get(0).string("PHOTO"+(i+1)));
if(i+2 < photoCnt)
photoObj.set("PHOTO3", dataObjectList.get(0).string("PHOTO"+(i+2)));
if(i+3 < photoCnt)
photoObj.set("PHOTO4", dataObjectList.get(0).string("PHOTO"+(i+3)));
data2.add(photoObj);
}
}
} }
@Override @Override
public void setting(Print print, int cnt) { public List<String> getDownloadDataNames() {
return List.of("접수번호","신청자","접수일자","처리기한","민원목록번호","민원내용");
} }
@Override @Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption, public HashMap<String, Object> makeFile(){
Print print) { runAsWriter();
writer = null;
currentRunCount++;
if(data2 != null && data2.size() > 0) {
formatFilePath = "template/hwp/cvlcptOrgnl_photo.hwp";
maxRunCount = data2.size()+1;
while(currentRunCount != maxRunCount) {
runAsWriter();
writer = null;
currentRunCount++;
}
}
return getResult();
} }
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile, DataObject dataObject, Print print) {
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
baseFileEditor.set("신청자", dataObject.string("CVLCPT_APLCNT_NM")); @Override
baseFileEditor.set("접수일자", DataFormat.yyyy_mm_dd(dataObject.string("CVLCPT_RCPT_YMD"))); public void runAsWriter() {
String cvlcptRrcsPrnmntDt = dataObject.string("CVLCPT_PRCS_PRNMNT_DT"); HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
if(cvlcptRrcsPrnmntDt.length() > 8) { this.writer = new HWPWriter(hwpFile);
cvlcptRrcsPrnmntDt = cvlcptRrcsPrnmntDt.substring(0, 8);
}
baseFileEditor.set("처리기한", DataFormat.yyyy_mm_dd(cvlcptRrcsPrnmntDt)); if(this.formatFilePath.equals("template/hwp/cvlcptOrgnl_text.hwp")) {
baseFileEditor.set("접수번호", dataObject.string("CVLCPT_RCPT_NO"));
baseFileEditor.set("목록번호", dataObject.string("CVLCPT_LIST_NO"));
String cvlcptAplyCn = dataObject.string("CVLCPT_APLY_CN");
cvlcptAplyCn = CmmnUtil.escapeHTMLEntity(cvlcptAplyCn);
baseFileEditor.set("민원내용", cvlcptAplyCn);
try { DataObject one = data.get(0);
if(dataObject.string("PHOTO0") != null && !dataObject.string("PHOTO0").equals("")) { writer.setValue("신청자", one.string("CVLCPT_APLCNT_NM"));
writer.setValue("접수일자", DataFormat.yyyy_mm_dd(one.string("CVLCPT_RCPT_YMD")));
int photoCnt = dataObject.number("ORGN_PHOTO_CNT").intValue(); String cvlcptRrcsPrnmntDt = one.string("CVLCPT_PRCS_PRNMNT_DT");
int PHOTO_COUNT_PER_PAGE = 4; if(cvlcptRrcsPrnmntDt.length() > 8) {
cvlcptRrcsPrnmntDt = cvlcptRrcsPrnmntDt.substring(0, 8);
}
for(int i=0; i < photoCnt; i += PHOTO_COUNT_PER_PAGE) { writer.setValue("처리기한", DataFormat.yyyy_mm_dd(cvlcptRrcsPrnmntDt));
writer.setValue("접수번호", one.string("CVLCPT_RCPT_NO"));
writer.setValue("목록번호", one.string("CVLCPT_LIST_NO"));
InputStream attachFormatIS = new ClassPathResource(this.attachFormatFilePath).getInputStream(); String cvlcptAplyCn = one.string("CVLCPT_APLY_CN");
HWPFile attachFormatFile = HWPReader.fromInputStream(attachFormatIS); cvlcptAplyCn = CmmnUtil.escapeHTMLEntity(cvlcptAplyCn);
InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "왼쪽위사진", dataObject.string("PHOTO"+i)); writer.setValue("민원내용", cvlcptAplyCn);
if(i+1 < photoCnt)
InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "오른쪽위사진", dataObject.string("PHOTO"+(i+1)));
if(i+2 < photoCnt)
InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "왼쪽아래사진", dataObject.string("PHOTO"+(i+2)));
if(i+3 < photoCnt)
InsertingImageCell.IMPL_InsertPicture(attachFormatFile, "오른쪽아래사진", dataObject.string("PHOTO"+(i+3)));
AddUtil.appendToLast(attachFormatFile, baseFile);
} } else {
DataObject one = data2.get(currentRunCount-1);
DataObject newObj = new DataObject();
if(!one.string("PHOTO1").equals("")) {
newObj.set("왼쪽위사진", writer.image().add(one.string("PHOTO1")));
} }
} catch (Exception e) { if(!one.string("PHOTO2").equals("")) {
throw new RuntimeException("[F]"+e); newObj.set("오른쪽위사진", writer.image().add(one.string("PHOTO2")));
}
if(!one.string("PHOTO3").equals("")) {
newObj.set("왼쪽아래사진", writer.image().add(one.string("PHOTO3")));
}
if(!one.string("PHOTO4").equals("")) {
newObj.set("오른쪽아래사진", writer.image().add(one.string("PHOTO4")));
}
writer.table(0, 0, 2).setValues(List.of(newObj));
} }
String tempPath = this.pathForNewFile(currentRunCount+1);
writer.write(tempPath);
resultFilesPath.add(tempPath);
} }
} }

@ -3,14 +3,22 @@ package cokr.xit.fims.cmmn.hwp.format;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile; import kr.dogfoot.hwplib.object.HWPFile;
public class DlbrDecsnList extends HWPFormat { public class DlbrDecsnList extends HWPFormat {
public DlbrDecsnList(PrintOption printOption, Print print, List<DataObject> dataObjectList) {
super(printOption, print, dataObjectList);
this.maxRunCount = dataObjectList.size();
this.formatFilePath = "template/hwp/opnnDlbrDecsnForm.hwp";
this.print.setFormatKorName("의견제출심의결의서");
this.print.setFormatName("dlbrDecsnList");
}
@Override @Override
public List<String> getDownloadDataNames() { public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
@ -29,72 +37,47 @@ public class DlbrDecsnList extends HWPFormat {
return list; return list;
} }
@Override
public void setting(Print print) {
print.setFormatName("dlbrDecsn");
print.setFormatKorName("의견제출심의결의서");
this.setFormatType("info");
this.setRecordPerPartFile(1);
this.setBaseFormatFilePath("template/hwp/opnnDlbrDecsnForm.hwp");
this.setAttachFormatFilePath("");
}
@Override @Override
public void setting(Print print, int recordCnt) { public void runAsWriter() {
print.setFormatName("dlbrDecsn"); HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
print.setFormatKorName("의견제출심의결의서"); this.writer = new HWPWriter(hwpFile);
this.setFormatType("info"); DataObject one = data.get(currentRunCount);
this.setRecordPerPartFile(recordCnt);
writer.setValue("접수번호", one.string("RCPT_NO_MASK"));
writer.setValue("접수일", one.string("RCPT_YMD_MASK"));
writer.setValue("위반정보", one.string("TASK_SE_NM"));
writer.setValue("진술자명", one.string("STTR_NM"));
writer.setValue("진술자생년월일", one.string("STTR_BRDT_FORMAT"));
writer.setValue("진술자연락처", one.string("STTR_CTTPC"));
writer.setValue("소유주관계", one.string("OWNR_REL_NM"));
writer.setValue("진술자주소", one.string("STTR_WHOL_ADDR"));
writer.setValue("차량번호", one.string("VHRNO"));
writer.setValue("단속일시", one.string("CRDN_YMD_TM_MASK"));
writer.setValue("단속장소", one.string("CRDN_PLC"));
writer.setValue("의견제출내용", one.string("OPNN_SBMSN_CN"));
writer.setValue("심의회원직급1", one.string("DLBR_MBR_JBGD1"));
writer.setValue("심의회원명1", one.string("DLBR_MBR_NM1"));
writer.setValue("심의회원직급2", one.string("DLBR_MBR_JBGD2"));
writer.setValue("심의회원명2", one.string("DLBR_MBR_NM2"));
writer.setValue("심의회원직급3", one.string("DLBR_MBR_JBGD3"));
writer.setValue("심의회원명3", one.string("DLBR_MBR_NM3"));
writer.setValue("심의회원직급4", one.string("DLBR_MBR_JBGD4"));
writer.setValue("심의회원명4", one.string("DLBR_MBR_NM4"));
writer.setValue("심의회원직급5", one.string("DLBR_MBR_JBGD5"));
writer.setValue("심의회원명5", one.string("DLBR_MBR_NM5"));
writer.setValue("심의회원직급6", one.string("DLBR_MBR_JBGD6"));
writer.setValue("심의회원명6", one.string("DLBR_MBR_NM6"));
writer.setValue("심의회원직급7", one.string("DLBR_MBR_JBGD7"));
writer.setValue("심의회원명7", one.string("DLBR_MBR_NM7"));
writer.setValue("담당자검토의견", one.string("PIC_RVW_OPNN"));
String tempPath = this.pathForNewFile(currentRunCount+1);
writer.write(tempPath);
resultFilesPath.add(tempPath);
this.setBaseFormatFilePath("template/hwp/opnnDlbrDecsnForm.hwp");
this.setAttachFormatFilePath("");
} }
@Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption, Print print) {
}
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile, DataObject dataObject, Print print) {
//
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
baseFileEditor.set("접수번호", dataObject.string("RCPT_NO_MASK"));
baseFileEditor.set("접수일", dataObject.string("RCPT_YMD_MASK"));
baseFileEditor.set("위반정보", dataObject.string("TASK_SE_NM"));
baseFileEditor.set("진술자명", dataObject.string("STTR_NM"));
baseFileEditor.set("진술자생년월일", dataObject.string("STTR_BRDT_FORMAT"));
baseFileEditor.set("진술자연락처", dataObject.string("STTR_CTTPC"));
baseFileEditor.set("소유주관계", dataObject.string("OWNR_REL_NM"));
baseFileEditor.set("진술자주소", dataObject.string("STTR_WHOL_ADDR"));
baseFileEditor.set("차량번호", dataObject.string("VHRNO"));
baseFileEditor.set("단속일시", dataObject.string("CRDN_YMD_TM_MASK"));
baseFileEditor.set("단속장소", dataObject.string("CRDN_PLC"));
baseFileEditor.set("의견제출내용", dataObject.string("OPNN_SBMSN_CN"));
baseFileEditor.set("심의회원직급1", dataObject.string("DLBR_MBR_JBGD1"));
baseFileEditor.set("심의회원명1", dataObject.string("DLBR_MBR_NM1"));
baseFileEditor.set("심의회원직급2", dataObject.string("DLBR_MBR_JBGD2"));
baseFileEditor.set("심의회원명2", dataObject.string("DLBR_MBR_NM2"));
baseFileEditor.set("심의회원직급3", dataObject.string("DLBR_MBR_JBGD3"));
baseFileEditor.set("심의회원명3", dataObject.string("DLBR_MBR_NM3"));
baseFileEditor.set("심의회원직급4", dataObject.string("DLBR_MBR_JBGD4"));
baseFileEditor.set("심의회원명4", dataObject.string("DLBR_MBR_NM4"));
baseFileEditor.set("심의회원직급5", dataObject.string("DLBR_MBR_JBGD5"));
baseFileEditor.set("심의회원명5", dataObject.string("DLBR_MBR_NM5"));
baseFileEditor.set("심의회원직급6", dataObject.string("DLBR_MBR_JBGD6"));
baseFileEditor.set("심의회원명6", dataObject.string("DLBR_MBR_NM6"));
baseFileEditor.set("심의회원직급7", dataObject.string("DLBR_MBR_JBGD7"));
baseFileEditor.set("심의회원명7", dataObject.string("DLBR_MBR_NM7"));
baseFileEditor.set("담당자검토의견", dataObject.string("PIC_RVW_OPNN"));
}
} }

@ -1,108 +1,98 @@
package cokr.xit.fims.cmmn.hwp.format; package cokr.xit.fims.cmmn.hwp.format;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import org.springframework.core.io.ClassPathResource; import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.HwpMerge;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile; import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.reader.HWPReader; import kr.dogfoot.hwplib.reader.HWPReader;
import kr.dogfoot.hwplib.writer.HWPWriter;
public abstract class HWPFormat {
protected String formatType;
protected int recordPerPartFile; public abstract class HWPFormat {
protected HWPWriter writer;
protected String baseFormatFilePath;
protected String attachFormatFilePath;
protected int totalPartFileCount; protected PrintOption printOption;
protected Print print;
protected List<DataObject> data;
public String getFormatType() { protected String formatFilePath;
return this.formatType;
}
public void setFormatType(String formatType) { protected int currentRunCount;
this.formatType = formatType; protected int maxRunCount;
} protected List<String> resultFilesPath;
public int getRecordPerPartFile() {
return this.recordPerPartFile;
}
public void setRecordPerPartFile(int recordPerPartFile) { public HWPFormat(PrintOption printOption, Print print, List<DataObject> dataObjectList) {
this.recordPerPartFile = recordPerPartFile; this.resultFilesPath = new ArrayList<String>();
this.currentRunCount = 0;
this.data = dataObjectList;
this.printOption = printOption;
this.print = print;
} }
public int getTotalPartFileCount() { public HashMap<String, Object> makeFile(){
return this.totalPartFileCount; while(currentRunCount != maxRunCount) {
} runAsWriter();
writer = null;
currentRunCount++;
}
public void setTotalPartFileCount(int totalPartFileCount) { return getResult();
this.totalPartFileCount = totalPartFileCount; };
}
public String getBaseFormatFilePath() {
return this.baseFormatFilePath;
}
public void setBaseFormatFilePath(String baseFormatFilePath) { protected abstract void runAsWriter();
this.baseFormatFilePath = baseFormatFilePath;
}
public String getAttachFormatFilePath() { protected HashMap<String, Object> getResult(){
return this.attachFormatFilePath; HashMap<String,Object> result = new HashMap<String,Object>();
}
public void setAttachFormatFilePath(String attachFormatFilePath) { String downlaodFileName = this.print.getFormatKorName()+"_"+this.print.getPrintRequestDt()+".hwp";
this.attachFormatFilePath = attachFormatFilePath;
}
if(resultFilesPath.size() >= 2) {
/** . try {
* @param String basePath = resultFilesPath.get(0);
* @return HWPFile baseFile = HWPReader.fromFile(basePath);
*/
public void calcTotalPartFileCount(int totalDataCount) {
if(this.formatType.equals("list")) {
if(totalDataCount <= this.recordPerPartFile) { for(int i=2; i <= resultFilesPath.size();i++) {
this.totalPartFileCount = 1; String attachPath = resultFilesPath.get(i-1);
} else { HWPFile attachFile = HWPReader.fromFile(attachPath);
HwpMerge.appendToLast(attachFile, baseFile);
}
int mod = (totalDataCount % this.recordPerPartFile); kr.dogfoot.hwplib.writer.HWPWriter.toFile(baseFile, basePath);
} catch (Exception e) {
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
this.totalPartFileCount = (totalDataCount - mod) / this.recordPerPartFile; for(int i=2; i <= resultFilesPath.size();i++) {
if(mod > 0) { if(!(new File(resultFilesPath.get(i-1))).delete()) {
this.totalPartFileCount = this.totalPartFileCount + 1; throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
} }
} }
} else {
this.totalPartFileCount = totalDataCount;
} }
} result.put("filename", downlaodFileName);
result.put("filePath", resultFilesPath.get(0));
result.put("file", new File(resultFilesPath.get(0)));
result.put("downloadData", data);
result.put("dataNames", getDownloadDataNames());
return result;
};
/** . public abstract List<String> getDownloadDataNames();
* @param formatFile
* @return
*/
public String newFileFromFormatFile(Print print) {
try {
InputStream baseFormatIS = new ClassPathResource(this.getBaseFormatFilePath()).getInputStream(); public String pathForNewFile(int fileIndex) {
HWPFile baseFormatFile = HWPReader.fromInputStream(baseFormatIS); try {
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String currentTime = ymdhmsFormat.format(new Date()); String currentTime = ymdhmsFormat.format(new Date());
@ -116,12 +106,8 @@ public abstract class HWPFormat {
if(!formatFileResultFolder.exists()) { if(!formatFileResultFolder.exists()) {
formatFileResultFolder.mkdirs(); formatFileResultFolder.mkdirs();
} }
String resultHwpPath = formatFileResultFolderPath String resultHwpPath = formatFileResultFolderPath + File.separator + currentTime +"_"+fileIndex+ ".hwp";
+ File.separator + currentTime + "_" + (print.getFileNameIndex()) + ".hwp";
print.setFileNameIndex(print.getFileNameIndex()+1);
HWPWriter.toFile(baseFormatFile, resultHwpPath);
return resultHwpPath; return resultHwpPath;
} catch (Exception e){ } catch (Exception e){
@ -130,28 +116,4 @@ public abstract class HWPFormat {
} }
/** .
* @param hwpPrintUtil
* @return
*/
public abstract void setting(Print print);
public abstract void setting(Print print, int cnt);
/**
* @param
* @return
*/
public abstract void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList,
PrintOption printOption, Print print);
/**
* @param
* @return
*/
public abstract void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile, DataObject dataObject,
Print print);
public abstract List<String> getDownloadDataNames();
} }

@ -3,10 +3,10 @@ package cokr.xit.fims.cmmn.hwp.format;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.mngt.FactionUtil; import cokr.xit.fims.mngt.FactionUtil;
import cokr.xit.foundation.data.DataFormat; import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
@ -17,6 +17,15 @@ import kr.dogfoot.hwplib.object.HWPFile;
*/ */
public class RcvmtConfirm extends HWPFormat { public class RcvmtConfirm extends HWPFormat {
public RcvmtConfirm(PrintOption printOption, Print print, List<DataObject> dataObjectList) {
super(printOption, print, dataObjectList);
this.maxRunCount = dataObjectList.size();
this.formatFilePath = "template/hwp/rcvmtConfirm.hwp";
print.setFormatKorName("납부확인서");
print.setFormatName("rcvmtConfirm");
}
@Override @Override
public List<String> getDownloadDataNames() { public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
@ -35,65 +44,45 @@ public class RcvmtConfirm extends HWPFormat {
return list; return list;
} }
@Override
public void setting(Print print) {
print.setFormatName("rcvmtConfirm");
print.setFormatKorName("납부확인서");
this.setFormatType("info");
this.setRecordPerPartFile(1);
this.setBaseFormatFilePath("template/hwp/rcvmtConfirm.hwp");
this.setAttachFormatFilePath("");
}
@Override @Override
public void setting(Print print, int recordCnt) { public void runAsWriter() {
print.setFormatName("rcvmtConfirm"); HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
print.setFormatKorName("납부확인서"); this.writer = new HWPWriter(hwpFile);
this.setFormatType("info"); String instNm = FactionUtil.getInstituteLeader((String) print.getPrintRequestUserInfo().getInfo().get("instNm"), false);
this.setRecordPerPartFile(recordCnt);
this.setBaseFormatFilePath("template/hwp/rcvmtConfirm.hwp");
this.setAttachFormatFilePath("");
}
DataObject one = data.get(currentRunCount);
DataObject newObj = (DataObject) new DataObject()
.set("위반명1", one.string("TASK_SE_NM"))
.set("위반명2", one.string("TASK_SE_NM"))
.set("위반차량", one.string("VHRNO"))
.set("대체차량", one.string("RPM_SZR_VHRNO"))
.set("위반금액", CmmnUtil.addCommaToNumber(one.string("FFNLG_AMT")))
.set("단속일자", DataFormat.yyyy_mm_dd(one.string("CRDN_YMD")))
.set("단속장소", one.string("CRDN_PLC"))
.set("소유자", one.string("RTPYR_NM"))
//.set("주민번호", one.string("RTPYR_NO"))
.set("주소", one.string("RTPYR_FULL_ADDR"))
.set("고지번호", one.string("GOJI_NO"))
.set("수납일자", DataFormat.yyyy_mm_dd(one.string("RCVMT_YMD")))
.set("수납금액", CmmnUtil.addCommaToNumber(one.string("RCVMT_AMT")))
.set("연월일시분초", CmmnUtil.yyyy_mm_dd_hh_mm_ss(print.getPrintRequestDt()))
.set("확인자", print.getPrintRequestUserInfo().getName())
.set("발신", instNm)
;
@Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption,
Print print) {
}
writer.table(0, 0, 12).setValues(List.of(newObj));
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile, String tempPath = this.pathForNewFile(currentRunCount+1);
DataObject dataObject, Print print) { writer.write(tempPath);
resultFilesPath.add(tempPath);
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
baseFileEditor.set("위반명1", dataObject.string("TASK_SE_NM"));
baseFileEditor.set("위반명2", dataObject.string("TASK_SE_NM"));
baseFileEditor.set("위반차량", dataObject.string("VHRNO"));
baseFileEditor.set("대체차량", dataObject.string("RPM_SZR_VHRNO"));
baseFileEditor.set("위반금액", CmmnUtil.addCommaToNumber(dataObject.string("FFNLG_AMT")));
baseFileEditor.set("단속일자", DataFormat.yyyy_mm_dd(dataObject.string("CRDN_YMD")));
baseFileEditor.set("단속장소", dataObject.string("CRDN_PLC"));
baseFileEditor.set("소유자", dataObject.string("RTPYR_NM"));
baseFileEditor.set("주민번호", dataObject.string("RTPYR_NO"));
baseFileEditor.set("주소", dataObject.string("RTPYR_FULL_ADDR"));
baseFileEditor.set("고지번호", dataObject.string("GOJI_NO"));
baseFileEditor.set("수납일자", DataFormat.yyyy_mm_dd(dataObject.string("RCVMT_YMD")));
baseFileEditor.set("수납금액", CmmnUtil.addCommaToNumber(dataObject.string("RCVMT_AMT")));
baseFileEditor.set("연월일시분초", CmmnUtil.yyyy_mm_dd_hh_mm_ss(print.getPrintRequestDt()));
baseFileEditor.set("확인자", print.getPrintRequestUserInfo().getName());
String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
} }
} }

@ -1,26 +1,39 @@
package cokr.xit.fims.cmmn.hwp.format; package cokr.xit.fims.cmmn.hwp.format;
import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.BiConsumer;
import java.util.stream.IntStream;
import org.egovframe.rte.fdl.string.EgovStringUtil; import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor; import cokr.xit.fims.cmmn.hwp.OffcsCellFinder;
import cokr.xit.fims.cmmn.hwp.InsertingImageCell;
import cokr.xit.fims.mngt.FactionUtil; import cokr.xit.fims.mngt.FactionUtil;
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; import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.object.bodytext.control.table.Cell;
import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph;
/** /**
* *
*/ */
public class ReportOnClaims extends HWPFormat { public class ReportOnClaims extends HWPFormat {
public ReportOnClaims(PrintOption printOption, Print print, List<DataObject> dataObjectList) {
super(printOption, print, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/reportOnClaims.hwp";
this.print.setFormatKorName("채권신고서");
this.print.setFormatName("reportOnClaims");
}
@Override @Override
public List<String> getDownloadDataNames() { public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
@ -33,92 +46,74 @@ public class ReportOnClaims extends HWPFormat {
return list; return list;
} }
@Override
public void setting(Print print) {
print.setFormatName("reportOnClaims");
print.setFormatKorName("채권신고서");
this.setFormatType("list");
this.setRecordPerPartFile(7);
this.setBaseFormatFilePath("template/hwp/reportOnClaims_root.hwp");
this.setAttachFormatFilePath("template/hwp/reportOnClaims_inner.hwp");
}
@Override
public void setting(Print print, int recordCnt) {
print.setFormatName("reportOnClaims");
print.setFormatKorName("채권신고서");
this.setFormatType("list");
this.setRecordPerPartFile(recordCnt);
this.setBaseFormatFilePath("template/hwp/reportOnClaims_root.hwp");
this.setAttachFormatFilePath("template/hwp/reportOnClaims_inner.hwp");
}
@Override @Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption, public void runAsWriter() {
Print print) { HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile);
Map<String,String> globalVariable = printOption.getGlobalVariable();
Map<String,String> globalVariable = print.getGlobalVariable(printOption); String offcsFilePath = EgovStringUtil.null2void(globalVariable.get("offcsFilePath"));
if(!offcsFilePath.equals("")) {
BiConsumer<Paragraph, Rectangle> bc = writer.image().add(offcsFilePath);
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile); Cell cell = OffcsCellFinder.find(writer);
if(cell != null) {
Paragraph para = cell.getParagraphList().getParagraph(0);
int width = (int)cell.getListHeader().getWidth(),
height = (int)cell.getListHeader().getHeight();
bc.accept(para, new Rectangle(1, 1, width, height));
}
baseFileEditor.set("주소", globalVariable.get("deptAddr")); }
baseFileEditor.set("전화", globalVariable.get("deptTelno"));
baseFileEditor.set("팩스", globalVariable.get("deptFxno"));
baseFileEditor.set("담당자", print.getPrintRequestUserInfo().getName());
baseFileEditor.set("사건번호", EgovStringUtil.null2void(globalVariable.get("caseNo")));
baseFileEditor.set("체납자성명", EgovStringUtil.null2void(globalVariable.get("rtpyrNm")));
baseFileEditor.set("체납자번호", EgovStringUtil.null2void(globalVariable.get("rtpyrNo")));
baseFileEditor.set("체납자주소", EgovStringUtil.null2void(globalVariable.get("rtpyrFullAddr")));
int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();
baseFileEditor.set("채권청구액", CmmnUtil.addCommaToNumber(sumOfList)); writer.setValue("주소", globalVariable.get("deptAddr"));
baseFileEditor.set("합계금액", CmmnUtil.addCommaToNumber(sumOfList)); writer.setValue("전화", globalVariable.get("deptTelno"));
baseFileEditor.set("합계금액한글", CmmnUtil.convertNumberToHangul(sumOfList)); writer.setValue("팩스", globalVariable.get("deptFxno"));
writer.setValue("담당자", print.getPrintRequestUserInfo().getName());
writer.setValue("사건번호", EgovStringUtil.null2void(globalVariable.get("caseNo")));
writer.setValue("체납자성명", EgovStringUtil.null2void(globalVariable.get("rtpyrNm")));
writer.setValue("체납자번호", EgovStringUtil.null2void(globalVariable.get("rtpyrNo")));
writer.setValue("체납자주소", EgovStringUtil.null2void(globalVariable.get("rtpyrFullAddr")));
int sumOfList = data.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();
writer.setValue("채권청구액", CmmnUtil.addCommaToNumber(sumOfList));
writer.setValue("합계금액", CmmnUtil.addCommaToNumber(sumOfList));
writer.setValue("합계금액한글", CmmnUtil.convertNumberToHangul(sumOfList));
String printRequestYmd = print.getPrintRequestDt().substring(0, 8); String printRequestYmd = print.getPrintRequestDt().substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4); String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6); String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8); String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일"; String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
baseFileEditor.set("연월일", ymd); writer.setValue("연월일", ymd);
String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm"); String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = FactionUtil.getLastWord(instNm); instNm = FactionUtil.getLastWord(instNm);
instNm = FactionUtil.getInstituteLeader(instNm, false); instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm); writer.setValue("발신", instNm);
try { List<DataObject> list = IntStream.rangeClosed(1, this.data.size()).boxed().map(i -> {
InsertingImageCell.IMPL_InsertPicture(baseFile, "직인", globalVariable.get("offcsFilePath")); DataObject one = data.get(i-1);
} catch (Exception e) { DataObject newObj = (DataObject) new DataObject()
.set("년도", one.string("FYR"))
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다."); .set("과세번호", one.string("GOJI_NO"))
} .set("법정기일", DataFormat.yyyy_mm_dd(one.string("DUDT_YMD")))
.set("세목", one.string("TXITM_NM"))
.set("세액", CmmnUtil.addCommaToNumber(one.string("LEVY_PCPTAX")))
.set("가산금", CmmnUtil.addCommaToNumber(one.string("LEVY_ADAMT")))
.set("합계", CmmnUtil.addCommaToNumber(one.string("SUM_AMT")));
return newObj;
}).toList();
writer.table(0, 9, 2).setValues(list);
String tempPath = this.pathForNewFile(currentRunCount+1);
writer.write(tempPath);
resultFilesPath.add(tempPath);
} }
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile,
DataObject dataObject, Print print) {
ClickHereEditor attachFileEditor = new ClickHereEditor(attachFile);
attachFileEditor.set("년도", dataObject.string("FYR"));
attachFileEditor.set("과세번호", dataObject.string("GOJI_NO"));
attachFileEditor.set("법정기일", DataFormat.yyyy_mm_dd(dataObject.string("DUDT_YMD")));
attachFileEditor.set("세목", dataObject.string("TXITM_NM"));
attachFileEditor.set("세액", CmmnUtil.addCommaToNumber(dataObject.string("LEVY_PCPTAX")));
attachFileEditor.set("가산금", CmmnUtil.addCommaToNumber(dataObject.string("LEVY_ADAMT")));
attachFileEditor.set("합계", CmmnUtil.addCommaToNumber(dataObject.string("SUM_AMT")));
}
} }

@ -1,26 +1,39 @@
package cokr.xit.fims.cmmn.hwp.format; package cokr.xit.fims.cmmn.hwp.format;
import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.BiConsumer;
import java.util.stream.IntStream;
import org.egovframe.rte.fdl.string.EgovStringUtil; import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor; import cokr.xit.fims.cmmn.hwp.OffcsCellFinder;
import cokr.xit.fims.cmmn.hwp.InsertingImageCell;
import cokr.xit.fims.mngt.FactionUtil; import cokr.xit.fims.mngt.FactionUtil;
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; import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.object.bodytext.control.table.Cell;
import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph;
/** /**
* *
*/ */
public class RequestForDelivery extends HWPFormat { public class RequestForDelivery extends HWPFormat {
public RequestForDelivery(PrintOption printOption, Print print, List<DataObject> dataObjectList) {
super(printOption, print, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/requestForDelivery.hwp";
this.print.setFormatKorName("교부청구서");
this.print.setFormatName("requestForDelivery");
}
@Override @Override
public List<String> getDownloadDataNames() { public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
@ -31,90 +44,79 @@ public class RequestForDelivery extends HWPFormat {
return list; return list;
} }
@Override
public void setting(Print print) {
print.setFormatName("requestForDelivery");
print.setFormatKorName("교부청구서");
this.setFormatType("list");
this.setRecordPerPartFile(7);
this.setBaseFormatFilePath("template/hwp/requestForDelivery_root.hwp");
this.setAttachFormatFilePath("template/hwp/requestForDelivery_inner.hwp");
}
@Override @Override
public void setting(Print print, int recordCnt) { public void runAsWriter() {
print.setFormatName("requestForDelivery"); HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
print.setFormatKorName("교부청구서"); this.writer = new HWPWriter(hwpFile);
this.setFormatType("list");
this.setRecordPerPartFile(recordCnt);
this.setBaseFormatFilePath("template/hwp/requestForDelivery_root.hwp");
this.setAttachFormatFilePath("template/hwp/requestForDelivery_inner.hwp");
}
Map<String,String> globalVariable = printOption.getGlobalVariable();
@Override String offcsFilePath = EgovStringUtil.null2void(globalVariable.get("offcsFilePath"));
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, if(!offcsFilePath.equals("")) {
PrintOption printOption, Print print) { BiConsumer<Paragraph, Rectangle> bc = writer.image().add(offcsFilePath);
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
Map<String,String> globalVariable = print.getGlobalVariable(printOption); Cell cell = OffcsCellFinder.find(writer);
if(cell != null) {
Paragraph para = cell.getParagraphList().getParagraph(0);
int width = (int)cell.getListHeader().getWidth(),
height = (int)cell.getListHeader().getHeight();
bc.accept(para, new Rectangle(1, 1, width, height));
}
baseFileEditor.set("문서번호", EgovStringUtil.null2void(globalVariable.get("docNo"))); }
baseFileEditor.set("사건번호", EgovStringUtil.null2void(globalVariable.get("caseNo")));
baseFileEditor.set("수신", EgovStringUtil.null2void(globalVariable.get("receiver")));
baseFileEditor.set("체납자성명", EgovStringUtil.null2void(globalVariable.get("rtpyrNm")));
baseFileEditor.set("체납자번호", EgovStringUtil.null2void(globalVariable.get("rtpyrNo")));
baseFileEditor.set("차량번호", EgovStringUtil.null2void(globalVariable.get("vhrno")));
baseFileEditor.set("주소", EgovStringUtil.null2void(globalVariable.get("rtpyrFullAddr")));
int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();
baseFileEditor.set("합계금액", CmmnUtil.addCommaToNumber(sumOfList)); writer.setValue("문서번호", EgovStringUtil.null2void(globalVariable.get("docNo")));
baseFileEditor.set("교부청구금액", CmmnUtil.addCommaToNumber(sumOfList)); writer.setValue("사건번호", EgovStringUtil.null2void(globalVariable.get("caseNo")));
baseFileEditor.set("교부청구금액한글", CmmnUtil.convertNumberToHangul(sumOfList)); writer.setValue("수신", EgovStringUtil.null2void(globalVariable.get("receiver")));
writer.setValue("체납자성명", EgovStringUtil.null2void(globalVariable.get("rtpyrNm")));
writer.setValue("체납자번호", EgovStringUtil.null2void(globalVariable.get("rtpyrNo")));
writer.setValue("차량번호", EgovStringUtil.null2void(globalVariable.get("vhrno")));
writer.setValue("주소", EgovStringUtil.null2void(globalVariable.get("rtpyrFullAddr")));
baseFileEditor.set("개설은행", globalVariable.get("dtbnBankNm")); int sumOfList = data.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();
baseFileEditor.set("계좌번호", globalVariable.get("dtbnActno")); writer.setValue("합계금액", CmmnUtil.addCommaToNumber(sumOfList));
writer.setValue("교부청구금액", CmmnUtil.addCommaToNumber(sumOfList));
writer.setValue("교부청구금액한글", CmmnUtil.convertNumberToHangul(sumOfList));
writer.setValue("개설은행", EgovStringUtil.null2void(globalVariable.get("dtbnBankNm")));
writer.setValue("계좌번호", EgovStringUtil.null2void(globalVariable.get("dtbnActno")));
String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm"); String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm");
String deptNm = (String) print.getPrintRequestUserInfo().getInfo().get("deptNm"); String deptNm = (String) print.getPrintRequestUserInfo().getInfo().get("deptNm");
baseFileEditor.set("예금주", instNm + " " + deptNm); writer.setValue("예금주", instNm + " " + deptNm);
String printRequestYmd = print.getPrintRequestDt().substring(0, 8); String printRequestYmd = print.getPrintRequestDt().substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4); String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6); String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8); String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일"; String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
baseFileEditor.set("연월일", ymd); writer.setValue("연월일", ymd);
instNm = FactionUtil.getLastWord(instNm); instNm = FactionUtil.getLastWord(instNm);
instNm = FactionUtil.getInstituteLeader(instNm, false); instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm); writer.setValue("발신", instNm);
List<DataObject> list = IntStream.rangeClosed(1, this.data.size()).boxed().map(i -> {
DataObject one = data.get(i-1);
DataObject newObj = (DataObject) new DataObject()
.set("징수과목", one.string("TXITM_NM"))
.set("고지번호", one.string("GOJI_NO"))
.set("과태료계", CmmnUtil.addCommaToNumber(one.string("SUM_AMT")))
.set("법정기일", DataFormat.yyyy_mm_dd(one.string("DUDT_YMD")))
;
return newObj;
}).toList();
writer.table(0, 9, 1).setValues(list);
String tempPath = this.pathForNewFile(currentRunCount+1);
writer.write(tempPath);
resultFilesPath.add(tempPath);
try {
InsertingImageCell.IMPL_InsertPicture(baseFile, "직인", globalVariable.get("offcsFilePath"));
} catch (Exception e) {
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
} }
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile,
DataObject dataObject, Print print) {
ClickHereEditor attachFileEditor = new ClickHereEditor(attachFile);
attachFileEditor.set("징수과목", dataObject.string("TXITM_NM"));
attachFileEditor.set("고지번호", dataObject.string("GOJI_NO"));
attachFileEditor.set("과태료계", CmmnUtil.addCommaToNumber(dataObject.string("SUM_AMT")));
attachFileEditor.set("법정기일", DataFormat.yyyy_mm_dd(dataObject.string("DUDT_YMD")));
}
} }

@ -1,17 +1,32 @@
package cokr.xit.fims.cmmn.hwp.format; package cokr.xit.fims.cmmn.hwp.format;
import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.BiConsumer;
import java.util.stream.IntStream;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor; import cokr.xit.fims.cmmn.hwp.OffcsCellFinder;
import cokr.xit.fims.cmmn.hwp.InsertingImageCell;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile; import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.object.bodytext.control.table.Cell;
import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph;
public class SvbtcList extends HWPFormat { public class SvbtcList extends HWPFormat {
public SvbtcList(PrintOption printOption, Print print, List<DataObject> dataObjectList) {
super(printOption, print, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/svbtcList.hwp";
this.print.setFormatKorName("공시송달");
this.print.setFormatName("svbtc");
}
@Override @Override
public List<String> getDownloadDataNames() { public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
@ -25,67 +40,52 @@ public class SvbtcList extends HWPFormat {
return list; return list;
} }
@Override
public void setting(Print print) {
print.setFormatName("svbtc");
print.setFormatKorName("공시송달");
this.setFormatType("list");
this.setRecordPerPartFile(9);
this.setBaseFormatFilePath("template/hwp/svbtcList_root.hwp");
this.setAttachFormatFilePath("template/hwp/svbtcList_inner.hwp");
}
@Override
public void setting(Print print, int recordCnt) {
print.setFormatName("svbtc");
print.setFormatKorName("공시송달");
this.setFormatType("list");
this.setRecordPerPartFile(recordCnt);
this.setBaseFormatFilePath("template/hwp/svbtcList_root.hwp");
this.setAttachFormatFilePath("template/hwp/svbtcList_inner.hwp");
}
@Override @Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption, Print print) { public void runAsWriter() {
// HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile); this.writer = new HWPWriter(hwpFile);
baseFileEditor.set("문서번호", dataObjectList.get(0).string("INPUT_DOC_NO")); String offcsFilePath = EgovStringUtil.null2void(data.get(0).string("OFFCS_FILE_PATH"));
baseFileEditor.set("제목", dataObjectList.get(0).string("INPUT_TTL_NM")); if(!offcsFilePath.equals("")) {
baseFileEditor.set("공고기간", dataObjectList.get(0).string("INPUT_SVBTC_DATE")); BiConsumer<Paragraph, Rectangle> bc = writer.image().add(offcsFilePath);
baseFileEditor.set("기관장", dataObjectList.get(0).string("INST_LEADER"));
baseFileEditor.set("부서명", dataObjectList.get(0).string("SGG_DEPT_NM")); Cell cell = OffcsCellFinder.find(writer);
baseFileEditor.set("부서전화번호", "☎" + dataObjectList.get(0).string("DEPT_TELNO")); if(cell != null) {
Paragraph para = cell.getParagraphList().getParagraph(0);
try { int width = (int)cell.getListHeader().getWidth(),
if (!dataObjectList.get(0).string("OFFCS_FILE_PATH").equals("")) { height = (int)cell.getListHeader().getHeight();
InsertingImageCell.IMPL_InsertPicture(baseFile, "직인", dataObjectList.get(0).string("OFFCS_FILE_PATH")); bc.accept(para, new Rectangle(1, 1, width, height));
} }
} catch(Exception e) {
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
} }
writer.setValue("문서번호", data.get(0).string("INPUT_DOC_NO"));
writer.setValue("제목", data.get(0).string("INPUT_TTL_NM"));
writer.setValue("공고기간", data.get(0).string("INPUT_SVBTC_DATE"));
writer.setValue("기관장", data.get(0).string("INST_LEADER"));
writer.setValue("부서명", data.get(0).string("SGG_DEPT_NM"));
writer.setValue("부서전화번호", "☎" + data.get(0).string("DEPT_TELNO"));
List<DataObject> list = IntStream.rangeClosed(1, this.data.size()).boxed().map(i -> {
DataObject one = data.get(i-1);
return (DataObject) new DataObject()
.set("성명", one.string("RCPN_NM_MASK"))
.set("주소", one.string("WHOL_ADDR_MASK"))
.set("차량번호", one.string("VHRNO_MASK"))
.set("위반장소", one.string("CRDN_PLC"))
.set("위반일자", one.string("CRDN_DT"))
.set("반송일자", one.string("DLVR_YMD_MASK"))
.set("반송사유", one.string("UNDLVR_RSN_NM"))
;
}).toList();
writer.table(2, 2, 2).setValues(list);
String tempPath = this.pathForNewFile(currentRunCount+1);
writer.write(tempPath);
resultFilesPath.add(tempPath);
} }
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile, DataObject dataObject, Print print) {
//
ClickHereEditor attachFileEditor = new ClickHereEditor(attachFile);
attachFileEditor.set("성명", dataObject.string("RCPN_NM_MASK"));
attachFileEditor.set("주소", dataObject.string("WHOL_ADDR_MASK"));
attachFileEditor.set("차량번호", dataObject.string("VHRNO_MASK"));
attachFileEditor.set("위반장소", dataObject.string("CRDN_PLC"));
attachFileEditor.set("위반일자", dataObject.string("CRDN_DT"));
attachFileEditor.set("반송일자", dataObject.string("DLVR_YMD_MASK"));
attachFileEditor.set("반송사유", dataObject.string("UNDLVR_RSN_NM"));
}
} }

@ -1,4 +1,4 @@
package cokr.xit.fims.cmmn; package cokr.xit.fims.cmmn.xls;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;

@ -21,9 +21,9 @@ import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.web.ApplicationController; import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.cmmn.CellDecorator;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.cmmn.service.bean.StngBean;
import cokr.xit.fims.cmmn.xls.CellDecorator;
import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.dao.CrdnStngMapper; import cokr.xit.fims.crdn.dao.CrdnStngMapper;

@ -17,7 +17,6 @@ import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode; import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.hwp.HWPWriter;
import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.base.file.xls.XLSWriter; import cokr.xit.base.file.xls.XLSWriter;
@ -224,10 +223,20 @@ public class Cvlc01Controller extends ApplicationController {
@Task @Task
@RequestMapping(name="민원내역 원본 한글 파일 생성", value=METHOD_URL.makeFileFromHwpFormat) @RequestMapping(name="민원내역 원본 한글 파일 생성", value=METHOD_URL.makeFileFromHwpFormat)
public ModelAndView makeFileFromHwpFormat(CrdnQuery query) { public ModelAndView makeFileFromHwpFormat(CrdnQuery query) {
ModelAndView mav = new ModelAndView("downloadView");
PrintOption printOption = new PrintOption();
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
Print print = new Print();
print.setPrintRequestUserInfo(userInfo);
DataObject dataObject = crdnCvlcptMainBean.getCivilComplaintOriginalInfo(query); DataObject dataObject = crdnCvlcptMainBean.getCivilComplaintOriginalInfo(query);
List<DataObject> dataObjectList = new ArrayList<DataObject>(); List<DataObject> dataObjectList = new ArrayList<DataObject>();
dataObjectList.add(dataObject); dataObjectList.add(dataObject);
String linkTblNm = dataObject.string("LINK_TBL_NM"); String linkTblNm = dataObject.string("LINK_TBL_NM");
if(!(ifEmpty(linkTblNm, () -> "").equals(""))) { if(!(ifEmpty(linkTblNm, () -> "").equals(""))) {
FileQuery fileQuery = new FileQuery(); FileQuery fileQuery = new FileQuery();
@ -259,20 +268,11 @@ public class Cvlc01Controller extends ApplicationController {
} }
} }
CvlcptOrgn hwpFormat = new CvlcptOrgn(printOption, print, dataObjectList);
HashMap<String, Object> result = hwpFormat.makeFile();
HWPWriter hwpWriter = new HWPWriter(); ModelAndView mav = new ModelAndView("downloadView");
PrintOption printOption = new PrintOption();
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
Print print = new Print();
print.setPrintRequestUserInfo(userInfo);
hwpWriter.setPrint(print);
hwpWriter.setFormat(new CvlcptOrgn());
Map<String, Object> result = hwpWriter.makeFileFromHwpFormat("info", printOption, dataObjectList);
mav.addAllObjects(result); mav.addAllObjects(result);
mav.addObject("downloadData", dataObjectList);
mav.addObject("dataNames", hwpWriter.getFormat().getDownloadDataNames());
return mav; return mav;
} }

@ -22,9 +22,9 @@ import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.web.ApplicationController; import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.cmmn.CellDecorator;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.cmmn.service.bean.StngBean;
import cokr.xit.fims.cmmn.xls.CellDecorator;
import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.service.CrdnService; import cokr.xit.fims.crdn.service.CrdnService;

@ -16,7 +16,6 @@ import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.CommonCode; import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.FileInfo;
import cokr.xit.base.file.hwp.HWPWriter;
import cokr.xit.base.file.service.FileService; import cokr.xit.base.file.service.FileService;
import cokr.xit.base.file.web.FileInfoFactory; import cokr.xit.base.file.web.FileInfoFactory;
import cokr.xit.base.file.xls.XLSWriter; import cokr.xit.base.file.xls.XLSWriter;
@ -371,22 +370,20 @@ public class Excl02Controller extends ApplicationController {
@RequestMapping(name="의견제출 심의의결서 출력", value=METHOD_URL.makeDlbrDecsnFileFromHwpFormat) @RequestMapping(name="의견제출 심의의결서 출력", value=METHOD_URL.makeDlbrDecsnFileFromHwpFormat)
public ModelAndView makeDlbrDecsnFileFromHwpFormat(LevyExclQuery req) { public ModelAndView makeDlbrDecsnFileFromHwpFormat(LevyExclQuery req) {
HWPWriter hwpWriter = new HWPWriter();
PrintOption printOption = new PrintOption();
UserInfo userInfo = currentUser(); UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo); factionBean.initUserInfo(userInfo);
Print print = new Print(); Print print = new Print();
print.setPrintRequestUserInfo(userInfo); print.setPrintRequestUserInfo(userInfo);
hwpWriter.setPrint(print);
hwpWriter.setFormat(new DlbrDecsnList()); PrintOption printOption = new PrintOption();
List<DataObject> dataObjectList = opnnSbmsnBean.getOpnnSbmsnDlbrDecsns(req); List<DataObject> dataObjectList = opnnSbmsnBean.getOpnnSbmsnDlbrDecsns(req);
Map<String,Object> result = hwpWriter.makeFileFromHwpFormat("info", printOption, dataObjectList);
ModelAndView mav = new ModelAndView("downloadView");
DlbrDecsnList hwpFormat = new DlbrDecsnList(printOption, print, dataObjectList);
HashMap<String, Object> result = hwpFormat.makeFile();
ModelAndView mav = new ModelAndView("downloadView");
mav.addAllObjects(result); mav.addAllObjects(result);
mav.addObject("downloadData", dataObjectList);
mav.addObject("dataNames", hwpWriter.getFormat().getDownloadDataNames());
return mav; return mav;
} }

@ -15,7 +15,6 @@ import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.CommonCode; import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.etc.OutsourcingFileWriter; import cokr.xit.base.file.etc.OutsourcingFileWriter;
import cokr.xit.base.file.hwp.HWPWriter;
import cokr.xit.base.file.pdf.PDFWriter; import cokr.xit.base.file.pdf.PDFWriter;
import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.file.service.bean.FileBean;
@ -31,6 +30,7 @@ import cokr.xit.fims.cmmn.OutsourcingStngQuery;
import cokr.xit.fims.cmmn.Print; import cokr.xit.fims.cmmn.Print;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
import cokr.xit.fims.cmmn.dao.OtptStngMapper; import cokr.xit.fims.cmmn.dao.OtptStngMapper;
import cokr.xit.fims.cmmn.hwp.format.SvbtcList;
import cokr.xit.fims.cmmn.pdf.print.format.Advntce; import cokr.xit.fims.cmmn.pdf.print.format.Advntce;
import cokr.xit.fims.cmmn.service.bean.OutsourcingStngBean; import cokr.xit.fims.cmmn.service.bean.OutsourcingStngBean;
import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.cmmn.service.bean.StngBean;
@ -1563,30 +1563,24 @@ public class Sndb01Controller extends ApplicationController {
@Task @Task
@RequestMapping(name="공시송달 한글 저장", value=METHOD_URL.makeSvbtcFileFromHwpFormat) @RequestMapping(name="공시송달 한글 저장", value=METHOD_URL.makeSvbtcFileFromHwpFormat)
public ModelAndView makeSvbtcFileFromHwpFormat(SndbQuery req) { public ModelAndView makeSvbtcFileFromHwpFormat(SndbQuery req) {
Map<String,Object> result = null;
HWPWriter hwpWriter = new HWPWriter();
PrintOption printOption = new PrintOption();
UserInfo userInfo = currentUser(); UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo); factionBean.initUserInfo(userInfo);
Print print = new Print();
print.setPrintRequestUserInfo(userInfo);
PrintOption printOption = new PrintOption();
req.setSggCd((String)userInfo.getInfo().get("sggCd")); req.setSggCd((String)userInfo.getInfo().get("sggCd"));
req.setDeptCd((String)userInfo.getInfo().get("deptCd")); req.setDeptCd((String)userInfo.getInfo().get("deptCd"));
req.setOrderBy("SV.SVBTC_ID, SD.SNDNG_DTL_ID"); req.setOrderBy("SV.SVBTC_ID, SD.SNDNG_DTL_ID");
List<DataObject> dataObjectList = svbtcBean.getSvbtcPrint(req); List<DataObject> dataObjectList = svbtcBean.getSvbtcPrint(req);
Print print = new Print(); SvbtcList hwpFormat = new SvbtcList(printOption, print, dataObjectList);
print.setPrintRequestUserInfo(userInfo); HashMap<String, Object> result = hwpFormat.makeFile();
hwpWriter.setPrint(print); ModelAndView mav = new ModelAndView("downloadView");
result = hwpWriter.makeFileFromHwpFormat("list", printOption, dataObjectList);
ModelAndView mav = new ModelAndView("jsonView");
mav.addAllObjects(result); mav.addAllObjects(result);
mav.addObject("downloadData", dataObjectList);
mav.addObject("dataNames", hwpWriter.getFormat().getDownloadDataNames());
return mav; return mav;
} }

@ -20,7 +20,6 @@ import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode; import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.etc.OutsourcingFileWriter; import cokr.xit.base.file.etc.OutsourcingFileWriter;
import cokr.xit.base.file.hwp.HWPWriter;
import cokr.xit.base.file.pdf.PDFWriter; import cokr.xit.base.file.pdf.PDFWriter;
import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.file.service.bean.FileBean;
@ -460,26 +459,24 @@ public class Sprt01Controller extends ApplicationController {
*/ */
@RequestMapping(name="단속 내역서 한글 파일 생성", value=METHOD_URL.makeCrdnListFileFromHwpFormat) @RequestMapping(name="단속 내역서 한글 파일 생성", value=METHOD_URL.makeCrdnListFileFromHwpFormat)
public ModelAndView makeCrdnListFileFromHwpFormat(String privateInfoYn, String... crdnIds) { public ModelAndView makeCrdnListFileFromHwpFormat(String privateInfoYn, String... crdnIds) {
PrintOption printOption = new PrintOption(); PrintOption printOption = new PrintOption();
printOption.setPrivateInfoYn(privateInfoYn); printOption.setPrivateInfoYn(privateInfoYn);
CrdnQuery query = new CrdnQuery();
query.setCrdnIds(crdnIds);
List<DataObject> dataObjectList = crdnListMapper.selectCrackdownList(query);
HWPWriter hwpWriter = new HWPWriter();
UserInfo userInfo = currentUser(); UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo); factionBean.initUserInfo(userInfo);
Print print = new Print(); Print print = new Print();
print.setPrintRequestUserInfo(userInfo); print.setPrintRequestUserInfo(userInfo);
hwpWriter.setPrint(print);
hwpWriter.setFormat(new CrdnList()); CrdnQuery query = new CrdnQuery();
Map<String,Object> result = hwpWriter.makeFileFromHwpFormat("list", printOption, dataObjectList); query.setCrdnIds(crdnIds);
List<DataObject> dataObjectList = crdnListMapper.selectCrackdownList(query);
CrdnList hwpFormat = new CrdnList(printOption, print, dataObjectList);
HashMap<String, Object> result = hwpFormat.makeFile();
ModelAndView mav = new ModelAndView("downloadView"); ModelAndView mav = new ModelAndView("downloadView");
mav.addAllObjects(result); mav.addAllObjects(result);
mav.addObject("downloadData", dataObjectList);
mav.addObject("dataNames", hwpWriter.getFormat().getDownloadDataNames());
return mav; return mav;
} }
@ -491,6 +488,11 @@ public class Sprt01Controller extends ApplicationController {
PrintOption printOption = new PrintOption(); PrintOption printOption = new PrintOption();
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
Print print = new Print();
print.setPrintRequestUserInfo(userInfo);
CrdnQuery query = new CrdnQuery(); CrdnQuery query = new CrdnQuery();
query.setCrdnIds(crdnIds); query.setCrdnIds(crdnIds);
List<DataObject> dataObjectList = crdnListMapper.selectCrackdownList(query); List<DataObject> dataObjectList = crdnListMapper.selectCrackdownList(query);
@ -514,21 +516,13 @@ public class Sprt01Controller extends ApplicationController {
} }
} }
HWPWriter hwpWriter = new HWPWriter();
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
Print print = new Print();
print.setPrintRequestUserInfo(userInfo);
hwpWriter.setPrint(print);
hwpWriter.setFormat(new CrdnConfirm());
Map<String,Object> result = hwpWriter.makeFileFromHwpFormat("info", printOption, dataObjectList); CrdnConfirm hwpFormat = new CrdnConfirm(printOption, print, dataObjectList);
HashMap<String, Object> result = hwpFormat.makeFile();
ModelAndView mav = new ModelAndView("downloadView"); ModelAndView mav = new ModelAndView("downloadView");
mav.addAllObjects(result); mav.addAllObjects(result);
mav.addObject("downloadData", dataObjectList);
mav.addObject("dataNames", hwpWriter.getFormat().getDownloadDataNames());
return mav; return mav;
} }
@ -550,7 +544,9 @@ public class Sprt01Controller extends ApplicationController {
*/ */
@RequestMapping(name="교부청구서 한글 파일 생성", value=METHOD_URL.makeRequestForDeliveryFileFromHwpFormat) @RequestMapping(name="교부청구서 한글 파일 생성", value=METHOD_URL.makeRequestForDeliveryFileFromHwpFormat)
public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String... crdnIds) { public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String... crdnIds) {
ModelAndView mav = new ModelAndView("downloadView");
DataObject sggStngInfo = stngBean.getStng("sgg");
DataObject deptStngInfo = stngBean.getStng("dept");
Map<String, String> globalVariable = new HashMap<String,String>(); Map<String, String> globalVariable = new HashMap<String,String>();
@ -563,33 +559,26 @@ public class Sprt01Controller extends ApplicationController {
globalVariable.put("rtpyrNo", dataObject.string("rtpyrNo")); globalVariable.put("rtpyrNo", dataObject.string("rtpyrNo"));
globalVariable.put("vhrno", dataObject.string("vhrno")); globalVariable.put("vhrno", dataObject.string("vhrno"));
globalVariable.put("rtpyrFullAddr", dataObject.string("rtpyrFullAddr")); globalVariable.put("rtpyrFullAddr", dataObject.string("rtpyrFullAddr"));
globalVariable.put("dtbnBankNm", deptStngInfo.string("DTBN_BANK_NM"));
globalVariable.put("dtbnActno", deptStngInfo.string("DTBN_ACTNO"));
globalVariable.put("offcsFilePath", sggStngInfo.string("OFFCS_FILE_PATH"));
printOption.setGlobalVariable(globalVariable); printOption.setGlobalVariable(globalVariable);
SprtQuery sprtQuery = new SprtQuery();
sprtQuery.setCrdnIds(crdnIds);
List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery);
HWPWriter hwpWriter = new HWPWriter();
UserInfo userInfo = currentUser(); UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo); factionBean.initUserInfo(userInfo);
Print print = new Print(); Print print = new Print();
print.setPrintRequestUserInfo(userInfo); print.setPrintRequestUserInfo(userInfo);
hwpWriter.setPrint(print);
DataObject sggStngInfo = stngBean.getStng("sgg"); SprtQuery sprtQuery = new SprtQuery();
DataObject deptStngInfo = stngBean.getStng("dept"); sprtQuery.setCrdnIds(crdnIds);
Map<String, String> globalVariable2 = printOption.getGlobalVariable(); List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery);
globalVariable2.put("dtbnBankNm", deptStngInfo.string("DTBN_BANK_NM"));
globalVariable2.put("dtbnActno", deptStngInfo.string("DTBN_ACTNO"));
globalVariable2.put("offcsFilePath", sggStngInfo.string("OFFCS_FILE_PATH")); RequestForDelivery hwpFormat = new RequestForDelivery(printOption, print, dataObjectList);
printOption.setGlobalVariable(globalVariable2); HashMap<String, Object> result = hwpFormat.makeFile();
ModelAndView mav = new ModelAndView("downloadView");
hwpWriter.setFormat(new RequestForDelivery());
Map<String,Object> result = hwpWriter.makeFileFromHwpFormat("list", printOption, dataObjectList);
mav.addAllObjects(result); mav.addAllObjects(result);
mav.addObject("downloadData", dataObjectList);
mav.addObject("dataNames", hwpWriter.getFormat().getDownloadDataNames());
return mav; return mav;
} }
@ -598,11 +587,16 @@ public class Sprt01Controller extends ApplicationController {
*/ */
@RequestMapping(name="채권신고서 한글 파일 생성", value=METHOD_URL.makeReportOnClaimsFileFromHwpFormat) @RequestMapping(name="채권신고서 한글 파일 생성", value=METHOD_URL.makeReportOnClaimsFileFromHwpFormat)
public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String... crdnIds) { public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String... crdnIds) {
ModelAndView mav = new ModelAndView("downloadView"); DataObject sggStngInfo = stngBean.getStng("sgg");
DataObject deptStngInfo = stngBean.getStng("dept");
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
Print print = new Print();
print.setPrintRequestUserInfo(userInfo);
Map<String, String> globalVariable = new HashMap<String,String>(); Map<String, String> globalVariable = new HashMap<String,String>();
System.out.println(globalVariableInfo);
DataObject dataObject = fromJson(globalVariableInfo, DataObject.class); DataObject dataObject = fromJson(globalVariableInfo, DataObject.class);
globalVariable.put("caseNo", dataObject.string("caseNo")); globalVariable.put("caseNo", dataObject.string("caseNo"));
@ -610,6 +604,12 @@ public class Sprt01Controller extends ApplicationController {
globalVariable.put("rtpyrNo", dataObject.string("rtpyrNo")); globalVariable.put("rtpyrNo", dataObject.string("rtpyrNo"));
globalVariable.put("rtpyrFullAddr", dataObject.string("rtpyrFullAddr")); globalVariable.put("rtpyrFullAddr", dataObject.string("rtpyrFullAddr"));
String deptNm = (String) print.getPrintRequestUserInfo().getInfo().get("deptNm");
String deptAddr = sggStngInfo.string("INST_FULL_ADDR") + " " + deptNm;
globalVariable.put("deptAddr", deptAddr);
globalVariable.put("deptTelno", deptStngInfo.string("DEPT_TELNO"));
globalVariable.put("deptFxno", deptStngInfo.string("DEPT_FXNO"));
globalVariable.put("offcsFilePath", sggStngInfo.string("OFFCS_FILE_PATH"));
printOption.setGlobalVariable(globalVariable); printOption.setGlobalVariable(globalVariable);
SprtQuery sprtQuery = new SprtQuery(); SprtQuery sprtQuery = new SprtQuery();
@ -617,30 +617,10 @@ public class Sprt01Controller extends ApplicationController {
List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery);
HWPWriter hwpWriter = new HWPWriter(); ReportOnClaims hwpFormat = new ReportOnClaims(printOption, print, dataObjectList);
UserInfo userInfo = currentUser(); HashMap<String, Object> result = hwpFormat.makeFile();
factionBean.initUserInfo(userInfo); ModelAndView mav = new ModelAndView("downloadView");
Print print = new Print();
print.setPrintRequestUserInfo(userInfo);
hwpWriter.setPrint(print);
DataObject sggStngInfo = stngBean.getStng("sgg");
DataObject deptStngInfo = stngBean.getStng("dept");
Map<String, String> globalVariable2 = printOption.getGlobalVariable();
String deptNm = (String) print.getPrintRequestUserInfo().getInfo().get("deptNm");
String deptAddr = sggStngInfo.string("INST_FULL_ADDR") + " " + deptNm;
globalVariable2.put("deptAddr", deptAddr);
globalVariable2.put("deptTelno", deptStngInfo.string("DEPT_TELNO"));
globalVariable2.put("deptFxno", deptStngInfo.string("DEPT_FXNO"));
globalVariable2.put("offcsFilePath", sggStngInfo.string("OFFCS_FILE_PATH"));
printOption.setGlobalVariable(globalVariable2);
hwpWriter.setFormat(new ReportOnClaims());
Map<String,Object> result = hwpWriter.makeFileFromHwpFormat("list", printOption, dataObjectList);
mav.addAllObjects(result); mav.addAllObjects(result);
mav.addObject("downloadData", dataObjectList);
mav.addObject("dataNames", hwpWriter.getFormat().getDownloadDataNames());
return mav; return mav;
} }
@ -649,7 +629,11 @@ public class Sprt01Controller extends ApplicationController {
*/ */
@RequestMapping(name="납부확인서 한글 파일 생성", value=METHOD_URL.makeRcvmtConfirmFileFromHwpFormat) @RequestMapping(name="납부확인서 한글 파일 생성", value=METHOD_URL.makeRcvmtConfirmFileFromHwpFormat)
public ModelAndView makeRcvmtConfirmFileFromHwpFormat(String... crdnIds) { public ModelAndView makeRcvmtConfirmFileFromHwpFormat(String... crdnIds) {
ModelAndView mav = new ModelAndView("downloadView");
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
Print print = new Print();
print.setPrintRequestUserInfo(userInfo);
PrintOption printOption = new PrintOption(); PrintOption printOption = new PrintOption();
printOption.setGlobalVariable(new HashMap<String,String>()); printOption.setGlobalVariable(new HashMap<String,String>());
@ -658,18 +642,11 @@ public class Sprt01Controller extends ApplicationController {
sprtQuery.setCrdnIds(crdnIds); sprtQuery.setCrdnIds(crdnIds);
List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery);
HWPWriter hwpWriter = new HWPWriter(); RcvmtConfirm hwpFormat = new RcvmtConfirm(printOption, print, dataObjectList);
UserInfo userInfo = currentUser(); HashMap<String, Object> result = hwpFormat.makeFile();
factionBean.initUserInfo(userInfo); ModelAndView mav = new ModelAndView("downloadView");
Print print = new Print();
print.setPrintRequestUserInfo(userInfo);
hwpWriter.setPrint(print);
hwpWriter.setFormat(new RcvmtConfirm());
Map<String,Object> result = hwpWriter.makeFileFromHwpFormat("info", printOption, dataObjectList);
mav.addAllObjects(result); mav.addAllObjects(result);
mav.addObject("downloadData", dataObjectList);
mav.addObject("dataNames", hwpWriter.getFormat().getDownloadDataNames());
return mav; return mav;
} }

@ -447,22 +447,13 @@
params.printTtlNm = obj.ttlNm; // 제목 params.printTtlNm = obj.ttlNm; // 제목
params.printSvbtcDate = obj.textDate; // 공고 기한 params.printSvbtcDate = obj.textDate; // 공고 기한
ajax.get({
url : wctx.url("/" + params.taskSeCd + $P.PrefixUrl + "/240/makeSvbtcHwp.do")
, data : params || {}
, success : resp => {
if (resp.filePath != null && resp.filePath != "") {
let a = document.createElement("a");
a.href = resp.filePath; let url = wctx.url("/" + params.taskSeCd + $P.PrefixUrl + "/240/makeSvbtcHwp.do");
a.download = resp.fileName;
let parameter = toQuery(params);
document.location.href = url + "?" + parameter;
document.getElementById("tempArea--${pageName}").appendChild(a);
a.click();
document.getElementById("tempArea--${pageName}").removeChild(a);
}
}
});
} }
// 공시송달 수정 // 공시송달 수정

@ -337,6 +337,8 @@
// 한글파일 출력 // 한글파일 출력
$P.callbackDocNoTtl = (obj) => { $P.callbackDocNoTtl = (obj) => {
let selected = $P.control.dataset.getKeys("selected");
// 서버에 전송할 data(파라미터) 생성 // 서버에 전송할 data(파라미터) 생성
let params = { let params = {
sggCd : $P.control.dataset.getValue("SGG_CD") // 시군구 코드 sggCd : $P.control.dataset.getValue("SGG_CD") // 시군구 코드
@ -349,26 +351,19 @@
params.printTtlNm = obj.ttlNm; // 제목 params.printTtlNm = obj.ttlNm; // 제목
params.printSvbtcDate = obj.textDate; // 공고 기한 params.printSvbtcDate = obj.textDate; // 공고 기한
ajax.get({
url : wctx.url("/" + params.taskSeCd + $P.PrefixUrl + "/240/makeSvbtcHwp.do")
, data : params || {}
, success : resp => {
if (resp.filePath != null && resp.filePath != "") {
let a = document.createElement("a");
a.href = resp.filePath; let url = wctx.url("/" + params.taskSeCd + $P.PrefixUrl + "/240/makeSvbtcHwp.do");
a.download = resp.fileName;
let parameter = toQuery(params);
document.location.href = url + "?" + parameter;
document.getElementById("tempArea--${pageName}").appendChild(a);
a.click();
document.getElementById("tempArea--${pageName}").removeChild(a);
}
}
});
} }
// 삭제 사유 callback // 삭제 사유 callback
$P.callbackRsn = (obj) => { $P.callbackRsn = (obj) => {
let selected = $P.control.dataset.getKeys("selected");
// 서버에 전송할 data(파라미터) 생성 // 서버에 전송할 data(파라미터) 생성
let params = {}; let params = {};
params.sndngDtlIds = selected.join(","); // 발송 상세 IDs params.sndngDtlIds = selected.join(","); // 발송 상세 IDs

Loading…
Cancel
Save