|
|
@ -1,11 +1,11 @@
|
|
|
|
package cokr.xit.fims.sprt.service.bean;
|
|
|
|
package cokr.xit.fims.sprt.service.bean;
|
|
|
|
|
|
|
|
|
|
|
|
import java.awt.Color;
|
|
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
@ -14,6 +14,7 @@ import org.apache.pdfbox.pdmodel.PDPage;
|
|
|
|
import org.apache.pdfbox.pdmodel.PDPageContentStream;
|
|
|
|
import org.apache.pdfbox.pdmodel.PDPageContentStream;
|
|
|
|
import org.apache.pdfbox.pdmodel.common.PDRectangle;
|
|
|
|
import org.apache.pdfbox.pdmodel.common.PDRectangle;
|
|
|
|
import org.apache.pdfbox.pdmodel.font.PDType0Font;
|
|
|
|
import org.apache.pdfbox.pdmodel.font.PDType0Font;
|
|
|
|
|
|
|
|
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
|
|
|
|
import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode;
|
|
|
|
import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode;
|
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@ -28,7 +29,10 @@ import cokr.xit.fims.cmmn.hwp.format.CrdnList;
|
|
|
|
import cokr.xit.fims.cmmn.hwp.format.RcvmtConfirm;
|
|
|
|
import cokr.xit.fims.cmmn.hwp.format.RcvmtConfirm;
|
|
|
|
import cokr.xit.fims.cmmn.hwp.format.ReportOnClaims;
|
|
|
|
import cokr.xit.fims.cmmn.hwp.format.ReportOnClaims;
|
|
|
|
import cokr.xit.fims.cmmn.hwp.format.RequestForDelivery;
|
|
|
|
import cokr.xit.fims.cmmn.hwp.format.RequestForDelivery;
|
|
|
|
|
|
|
|
import cokr.xit.fims.cmmn.pdf.DefaultOtptStng;
|
|
|
|
|
|
|
|
import cokr.xit.fims.cmmn.pdf.PDFFormat;
|
|
|
|
import cokr.xit.fims.cmmn.pdf.PDFPrintUtil;
|
|
|
|
import cokr.xit.fims.cmmn.pdf.PDFPrintUtil;
|
|
|
|
|
|
|
|
import cokr.xit.fims.cmmn.pdf.format.Advntce;
|
|
|
|
import cokr.xit.fims.cmmn.service.bean.FactionBean;
|
|
|
|
import cokr.xit.fims.cmmn.service.bean.FactionBean;
|
|
|
|
import cokr.xit.fims.cmmn.service.bean.StngBean;
|
|
|
|
import cokr.xit.fims.cmmn.service.bean.StngBean;
|
|
|
|
import cokr.xit.fims.crdn.Crdn;
|
|
|
|
import cokr.xit.fims.crdn.Crdn;
|
|
|
@ -60,6 +64,8 @@ import kr.dogfoot.hwplib.writer.HWPWriter;
|
|
|
|
@Service("sprt01Service")
|
|
|
|
@Service("sprt01Service")
|
|
|
|
public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Service {
|
|
|
|
public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Service {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Object object;
|
|
|
|
|
|
|
|
|
|
|
|
/** 업무지원 Bean */
|
|
|
|
/** 업무지원 Bean */
|
|
|
|
@Resource(name="sprt01Bean")
|
|
|
|
@Resource(name="sprt01Bean")
|
|
|
|
protected Sprt01Bean sprt01Bean;
|
|
|
|
protected Sprt01Bean sprt01Bean;
|
|
|
@ -318,10 +324,19 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
|
|
|
|
if(formatName.equals("advntce")) {
|
|
|
|
if(formatName.equals("advntce")) {
|
|
|
|
sndngSeCd = "02";
|
|
|
|
sndngSeCd = "02";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PDFFormat pdfFormat = null;
|
|
|
|
|
|
|
|
if(formatName.equals("advntce")) {
|
|
|
|
|
|
|
|
pdfFormat = new Advntce();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<DefaultOtptStng> predefinedList = pdfFormat.getDefaultOtptStng();
|
|
|
|
|
|
|
|
|
|
|
|
otptStngQuery.setSndngSeCd(sndngSeCd);
|
|
|
|
otptStngQuery.setSndngSeCd(sndngSeCd);
|
|
|
|
otptStngQuery.setOtptPaperSeCd(otptPaperSeCd);
|
|
|
|
otptStngQuery.setOtptPaperSeCd(otptPaperSeCd);
|
|
|
|
|
|
|
|
|
|
|
|
List<DataObject> otptStng = otptStngMapper.selectOtptStngList(otptStngQuery);
|
|
|
|
List<DataObject> otptStng = otptStngMapper.selectOtptStngList(otptStngQuery);
|
|
|
|
|
|
|
|
Map<String, DataObject> byOtptItemStng = otptStng.stream()
|
|
|
|
|
|
|
|
.collect(Collectors.toMap((item) -> item.string("OTPT_NM"), (item) -> item));
|
|
|
|
|
|
|
|
|
|
|
|
for(DataObject dataObject : dataObjectList) {
|
|
|
|
for(DataObject dataObject : dataObjectList) {
|
|
|
|
//페이지생성(건별)
|
|
|
|
//페이지생성(건별)
|
|
|
@ -333,72 +348,35 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
|
|
|
|
// 컨텐츠 스트림 열기
|
|
|
|
// 컨텐츠 스트림 열기
|
|
|
|
PDPageContentStream contentStream = new PDPageContentStream(doc, page);
|
|
|
|
PDPageContentStream contentStream = new PDPageContentStream(doc, page);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//접는곳 점선 그리기
|
|
|
|
//접는곳 점선 그리기
|
|
|
|
pdfPrintUtil.renderFoldLine(contentStream, paperWidth, paperHeight);
|
|
|
|
pdfPrintUtil.renderFoldLine(contentStream, paperWidth, paperHeight);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//이미지 그리기
|
|
|
|
for(DefaultOtptStng predefined : predefinedList) {
|
|
|
|
//단속 이미지 로드(건별)
|
|
|
|
|
|
|
|
//PDImageXObject crdnPhotoImage = PDImageXObject.createFromFile("samplefiles/sample.JPG", doc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//float photosXstart;
|
|
|
|
|
|
|
|
//float photosYstart;
|
|
|
|
|
|
|
|
//float photosXend;
|
|
|
|
|
|
|
|
//float photosYend;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//단속사진
|
|
|
|
|
|
|
|
//contentStream.drawImage(crdnPhotoImage, 300, 280, 250, 280);
|
|
|
|
|
|
|
|
//사각형(모자이크)
|
|
|
|
|
|
|
|
//contentStream.addRect(0, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DataObject otptItemStng = byOtptItemStng.get(predefined.getOtptNm());
|
|
|
|
|
|
|
|
|
|
|
|
//직인
|
|
|
|
float[] pstn = pdfPrintUtil.getPstnStng(predefined, otptItemStng, otptPaperSeCd);
|
|
|
|
//float[] offcsLocation = {300, 50};
|
|
|
|
|
|
|
|
//float offcsSize = 20;
|
|
|
|
|
|
|
|
//contentStream.drawImage(offcsImage, offcsLocation[0], offcsLocation[1], offcsSize, offcsSize);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//지자체로고
|
|
|
|
if(predefined.getContentType().equals("text")) {
|
|
|
|
//contentStream.drawImage(logoImage, ?, ?, logoWidth, logoHeight);
|
|
|
|
|
|
|
|
//배경 이미지
|
|
|
|
|
|
|
|
//contentStream.drawImage(pdImage, 0, 0, paperWidth, paperHeight);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String textValue = pdfPrintUtil.getTextValue(predefined, otptItemStng, dataObject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PDType0Font font = pdfPrintUtil.getFontStng(predefined, otptItemStng, fontMap);
|
|
|
|
|
|
|
|
int fontSz = pdfPrintUtil.getFontSize(predefined, otptItemStng);
|
|
|
|
|
|
|
|
RenderingMode fontStyle = pdfPrintUtil.getFontStyle(predefined, otptItemStng);
|
|
|
|
|
|
|
|
PDColor fontColor = pdfPrintUtil.getFontColor(predefined, otptItemStng);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pdfPrintUtil.writeText(contentStream, textValue, pstn, font, fontSz, fontStyle, fontColor);
|
|
|
|
|
|
|
|
|
|
|
|
for(DataObject otptItemStng : otptStng) {
|
|
|
|
} else if(predefined.getContentType().equals("image")) {
|
|
|
|
|
|
|
|
|
|
|
|
String otptNm = otptItemStng.string("OTPT_NM");
|
|
|
|
String imagePath = pdfPrintUtil.getImagePath(predefined, otptItemStng, dataObject);
|
|
|
|
|
|
|
|
float[] size = pdfPrintUtil.getSize(predefined, otptItemStng);
|
|
|
|
|
|
|
|
pdfPrintUtil.insertImage(doc, contentStream, imagePath, pstn, size);
|
|
|
|
|
|
|
|
|
|
|
|
String dataValue = dataObject.string(otptItemStng.string("COL_NM"));
|
|
|
|
|
|
|
|
if(dataValue.equals("")) {
|
|
|
|
|
|
|
|
dataValue = otptItemStng.string("OTPT_BSC_VL");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float[] pstn = new float[] {
|
|
|
|
|
|
|
|
otptItemStng.number("LEFT_PSTN").floatValue(),
|
|
|
|
|
|
|
|
otptItemStng.number("TOP_PSTN").floatValue()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PDType0Font font = fontMap.get("gulim");
|
|
|
|
|
|
|
|
if(!otptItemStng.string("FONT_NM").equals("")) {
|
|
|
|
|
|
|
|
font = fontMap.get(otptItemStng.string("FONT_NM"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int fontSz = 10;
|
|
|
|
|
|
|
|
if(otptItemStng.number("FONT_SIZE").intValue() != 0) {
|
|
|
|
|
|
|
|
fontSz = otptItemStng.number("FONT_SIZE").intValue();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RenderingMode fontStyle = RenderingMode.valueOf("FILL");
|
|
|
|
|
|
|
|
if(!otptItemStng.string("FONT_STYLE").equals("")) {
|
|
|
|
|
|
|
|
fontStyle = RenderingMode.valueOf(otptItemStng.string("FONT_STYLE"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Color fontColor = Color.getColor("BLACK");
|
|
|
|
|
|
|
|
if(!otptItemStng.string("FONT_COLOR").equals("")) {
|
|
|
|
|
|
|
|
fontColor = Color.getColor(otptItemStng.string("FONT_COLOR"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pdfPrintUtil.writeText(contentStream, dataValue, pstn, font, fontSz, fontStyle, fontColor);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contentStream.close();
|
|
|
|
contentStream.close();
|
|
|
|