한글 출력 pdf출력 수정

main
이범준 12 months ago
parent ded0e973f0
commit 5e40fc10d9

@ -0,0 +1,62 @@
package cokr.xit.fims.cmmn;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.foundation.UserInfo;
import cokr.xit.foundation.data.DataObject;
public class PrintUtil {
public PrintUtil(){
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss");
this.printRequestDt = ymdhmsFormat.format(new Date());
}
protected int fileNameIndex = 0;
protected String printRequestDt;
protected UserInfo printRequestUserInfo;
public UserInfo getPrintRequestUserInfo() {
return this.printRequestUserInfo;
};
public void setPrintRequestUserInfo(UserInfo printRequestUserInfo) {
this.printRequestUserInfo = printRequestUserInfo;
};
public float mmToPt(float mm) {
return mm * 2.83465f;
}
public int getTotalDataCount(List<DataObject> dataObjectList) {
int totalDataCount = dataObjectList.size();
return totalDataCount;
}
public boolean getPrivateInfoYn(PrintOption printOption) {
boolean privateInfoYn = true;
if(printOption != null && printOption.getPrivateInfoYn() != null && printOption.getPrivateInfoYn().equals("N")) {
privateInfoYn = false;
}
return privateInfoYn;
}
public Map<String,String> getGlobalVariable(PrintOption printOption) {
Map<String,String> map = new HashMap<String,String>();
if(printOption != null && printOption.getGlobalVariable() != null && !printOption.getGlobalVariable().isEmpty()) {
map = printOption.getGlobalVariable();
}
return map;
}
}

@ -0,0 +1,33 @@
package cokr.xit.fims.cmmn.hwp;
import java.util.List;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile;
public interface HWPFormatWriter {
/** .
* @param hwpPrintUtil
* @return
*/
void setting(HWPPrintUtil hwpPrintUtil);
/**
* @param
* @return
*/
void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList,
PrintOption printOption, HWPPrintUtil hwpPrintUtil);
/**
* @param
* @return
*/
void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile, DataObject dataObject,
HWPPrintUtil hwpPrintUtil);
}

@ -4,75 +4,98 @@ import java.io.File;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.core.io.ClassPathResource;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FactionUtil;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.foundation.UserInfo;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.fims.cmmn.PrintUtil;
import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.reader.HWPReader;
import kr.dogfoot.hwplib.writer.HWPWriter;
public class HWPPrintUtil {
public class HWPPrintUtil extends PrintUtil {
private String formatType;
private String formatName;
private String formatKorName;
private String printRequestDt;
private int recordPerPartFile;
private String baseFormatFilePath;
private String attachFormatFilePath;
private UserInfo printRequestUserInfo;
private String attachFormatFilePath;
private int totalPartFileCount;
private int fileNameIndex;
public String getFormatType() {
return this.formatType;
}
public void setFormatType(String formatType) {
this.formatType = formatType;
}
public String getFormatName() {
return this.formatName;
}
public void setFormatName(String formatName) {
this.formatName = formatName;
}
public String getFormatKorName() {
return this.formatKorName;
}
public void setFormatKorName(String formatKorName) {
this.formatKorName = formatKorName;
}
public String getPrintRequestDt() {
return this.printRequestDt;
}
public UserInfo getPrintRequestUserInfo() {
return this.printRequestUserInfo;
};
public void setPrintRequestDt(String printRequestDt) {
this.printRequestDt = printRequestDt;
}
public int getRecordPerPartFile() {
return this.recordPerPartFile;
}
public void setRecordPerPartFile(int recordPerPartFile) {
this.recordPerPartFile = recordPerPartFile;
}
public int getTotalPartFileCount() {
return this.totalPartFileCount;
}
public void setTotalPartFileCount(int totalPartFileCount) {
this.totalPartFileCount = totalPartFileCount;
}
public String getBaseFormatFilePath() {
return this.baseFormatFilePath;
}
public void setBaseFormatFilePath(String baseFormatFilePath) {
this.baseFormatFilePath = baseFormatFilePath;
}
public String getAttachFormatFilePath() {
return this.attachFormatFilePath;
}
public void setAttachFormatFilePath(String attachFormatFilePath) {
this.attachFormatFilePath = attachFormatFilePath;
}
/** .
* @param
* @return
*/
public void calcTotalPartFileCount(int totalDataCount) {
if(this.formatType.equals("list")) {
@ -96,70 +119,6 @@ public class HWPPrintUtil {
}
public void setPrintRequestUserInfo(UserInfo printRequestUserInfo) {
this.printRequestUserInfo = printRequestUserInfo;
};
public void setting(String formatType, String formatName) {
this.formatType = formatType;
this.formatName = formatName;
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss");
this.printRequestDt = ymdhmsFormat.format(new Date());
if(!formatType.equals("list")) {
this.recordPerPartFile = 1;
} else {
switch (formatName) {
case "crdnList": {
this.recordPerPartFile = 6;
break;
}
case "requestForDelivery": {
this.recordPerPartFile = 7;
break;
}
case "reportOnClaims": {
this.recordPerPartFile = 7;
break;
}
}
}
switch (formatName) {
case "crdnConfirm": {
this.formatKorName = "단속확인서";
this.baseFormatFilePath = "format/crdnConfirm.hwp";
this.attachFormatFilePath = "";
break;
}
case "crdnList": {
this.formatKorName = "단속내역서";
this.baseFormatFilePath = "format/crdnList_root.hwp";
this.attachFormatFilePath = "format/crdnList_inner.hwp";
break;
}
case "requestForDelivery": {
this.formatKorName = "교부청구서";
this.baseFormatFilePath = "format/requestForDelivery_root.hwp";
this.attachFormatFilePath = "format/requestForDelivery_inner.hwp";
break;
}
case "reportOnClaims": {
this.formatKorName = "채권신고서";
this.baseFormatFilePath = "format/reportOnClaims_root.hwp";
this.attachFormatFilePath = "format/reportOnClaims_inner.hwp";
break;
}
case "rcvmtConfirm": {
this.formatKorName = "납부확인서";
this.baseFormatFilePath = "format/rcvmtConfirm.hwp";
this.attachFormatFilePath = "";
break;
}
}
}
/** .
* @param formatFile
* @return
@ -194,259 +153,4 @@ public class HWPPrintUtil {
}
/** .
* @param dataObjectList , baseFile
* @return
*/
public void setGlobalInfo(PrintOption printOption, List<DataObject> dataObjectList, HWPFile baseFile) {
int totalDataCount = dataObjectList.size();
boolean privateInfoYn = true;
if(printOption.getPrivateInfoYn() != null && printOption.getPrivateInfoYn().equals("N")) {
privateInfoYn = false;
}
Map<String, String> globalVariable = printOption.getGlobalVariable();
if(this.formatName.equals("crdnList")){
String globalRtpyrNm = dataObjectList.get(0).string("RTPYR_NM");
String globalRtpyrNo = dataObjectList.get(0).string("RTPYR_NO");
String globalRtpyrFullAddr = dataObjectList.get(0).string("RTPYR_FULL_ADDR");
int globalTotalAmount = dataObjectList.stream().mapToInt(i -> i.number("LEVY_AMT").intValue()).sum();
//상단
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
baseFileEditor.set("성명", globalRtpyrNm);
if(privateInfoYn) {
baseFileEditor.set("주민번호", globalRtpyrNo);
} else {
baseFileEditor.set("주민번호", "*************");
}
baseFileEditor.set("주소", globalRtpyrFullAddr);
baseFileEditor.set("총건수", CmmnUtil.addCommaToNumber(totalDataCount));
baseFileEditor.set("총금액", CmmnUtil.addCommaToNumber(globalTotalAmount));
baseFileEditor.set("출력일시", CmmnUtil.yyyy_mm_dd_hh_mm_ss(this.printRequestDt));
String instNm = (String) this.printRequestUserInfo.getInfo().get("instNm");
instNm = FactionUtil.getLastWord(instNm);
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
}
else if(this.formatName.equals("requestForDelivery")){
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
baseFileEditor.set("문서번호", globalVariable.get("docNo"));
baseFileEditor.set("사건번호", globalVariable.get("caseNo"));
baseFileEditor.set("수신", globalVariable.get("receiver"));
baseFileEditor.set("체납자성명", globalVariable.get("rtpyrNm"));
baseFileEditor.set("체납자번호", globalVariable.get("rtpyrNo"));
baseFileEditor.set("차량번호", globalVariable.get("vhrno"));
baseFileEditor.set("주소", globalVariable.get("rtpyrFullAddr"));
int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();
baseFileEditor.set("합계금액", CmmnUtil.addCommaToNumber(sumOfList));
baseFileEditor.set("교부청구금액", CmmnUtil.addCommaToNumber(sumOfList));
baseFileEditor.set("교부청구금액한글", CmmnUtil.convertNumberToHangul(sumOfList));
baseFileEditor.set("개설은행", globalVariable.get("dtbnBankNm"));
baseFileEditor.set("계좌번호", globalVariable.get("dtbnActno"));
String instNm = (String) this.printRequestUserInfo.getInfo().get("instNm");
String deptNm = (String) this.printRequestUserInfo.getInfo().get("deptNm");
baseFileEditor.set("예금주", instNm + " " + deptNm);
String printRequestYmd = this.printRequestDt.substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
baseFileEditor.set("연월일", ymd);
instNm = FactionUtil.getLastWord(instNm);
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
try {
InsertingImageCell.IMPL_InsertPicture(baseFile, "직인", globalVariable.get("offcsFilePath"));
} catch (Exception e) {
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
}
else if(this.formatName.equals("reportOnClaims")){
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
baseFileEditor.set("주소", globalVariable.get("deptAddr"));
baseFileEditor.set("전화", globalVariable.get("deptTelno"));
baseFileEditor.set("팩스", globalVariable.get("deptFxno"));
baseFileEditor.set("담당자", this.printRequestUserInfo.getName());
baseFileEditor.set("사건번호", globalVariable.get("caseNo"));
baseFileEditor.set("체납자성명", globalVariable.get("rtpyrNm"));
baseFileEditor.set("체납자번호", globalVariable.get("rtpyrNo"));
baseFileEditor.set("체납자주소", globalVariable.get("rtpyrFullAddr"));
int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();
baseFileEditor.set("채권청구액", CmmnUtil.addCommaToNumber(sumOfList));
baseFileEditor.set("합계금액", CmmnUtil.addCommaToNumber(sumOfList));
baseFileEditor.set("합계금액한글", CmmnUtil.convertNumberToHangul(sumOfList));
String printRequestYmd = this.printRequestDt.substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
baseFileEditor.set("연월일", ymd);
String instNm = (String) this.printRequestUserInfo.getInfo().get("instNm");
instNm = FactionUtil.getLastWord(instNm);
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
try {
InsertingImageCell.IMPL_InsertPicture(baseFile, "직인", globalVariable.get("offcsFilePath"));
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
}
}
/** .
* @param dataObject , baseFile
* @return
*/
public void setBySingleData(PrintOption printOption, DataObject dataObject, HWPFile baseFile) {
try {
if(this.formatType.equals("list")) {
InputStream attachFormatIS = new ClassPathResource(this.getAttachFormatFilePath()).getInputStream();
HWPFile attachFormatFile = HWPReader.fromInputStream(attachFormatIS);
ClickHereEditor attachFileEditor = new ClickHereEditor(attachFormatFile);
if(this.formatName.equals("crdnList")){
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")));
}
else if(this.formatName.equals("requestForDelivery")){
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")));
}
else if(this.formatName.equals("reportOnClaims")){
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")));
}
AddUtil.insertTableInCell(attachFormatFile, baseFile, "내부");
} else {
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
if(this.formatName.equals("crdnConfirm")){
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 = this.printRequestDt.substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
baseFileEditor.set("연월일", ymd);
String instNm = (String) this.printRequestUserInfo.getInfo().get("instNm");
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
if(!dataObject.string("PHOTO1").equals("")) {
InsertingImageCell.IMPL_InsertPicture(baseFile, "왼쪽위사진", dataObject.string("PHOTO1"));
}
if(!dataObject.string("PHOTO2").equals("")) {
InsertingImageCell.IMPL_InsertPicture(baseFile, "오른쪽위사진", dataObject.string("PHOTO2"));
}
if(!dataObject.string("PHOTO3").equals("")) {
InsertingImageCell.IMPL_InsertPicture(baseFile, "왼쪽아래사진", dataObject.string("PHOTO3"));
}
if(!dataObject.string("PHOTO4").equals("")) {
InsertingImageCell.IMPL_InsertPicture(baseFile, "오른쪽아래사진", dataObject.string("PHOTO4"));
}
}
else if(this.formatName.equals("rcvmtConfirm")) {
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(this.printRequestDt));
baseFileEditor.set("확인자", this.printRequestUserInfo.getName());
String instNm = (String) this.printRequestUserInfo.getInfo().get("instNm");
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
}
}
} catch(Exception e) {
e.printStackTrace();
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
}
}

@ -0,0 +1,85 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.util.List;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FactionUtil;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.cmmn.hwp.HWPFormatWriter;
import cokr.xit.fims.cmmn.hwp.HWPPrintUtil;
import cokr.xit.fims.cmmn.hwp.InsertingImageCell;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile;
public class CrdnConfirm implements HWPFormatWriter {
@Override
public void setting(HWPPrintUtil hwpPrintUtil) {
hwpPrintUtil.setFormatName("crdnConfirm");
hwpPrintUtil.setFormatKorName("단속확인서");
hwpPrintUtil.setFormatType("info");
hwpPrintUtil.setRecordPerPartFile(1);
hwpPrintUtil.setBaseFormatFilePath("format/crdnConfirm.hwp");
hwpPrintUtil.setAttachFormatFilePath("");
}
@Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption,
HWPPrintUtil hwpPrintUtil) {
}
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile,
DataObject dataObject, HWPPrintUtil hwpPrintUtil) {
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 = hwpPrintUtil.getPrintRequestDt().substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
baseFileEditor.set("연월일", ymd);
String instNm = (String) hwpPrintUtil.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
try {
if(!dataObject.string("PHOTO1").equals("")) {
InsertingImageCell.IMPL_InsertPicture(baseFile, "왼쪽위사진", dataObject.string("PHOTO1"));
}
if(!dataObject.string("PHOTO2").equals("")) {
InsertingImageCell.IMPL_InsertPicture(baseFile, "오른쪽위사진", dataObject.string("PHOTO2"));
}
if(!dataObject.string("PHOTO3").equals("")) {
InsertingImageCell.IMPL_InsertPicture(baseFile, "왼쪽아래사진", dataObject.string("PHOTO3"));
}
if(!dataObject.string("PHOTO4").equals("")) {
InsertingImageCell.IMPL_InsertPicture(baseFile, "오른쪽아래사진", dataObject.string("PHOTO4"));
}
} catch(Exception e) {
e.printStackTrace();
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
}
}

@ -0,0 +1,86 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.util.List;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FactionUtil;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.cmmn.hwp.HWPFormatWriter;
import cokr.xit.fims.cmmn.hwp.HWPPrintUtil;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile;
public class CrdnList implements HWPFormatWriter {
@Override
public void setting(HWPPrintUtil hwpPrintUtil) {
hwpPrintUtil.setFormatName("crdnList");
hwpPrintUtil.setFormatKorName("단속내역서");
hwpPrintUtil.setFormatType("list");
hwpPrintUtil.setRecordPerPartFile(6);
hwpPrintUtil.setBaseFormatFilePath("format/crdnList_root.hwp");
hwpPrintUtil.setAttachFormatFilePath("format/crdnList_inner.hwp");
}
@Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList,
PrintOption printOption, HWPPrintUtil hwpPrintUtil
) {
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
String globalRtpyrNm = dataObjectList.get(0).string("RTPYR_NM");
String globalRtpyrNo = dataObjectList.get(0).string("RTPYR_NO");
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(hwpPrintUtil.getPrivateInfoYn(printOption)) {
baseFileEditor.set("주민번호", globalRtpyrNo);
} else {
baseFileEditor.set("주민번호", "*************");
}
baseFileEditor.set("주소", globalRtpyrFullAddr);
baseFileEditor.set("총건수", CmmnUtil.addCommaToNumber(hwpPrintUtil.getTotalDataCount(dataObjectList)));
baseFileEditor.set("총금액", CmmnUtil.addCommaToNumber(globalTotalAmount));
baseFileEditor.set("출력일시", CmmnUtil.yyyy_mm_dd_hh_mm_ss(hwpPrintUtil.getPrintRequestDt()));
String instNm = (String) hwpPrintUtil.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = FactionUtil.getLastWord(instNm);
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
}
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile,
DataObject dataObject, HWPPrintUtil hwpPrintUtil) {
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")));
}
}

@ -0,0 +1,63 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.util.List;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FactionUtil;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.cmmn.hwp.HWPFormatWriter;
import cokr.xit.fims.cmmn.hwp.HWPPrintUtil;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile;
public class RcvmtConfirm implements HWPFormatWriter {
@Override
public void setting(HWPPrintUtil hwpPrintUtil) {
hwpPrintUtil.setFormatName("rcvmtConfirm");
hwpPrintUtil.setFormatKorName("납부확인서");
hwpPrintUtil.setFormatType("info");
hwpPrintUtil.setRecordPerPartFile(1);
hwpPrintUtil.setBaseFormatFilePath("format/rcvmtConfirm.hwp");
hwpPrintUtil.setAttachFormatFilePath("");
}
@Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption,
HWPPrintUtil hwpPrintUtil) {
}
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile,
DataObject dataObject, HWPPrintUtil hwpPrintUtil) {
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(hwpPrintUtil.getPrintRequestDt()));
baseFileEditor.set("확인자", hwpPrintUtil.getPrintRequestUserInfo().getName());
String instNm = (String) hwpPrintUtil.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
}
}

@ -0,0 +1,92 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.util.List;
import java.util.Map;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FactionUtil;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.cmmn.hwp.HWPFormatWriter;
import cokr.xit.fims.cmmn.hwp.HWPPrintUtil;
import cokr.xit.fims.cmmn.hwp.InsertingImageCell;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile;
public class ReportOnClaims implements HWPFormatWriter {
@Override
public void setting(HWPPrintUtil hwpPrintUtil) {
hwpPrintUtil.setFormatName("채권신고서");
hwpPrintUtil.setFormatKorName("reportOnClaims");
hwpPrintUtil.setFormatType("list");
hwpPrintUtil.setRecordPerPartFile(7);
hwpPrintUtil.setBaseFormatFilePath("format/reportOnClaims_root.hwp");
hwpPrintUtil.setAttachFormatFilePath("format/reportOnClaims_inner.hwp");
}
@Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption,
HWPPrintUtil hwpPrintUtil) {
Map<String,String> globalVariable = hwpPrintUtil.getGlobalVariable(printOption);
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
baseFileEditor.set("주소", globalVariable.get("deptAddr"));
baseFileEditor.set("전화", globalVariable.get("deptTelno"));
baseFileEditor.set("팩스", globalVariable.get("deptFxno"));
baseFileEditor.set("담당자", hwpPrintUtil.getPrintRequestUserInfo().getName());
baseFileEditor.set("사건번호", globalVariable.get("caseNo"));
baseFileEditor.set("체납자성명", globalVariable.get("rtpyrNm"));
baseFileEditor.set("체납자번호", globalVariable.get("rtpyrNo"));
baseFileEditor.set("체납자주소", globalVariable.get("rtpyrFullAddr"));
int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();
baseFileEditor.set("채권청구액", CmmnUtil.addCommaToNumber(sumOfList));
baseFileEditor.set("합계금액", CmmnUtil.addCommaToNumber(sumOfList));
baseFileEditor.set("합계금액한글", CmmnUtil.convertNumberToHangul(sumOfList));
String printRequestYmd = hwpPrintUtil.getPrintRequestDt().substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
baseFileEditor.set("연월일", ymd);
String instNm = (String) hwpPrintUtil.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = FactionUtil.getLastWord(instNm);
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
try {
InsertingImageCell.IMPL_InsertPicture(baseFile, "직인", globalVariable.get("offcsFilePath"));
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
}
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile,
DataObject dataObject, HWPPrintUtil hwpPrintUtil) {
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")));
}
}

@ -0,0 +1,90 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.util.List;
import java.util.Map;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FactionUtil;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.cmmn.hwp.HWPFormatWriter;
import cokr.xit.fims.cmmn.hwp.HWPPrintUtil;
import cokr.xit.fims.cmmn.hwp.InsertingImageCell;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile;
public class RequestForDelivery implements HWPFormatWriter {
@Override
public void setting(HWPPrintUtil hwpPrintUtil) {
hwpPrintUtil.setFormatName("교부청구서");
hwpPrintUtil.setFormatKorName("requestForDelivery");
hwpPrintUtil.setFormatType("list");
hwpPrintUtil.setRecordPerPartFile(7);
hwpPrintUtil.setBaseFormatFilePath("format/requestForDelivery_root.hwp");
hwpPrintUtil.setAttachFormatFilePath("format/requestForDelivery_inner.hwp");
}
@Override
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList,
PrintOption printOption, HWPPrintUtil hwpPrintUtil) {
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
Map<String,String> globalVariable = hwpPrintUtil.getGlobalVariable(printOption);
baseFileEditor.set("문서번호", globalVariable.get("docNo"));
baseFileEditor.set("사건번호", globalVariable.get("caseNo"));
baseFileEditor.set("수신", globalVariable.get("receiver"));
baseFileEditor.set("체납자성명", globalVariable.get("rtpyrNm"));
baseFileEditor.set("체납자번호", globalVariable.get("rtpyrNo"));
baseFileEditor.set("차량번호", globalVariable.get("vhrno"));
baseFileEditor.set("주소", globalVariable.get("rtpyrFullAddr"));
int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();
baseFileEditor.set("합계금액", CmmnUtil.addCommaToNumber(sumOfList));
baseFileEditor.set("교부청구금액", CmmnUtil.addCommaToNumber(sumOfList));
baseFileEditor.set("교부청구금액한글", CmmnUtil.convertNumberToHangul(sumOfList));
baseFileEditor.set("개설은행", globalVariable.get("dtbnBankNm"));
baseFileEditor.set("계좌번호", globalVariable.get("dtbnActno"));
String instNm = (String) hwpPrintUtil.getPrintRequestUserInfo().getInfo().get("instNm");
String deptNm = (String) hwpPrintUtil.getPrintRequestUserInfo().getInfo().get("deptNm");
baseFileEditor.set("예금주", instNm + " " + deptNm);
String printRequestYmd = hwpPrintUtil.getPrintRequestDt().substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
baseFileEditor.set("연월일", ymd);
instNm = FactionUtil.getLastWord(instNm);
instNm = FactionUtil.getInstituteLeader(instNm, false);
baseFileEditor.set("발신", instNm);
try {
InsertingImageCell.IMPL_InsertPicture(baseFile, "직인", globalVariable.get("offcsFilePath"));
} catch (Exception e) {
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
}
@Override
public void writeSingleDataInfo(HWPFile baseFile, HWPFile attachFile,
DataObject dataObject, HWPPrintUtil hwpPrintUtil) {
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")));
}
}

@ -0,0 +1,21 @@
package cokr.xit.fims.cmmn.pdf;
public class PDFCoordinate {
private float x;
private float y;
private float maxY;
public PDFCoordinate(float xpt, float ypt, float maxY) {
this.x = xpt;
this.y = ypt;
this.maxY = maxY;
}
public float[] offset() {
return new float[] {x, -y};
}
public float[] absolute() {
return new float[] {x, maxY-y};
}
}

@ -1,12 +1,28 @@
package cokr.xit.fims.cmmn.pdf;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class PDFPrintUtil {
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDType0Font;
import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode;
private int fileNameIndex = 0;
import cokr.xit.fims.cmmn.PrintUtil;
public class PDFPrintUtil extends PrintUtil {
private float[] paperMilimeter = new float[2];
public void setting(String paperType) {
if(paperType.equals("01")) {
this.paperMilimeter = new float[] {210 , 297};
} else if(paperType.equals("02")){
this.paperMilimeter = new float[] {216 , 279};
}
}
public String filePathForNewFile() {
@ -27,9 +43,68 @@ public class PDFPrintUtil {
String resultPdfPath = fileResultFolderPath
+ File.separator + currentTime + "_" + (this.fileNameIndex++) + ".pdf";
return resultPdfPath;
}
//
public PDFCoordinate toPDFCoordinate(float[] XYmm) {
float Xmm = XYmm[0];
float Ymm = XYmm[1];
float Xpt = mmToPt(Xmm);
float Ypt = mmToPt(Ymm);
float YptMax = mmToPt(this.paperMilimeter[1]);
return new PDFCoordinate(Xpt, Ypt, YptMax);
}
//
public void writeText(PDPageContentStream contentStream, String text, float[] XYmm,
PDType0Font font, int fontSize, RenderingMode fontStyle, Color fontColor) {
try {
float[] xyOffset = this.toPDFCoordinate(XYmm).offset();
contentStream.beginText();
contentStream.setFont(font, fontSize);
contentStream.setRenderingMode(fontStyle);
contentStream.setNonStrokingColor(fontColor);
contentStream.newLineAtOffset(xyOffset[0], xyOffset[1]);
contentStream.showText(text);
contentStream.endText();
} catch (IOException e) {
throw new RuntimeException("PDF 파일 출력 중 오류가 발생하였습니다.");
}
}
public void renderFoldLine(PDPageContentStream contentStream, float paperWidth, float paperHeight) {
float foldHeight = 712/3;
float bottomFold = foldHeight; //하단접는곳
float topFold = foldHeight * 2; //상단접는곳
if(paperHeight == 842f) {
bottomFold += 130f;
topFold += 130f;
}
try {
contentStream.setLineDashPattern(new float[]{3,1}, 0);
contentStream.moveTo(0, topFold);
contentStream.lineTo(paperWidth, topFold);
contentStream.stroke();
contentStream.moveTo(0, bottomFold);
contentStream.lineTo(paperWidth, bottomFold);
contentStream.stroke();
contentStream.setLineDashPattern(new float[]{}, 0);
} catch (IOException e) {
throw new RuntimeException("PDF 파일 출력 중 오류가 발생하였습니다.");
}
}
}

@ -0,0 +1,5 @@
package cokr.xit.fims.cmmn.pdf.format;
public class Advntce {
}

@ -0,0 +1,33 @@
package cokr.xit.fims.sprt;
import cokr.xit.fims.cmmn.CmmnQuery;
public class OtptStngQuery extends CmmnQuery {
private static final long serialVersionUID = 1L;
//발송구분코드
private String sndngSeCd;
//출력용지구분코드
private String otptPaperSeCd;
public String getSndngSeCd() {
return ifEmpty(sndngSeCd, () -> null);
}
public <T extends OtptStngQuery> T setSndngSeCd(String sndngSeCd) {
this.sndngSeCd = sndngSeCd;
return self();
}
public String getOtptPaperSeCd() {
return ifEmpty(otptPaperSeCd, () -> null);
}
public <T extends OtptStngQuery> T setOtptPaperSeCd(String otptPaperSeCd) {
this.otptPaperSeCd = otptPaperSeCd;
return self();
}
}

@ -12,11 +12,21 @@ public class PrintOption {
/**
*
*/
String privateInfoYn;
private String privateInfoYn;
/**
*
*/
private String otptPaperSeCd;
/**
*
*/
private String taskSeCd;
/**
*
*/
Map<String,String> globalVariable;
private Map<String,String> globalVariable;
}

@ -0,0 +1,20 @@
package cokr.xit.fims.sprt.dao;
import java.util.List;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.sprt.OtptStngQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@Mapper("otptStngMapper")
public interface OtptStngMapper extends AbstractMapper {
/** ..<br />
* @param query
* @return
*/
List<DataObject> selectOtptStngList(OtptStngQuery query);
}

@ -1,5 +1,7 @@
package cokr.xit.fims.sprt.service.bean;
import java.awt.Color;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -7,20 +9,36 @@ import java.util.Map;
import javax.annotation.Resource;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.font.PDType0Font;
import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.fims.cmmn.hwp.AddUtil;
import cokr.xit.fims.cmmn.hwp.HWPFormatWriter;
import cokr.xit.fims.cmmn.hwp.HWPPrintUtil;
import cokr.xit.fims.cmmn.hwp.format.CrdnConfirm;
import cokr.xit.fims.cmmn.hwp.format.CrdnList;
import cokr.xit.fims.cmmn.hwp.format.RcvmtConfirm;
import cokr.xit.fims.cmmn.hwp.format.ReportOnClaims;
import cokr.xit.fims.cmmn.hwp.format.RequestForDelivery;
import cokr.xit.fims.cmmn.pdf.PDFPrintUtil;
import cokr.xit.fims.cmmn.service.bean.FactionBean;
import cokr.xit.fims.cmmn.service.bean.StngBean;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.dao.CrdnListMapper;
import cokr.xit.fims.sprt.OtptStngQuery;
import cokr.xit.fims.sprt.PrintOption;
import cokr.xit.fims.sprt.SprtQuery;
import cokr.xit.fims.sprt.dao.IntegrationSearchMapper;
import cokr.xit.fims.sprt.dao.OtptStngMapper;
import cokr.xit.fims.sprt.service.Sprt01Service;
import cokr.xit.foundation.UserInfo;
import cokr.xit.foundation.component.AbstractServiceBean;
@ -61,6 +79,9 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
@Resource(name = "integrationSearchMapper")
protected IntegrationSearchMapper integrationSearchMapper;
@Resource(name = "otptStngMapper")
protected OtptStngMapper otptStngMapper;
@Override
public List<DataObject> getIntegrationDataList(SprtQuery query) {
return sprt01Bean.getIntegrationDataList(query);
@ -78,12 +99,22 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
Map<String, String> result = new HashMap<>();
HWPPrintUtil printUtil = new HWPPrintUtil();
printUtil.setting(formatType, formatName);
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
printUtil.setPrintRequestUserInfo(userInfo);
HWPFormatWriter hwpFormatWriter = null;
switch (formatName) {
case "crdnConfirm" -> { hwpFormatWriter = new CrdnConfirm(); }
case "crdnList" -> { hwpFormatWriter = new CrdnList(); }
case "reportOnClaims" -> { hwpFormatWriter = new ReportOnClaims(); }
case "requestForDelivery" -> { hwpFormatWriter = new RequestForDelivery(); }
case "rcvmtConfirm" -> { hwpFormatWriter = new RcvmtConfirm(); }
}
hwpFormatWriter.setting(printUtil);
DataObject sggStngInfo = stngBean.getStng("sgg");
DataObject deptStngInfo = stngBean.getStng("dept");
@ -166,7 +197,8 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
HWPFile resultFile = HWPReader.fromFile(resultHwpPath);
//공통사항 세팅
printUtil.setGlobalInfo(printOption, dataObjectList, resultFile);
hwpFormatWriter.writeGlobalInfo(resultFile, dataObjectList, printOption, printUtil);
HWPWriter.toFile(resultFile, resultHwpPath);
//데이터 건별 처리
@ -174,7 +206,19 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
if(dataIndex < dataObjectList.size()) {
DataObject dataObject = dataObjectList.get(dataIndex);
printUtil.setBySingleData(printOption, dataObject, resultFile);
if(formatType.equals("list")) {
InputStream attachFormatIS = new ClassPathResource(printUtil.getAttachFormatFilePath()).getInputStream();
HWPFile attachFormatFile = HWPReader.fromInputStream(attachFormatIS);
hwpFormatWriter.writeSingleDataInfo(null, attachFormatFile, dataObject, printUtil);
AddUtil.insertTableInCell(attachFormatFile, resultFile, "내부");
} else {
hwpFormatWriter.writeSingleDataInfo(resultFile, null, dataObject, printUtil);
}
}
if(formatType.equals("list")) {
@ -222,9 +266,156 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
public Map<String, String> makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds) {
Map<String, String> result = new HashMap<>();
SprtQuery sprtQuery = new SprtQuery();
sprtQuery.setCrdnIDs(crdnIds);
List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery);
try {
String otptPaperSeCd = printOption.getOtptPaperSeCd();
PDFPrintUtil pdfPrintUtil = new PDFPrintUtil();
UserInfo userInfo = currentUser();
factionBean.initUserInfo(userInfo);
pdfPrintUtil.setPrintRequestUserInfo(userInfo);
//
pdfPrintUtil.setting(otptPaperSeCd);
String resultFilePath = pdfPrintUtil.filePathForNewFile();
PDDocument doc = new PDDocument();//pdf문서 생성
//폰트 로드
Map<String, PDType0Font> fontMap = Map.of(
"notokrBold", PDType0Font.load(doc, new ClassPathResource("fonts/notokr-bold.ttf").getInputStream()),
"gulim", PDType0Font.load(doc, new ClassPathResource("fonts/gulim.ttf").getInputStream()),
"gulimche", PDType0Font.load(doc, new ClassPathResource("fonts/gulimche.ttf").getInputStream()),
"batang", PDType0Font.load(doc, new ClassPathResource("fonts/batang.ttf").getInputStream()),
"batangche", PDType0Font.load(doc, new ClassPathResource("fonts/batangche.ttf").getInputStream()),
"dotum", PDType0Font.load(doc, new ClassPathResource("fonts/dotum.ttf").getInputStream()),
"dotumche", PDType0Font.load(doc, new ClassPathResource("fonts/dotumche.ttf").getInputStream()),
"gungsuh", PDType0Font.load(doc, new ClassPathResource("fonts/gungsuh.ttf").getInputStream()),
"gungsuhche", PDType0Font.load(doc, new ClassPathResource("fonts/gungsuhche.ttf").getInputStream())
);
//용지 크기 설정
PDRectangle paper = null;
if(otptPaperSeCd.equals("01")) {
paper = PDRectangle.A4;
} else {
paper = PDRectangle.LETTER;
}
float paperWidth = paper.getWidth();
float paperHeight = paper.getHeight();
OtptStngQuery otptStngQuery = new OtptStngQuery();
otptStngQuery.setSggCd((String) pdfPrintUtil.getPrintRequestUserInfo().getInfo().get("SGG_CD"));
otptStngQuery.setTaskSeCd(printOption.getTaskSeCd());
String sndngSeCd = "";
if(formatName.equals("advntce")) {
sndngSeCd = "02";
}
otptStngQuery.setSndngSeCd(sndngSeCd);
otptStngQuery.setOtptPaperSeCd(otptPaperSeCd);
List<DataObject> otptStng = otptStngMapper.selectOtptStngList(otptStngQuery);
for(DataObject dataObject : dataObjectList) {
//페이지생성(건별)
PDPage blankPage = new PDPage(paper);
doc.addPage(blankPage);
// 작업 페이지 설정
PDPage page = doc.getPage(doc.getNumberOfPages()-1);
// 컨텐츠 스트림 열기
PDPageContentStream contentStream = new PDPageContentStream(doc, page);
//접는곳 점선 그리기
pdfPrintUtil.renderFoldLine(contentStream, paperWidth, paperHeight);
//이미지 그리기
//단속 이미지 로드(건별)
//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);
//직인
//float[] offcsLocation = {300, 50};
//float offcsSize = 20;
//contentStream.drawImage(offcsImage, offcsLocation[0], offcsLocation[1], offcsSize, offcsSize);
//지자체로고
//contentStream.drawImage(logoImage, ?, ?, logoWidth, logoHeight);
//배경 이미지
//contentStream.drawImage(pdImage, 0, 0, paperWidth, paperHeight);
for(DataObject otptItemStng : otptStng) {
String otptNm = otptItemStng.string("OTPT_NM");
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();
}
doc.save(resultFilePath);
doc.close();
result.put("fileName", "사전통지서.pdf");
result.put("filePath", resultFilePath);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException();
}
return result;
}

@ -384,11 +384,9 @@ public class Sprt01Controller extends ApplicationController {
/** PDF .
* @return PDF
*/
public ModelAndView makeAdvntcePdf(String[] crdnIds) {
public ModelAndView makeAdvntcePdf(PrintOption printOption, String[] crdnIds) {
ModelAndView mav = new ModelAndView("jsonView");
PrintOption printOption = new PrintOption();
Map<String,String> result = sprt01Service.makePdfFile("info", "advntce", printOption, crdnIds);
mav.addAllObjects(result);
@ -399,11 +397,9 @@ public class Sprt01Controller extends ApplicationController {
/** txt, .
* @return
*/
public ModelAndView makeAdvntceOutsourcing(String[] crdnIds) {
public ModelAndView makeAdvntceOutsourcing(PrintOption printOption, String[] crdnIds) {
ModelAndView mav = new ModelAndView("jsonView");
PrintOption printOption = new PrintOption();
Map<String,String> result = sprt01Service.makeOutsourcingFile("advntce", printOption, crdnIds);
mav.addAllObjects(result);

@ -422,14 +422,14 @@ public class CmnController {
@Override
@RequestMapping(name="사전통지서 pdf 파일 생성", value=METHOD_URL.makeAdvntcePdf)
public ModelAndView makeAdvntcePdf(String... crdnIds) {
return super.makeAdvntcePdf(crdnIds);
public ModelAndView makeAdvntcePdf(PrintOption printOption, String... crdnIds) {
return super.makeAdvntcePdf(printOption, crdnIds);
}
@Override
@RequestMapping(name="사전통지서 외주 파일 생성", value=METHOD_URL.makeAdvntceOutsourcing)
public ModelAndView makeAdvntceOutsourcing(String... crdnIds) {
return super.makeAdvntceOutsourcing(crdnIds);
public ModelAndView makeAdvntceOutsourcing(PrintOption printOption, String... crdnIds) {
return super.makeAdvntceOutsourcing(printOption, crdnIds);
}
}

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.fims.sprt.dao.OtptStngMapper">
<select id="" parameterType="cokr.xit.fims.sprt.OtptStngQuery" resultType="dataobject">
/* 출력 설정 조회(otptStngMapper.selectOtptStngList) */
SELECT OTPT_FORM_ID
, SGG_CD
, TASK_SE_CD
, SNDNG_SE_CD
, OTPT_PAPER_SE_CD
, COL_NM
, OTPT_NM
, OTPT_BSC_VL
, LEFT_PSTN
, TOP_PSTN
, WIDTH_SZ
, HEIGHT_SZ
, FONT_NM
, FONT_SZ
, FONT_COLOR
, FONT_STYLE
FROM TB_OTPT_FORM
WHERE USE_YN = 'Y'
AND SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
AND SNDNG_SE_CD = #{sndngSeCd}
AND OTPT_PAPER_SE_CD = #{otptPaperSeCd}
</mapper>

@ -620,6 +620,18 @@ integrationSearch.provide = {
}
return null;
},
"isAllSameTask" : function(crdnIdArr){
var upArr = integrationSearchControl.updataset.getDataset();
var downArr = integrationSearchControl.downdataset.getDataset();
var unionArr = [...upArr, ...downArr];
var filtered = unionArr.filter(item => crdnIdArr.includes(item.CRDN_ID));
var taskSeCd = filtered[0].TASK_SE_CD;
var result = filtered.every(item => item.TASK_SE_CD == taskSeCd);
return result;
}
};
/**************************************************************************

@ -80,6 +80,7 @@ pageObject["${pageName}"].provided = {};
pageObject.childReq = [];
pageObject.childReq.push({
getInfo : function(){ return null; },
isAllSameTask : function(){ return false; }
});
$(document).ready(function(){
@ -108,6 +109,14 @@ $(document).ready(function(){
$P.fnMakeFile = (fileType) => {
if(!customValidate($("#frmEdit--${pageName} input"))) return;
if(!$P.provided.isAllSameTask($P.crdnIds)){
alert("여러 건 출력시 과태료업무가 동일한 자료만 처리 가능합니다.")
return;
}
var sample = $P.crdnIds[0]; //체크된것중첫번째
var taskSeCd = $P.provided.getInfo(sample).TASK_SE_CD;
var url = "";
if(fileType == "pdf"){
@ -115,14 +124,21 @@ $(document).ready(function(){
} else if(fileType == "outsourcing"){
url = wctx.url("/sprt/sprt01/140/makeAdvntceOutsourcing.do");
}
var formFields = new FimsFormFields("#frmEdit--${pageName}");
var globalVariable = formFields.get();
var submitParam = {
crdnIds : $P.crdnIds.join(","),
taskSeCd : taskSeCd
};
if(fileType == "pdf" || fileType == "preview"){
submitParam.otptPaperSeCd = "01";
}
ajax.post({
url : url,
data : {
crdnIds : $P.crdnIds.join(",")
},
data : submitParam,
success : (resp) => {
if(resp.filePath != null && resp.filePath != ""){
var a = document.createElement("a");

Loading…
Cancel
Save