배경이미지 출력 수정

main
이범준 11 months ago
parent fab0d51e63
commit 9b0d62ba86

@ -2,6 +2,7 @@ package cokr.xit.fims.cmmn.pdf.format;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FactionUtil; import cokr.xit.fims.cmmn.FactionUtil;
@ -95,9 +96,13 @@ public class Advntce extends PDFFormat {
return this.getValueForPost(otptArtclNm, defaultValue, dataObject, printOption, pdfPrintUtil); return this.getValueForPost(otptArtclNm, defaultValue, dataObject, printOption, pdfPrintUtil);
} }
Map<String, String> globalVariable = printOption.getGlobalVariable();
switch(otptArtclNm) { switch(otptArtclNm) {
case "background" -> { case "background" -> {
result = dataObject.string(""); if(globalVariable.get("bcrnImgPath") != null) {
result = globalVariable.get("bcrnImgPath");
}
} }
case "rprsCrdnPhoto" -> { //대표사진 case "rprsCrdnPhoto" -> { //대표사진
result = dataObject.string("CRDN_PHOTO1"); result = dataObject.string("CRDN_PHOTO1");
@ -214,7 +219,7 @@ public class Advntce extends PDFFormat {
result = instNm; result = instNm;
} }
case "offcs" -> { case "offcs" -> {
result = printOption.getGlobalVariable().get("offcsFilePath"); result = globalVariable.get("offcsFilePath");
} }
case "undefined" -> { case "undefined" -> {

@ -276,6 +276,26 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
if(formatName.equals("advntce")) { if(formatName.equals("advntce")) {
pdfFormat = new Advntce(); pdfFormat = new Advntce();
} }
String sndngSeCd = "";
if(formatName.equals("advntce")) {
sndngSeCd = "02";
}
String paperSeCd = printOption.getPaperSeCd();
String taskSeCd = printOption.getTaskSeCd();
DataObject userStngInfo = stngBean.getStng("user");
DataObject sggStngInfo = stngBean.getStng("sgg");
DataObject deptStngInfo = stngBean.getStng("dept");
PDFPrintUtil pdfPrintUtil = new PDFPrintUtil();
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
pdfPrintUtil.setPrintRequestUserInfo(userInfo);
String printUserSggCd = (String) pdfPrintUtil.getPrintRequestUserInfo().getInfo().get("sggCd");
pdfPrintUtil.setting(paperSeCd);
List<DataObject> dataObjectList = new ArrayList<DataObject>(); List<DataObject> dataObjectList = new ArrayList<DataObject>();
if(crdnIds.length == 1 && crdnIds[0].equals("sample")) { if(crdnIds.length == 1 && crdnIds[0].equals("sample")) {
@ -305,10 +325,33 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
} }
} }
DataObject userStngInfo = stngBean.getStng("user");
DataObject sggStngInfo = stngBean.getStng("sgg");
DataObject deptStngInfo = stngBean.getStng("dept");
String resultFilePath = pdfPrintUtil.filePathForNewFile();
PDDocument doc = new PDDocument();//pdf문서 생성
//폰트 로드
Map<String, PDType0Font> fontMap = pdfPrintUtil.getFontMap(doc);
//용지 크기 설정
PDRectangle paper = null;
if(paperSeCd.equals("01")) {
paper = PDRectangle.A4;
} else {
paper = PDRectangle.LETTER;
}
//출력물 기본 설정
OtptStngQuery otptStngQuery = new OtptStngQuery();
otptStngQuery.setSggCd(printUserSggCd);
otptStngQuery.setTaskSeCd(taskSeCd);
otptStngQuery.setSndngSeCd(sndngSeCd);
otptStngQuery.setPaperSeCd(paperSeCd);
DataObject otptBscStng = otptStngMapper.selectOtptBscStng(otptStngQuery);
if(otptBscStng == null) {
otptBscStng = new DataObject();
}
//
Map<String, String> globalVariable = printOption.getGlobalVariable(); Map<String, String> globalVariable = printOption.getGlobalVariable();
if(globalVariable == null) { if(globalVariable == null) {
globalVariable = new HashMap<String, String>(); globalVariable = new HashMap<String, String>();
@ -320,55 +363,14 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
globalVariable.put("instZip", sggStngInfo.string("INST_ZIP")); globalVariable.put("instZip", sggStngInfo.string("INST_ZIP"));
globalVariable.put("deptTelno", deptStngInfo.string("DEPT_TELNO")); globalVariable.put("deptTelno", deptStngInfo.string("DEPT_TELNO"));
globalVariable.put("deptFxno", deptStngInfo.string("DEPT_FXNO")); globalVariable.put("deptFxno", deptStngInfo.string("DEPT_FXNO"));
if(!otptBscStng.string("BCRN_IMG_PATH").equals("")) {
globalVariable.put("bcrnImgPath", otptBscStng.string("BCRN_IMG_PATH"));
}
printOption.setGlobalVariable(globalVariable); printOption.setGlobalVariable(globalVariable);
List<DefaultOtptArtclStng> prototypeStngList = pdfFormat.getPrototypeStngs();
try { try {
String paperSeCd = printOption.getPaperSeCd();
PDFPrintUtil pdfPrintUtil = new PDFPrintUtil();
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
pdfPrintUtil.setPrintRequestUserInfo(userInfo);
//
pdfPrintUtil.setting(paperSeCd);
String resultFilePath = pdfPrintUtil.filePathForNewFile();
PDDocument doc = new PDDocument();//pdf문서 생성
//폰트 로드
Map<String, PDType0Font> fontMap = pdfPrintUtil.getFontMap(doc);
//용지 크기 설정
PDRectangle paper = null;
if(paperSeCd.equals("01")) {
paper = PDRectangle.A4;
} else {
paper = PDRectangle.LETTER;
}
OtptStngQuery otptStngQuery = new OtptStngQuery();
otptStngQuery.setSggCd((String) pdfPrintUtil.getPrintRequestUserInfo().getInfo().get("sggCd"));
otptStngQuery.setTaskSeCd(printOption.getTaskSeCd());
String sndngSeCd = "";
if(formatName.equals("advntce")) {
sndngSeCd = "02";
}
List<DefaultOtptArtclStng> prototypeStngList = pdfFormat.getPrototypeStngs();
otptStngQuery.setSndngSeCd(sndngSeCd);
otptStngQuery.setPaperSeCd(paperSeCd);
//출력물 기본 설정
DataObject otptBscStng = otptStngMapper.selectOtptBscStng(otptStngQuery);
if(otptBscStng == null) {
otptBscStng = new DataObject();
}
//출력 요소별 설정 //출력 요소별 설정
List<DataObject> otptArtclStngList = otptStngMapper.selectOtptArtclStngList(otptStngQuery); List<DataObject> otptArtclStngList = otptStngMapper.selectOtptArtclStngList(otptStngQuery);

@ -505,7 +505,7 @@ public class Sprt01Controller extends ApplicationController {
+File.separator+sggCd; +File.separator+sggCd;
String ext = FilenameUtils.getExtension(backgroundFile.getOriginalFilename()); String ext = FilenameUtils.getExtension(backgroundFile.getOriginalFilename());
String fileName = otptForm.getTaskSeCd()+"-"+otptForm.getSndngSeCd()+"-"+otptForm.getTaskSeCd()+"."+ext; String fileName = otptForm.getTaskSeCd()+"-"+otptForm.getSndngSeCd()+"-"+otptForm.getPaperSeCd()+"."+ext;
File workDir = new File(bgPath); File workDir = new File(bgPath);
workDir.mkdirs(); workDir.mkdirs();

Loading…
Cancel
Save