Merge branch 'tolag3'

This commit is contained in:
leejunho 2025-01-07 19:34:37 +09:00
parent efa91f8065
commit 563da2ebd7

View File

@ -1,6 +1,10 @@
package seed.com.gtm.base; package seed.com.gtm.base;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -27,6 +31,10 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.clipsoft.clipreport.export.option.PDFOption;
import com.clipsoft.clipreport.oof.OOFDocument;
import com.clipsoft.clipreport.oof.OOFFile;
import egovframework.rte.psl.dataaccess.util.EgovMap; import egovframework.rte.psl.dataaccess.util.EgovMap;
import seed.com.gtm.code.CodeService; import seed.com.gtm.code.CodeService;
import seed.com.gtm.join.MemberJoinService; import seed.com.gtm.join.MemberJoinService;
@ -784,4 +792,58 @@ public class BaseController {
//params.put("gwId", tmap.get("MEMBER_ID").toString()); //params.put("gwId", tmap.get("MEMBER_ID").toString());
//params.put("gwId", tmap.get("MEMBER_ITEM_F6").toString()); //params.put("gwId", tmap.get("MEMBER_ITEM_F6").toString());
} }
@RequestMapping(value = "/clip/{pageFolder}/{pageName}/ClipReport4PdfDown2.do")
public void ClipReport4PdfDown2(HttpServletRequest request,HttpServletResponse response,
HttpSession session, Map<String, Object> map,
@PathVariable(value="pageFolder") String pageFolder,
@PathVariable(value="pageName") String pageName) throws Exception {
request.setCharacterEncoding("UTF-8");
// ReportUtil.createEx
String propertyPath = request.getSession().getServletContext().getRealPath("/") + "WEB-INF" + File.separator + "clipreport4" + File.separator + "clipreport4.properties";
String crfNm = request.getParameter("crfNm");
OOFDocument oof = OOFDocument.newOOF();
OOFFile file = oof.addFile("crf.root", "%root%/crf/"+crfNm+".crf");
// oof.addConnectionData("*","oracle1");
oof.addConnectionData("*","XE");
// String requestQuery = URLDecoder.decode(request.getQueryString());
String requestQuery = URLDecoder.decode(session.getAttribute("query_clip").toString());
String[] queryList = requestQuery.split("&");
for(int i=0; i<queryList.length; i++) {
String[] query = queryList[i].split("=");
if (query[0].startsWith("CLIPDATA_")) {
if(query.length == 2) {
oof.addField(query[0], query[1]);
} else if(query.length == 1) {
oof.addField(query[0], "");
}
}
}
PDFOption pdfOption = new PDFOption();
// com.clipsoft.clipreport.server.service.ClipReportExport.createExportForPDF(request, response.getOutputStream(), propertyPath, oof, pdfOption);
// com.clipsoft.clipreport.server.service.ClipReportExport.createExportForPDF(request, new FileOutputStream("test"), propertyPath, oof, pdfOption);
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=\"report.pdf\"");
response.setCharacterEncoding("UTF-8");
// HttpServletResponse의 OutputStream 사용
try (OutputStream outputStream = response.getOutputStream()) {
int errorType = com.clipsoft.clipreport.server.service.ClipReportExport.createExportForPDF(request, outputStream, propertyPath, oof, pdfOption);
if (errorType != 0) {
throw new RuntimeException("PDF 생성 중 오류 발생: ErrorType " + errorType);
}
}
// return "";
}
} }