package kcc.utill; import org.json.simple.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; import org.springframework.ui.ModelMap; import com.fasterxml.jackson.core.io.JsonStringEncoder; import com.google.gson.JsonObject; @Component public class OzUtill { @Value("#{globalSettings['oz.ozServerNm']}") private String ozServerNm; private static final Logger LOGGER = LoggerFactory.getLogger(OzUtill.class); public OzUtill() { } /** * @methodName : ozReportOdi * @author : JunHo Lee * @date : 2024.09.13 * @description : * @param model * @param connectionReportname // ozr파일 경로(repositories 이후 경로) ex) '/kofair2024/odi_test.ozr' * @param exportApplyformat // 파일다운로드 확장자-구분자는 ','로 필요확장자 추가 ex) hwp,pdf * @param exportFilename // 파일다운로드 파일명 * @param query // 쿼리 */ public void ozReportOdi( ModelMap model , String connectionReportname // ozr파일 경로(repositories 이후 경로) ex) '/kofair2024/odi_test.ozr' , String exportApplyformat // 파일다운로드 확장자-구분자는 ','로 필요확장자 추가 ex) hwp,pdf , String exportFilename // 파일다운로드 파일명 , String query // 쿼리 ) { // oz.sendToActionScript("connection.reportname", "/kofair2024/odi_test.ozr"); // oz.sendToActionScript('export.applyformat', 'hwp'); //파일 다운로드 확장자 지정 // oz.sendToActionScript('export.filename', '테스트'); //다운로드 파일 이름 지정 // oz.sendToActionScript("odi.kofair.args1", "queryTest=SELECT 'test1' AS \"컬럼1\", 'test2' AS \"컬럼2\", 'test3' AS \"컬럼3\", 'test4' AS \"컬럼4\", 'test5' AS \"컬럼5\", 'test6' AS \"컬럼6\", 'test7' AS \"컬럼7\", 'test8' AS \"컬럼8\", 'test9' AS \"컬럼9\", 'test10' AS \"컬럼10\", 'test11' AS \"컬럼11\", 'test12' AS \"컬럼12\", 'test13' AS \"컬럼13\", 'test14' AS \"컬럼14\", 'test15' AS \"컬럼15\", 'test16' AS \"컬럼16\", 'test17' AS \"컬럼17\", 'test18' AS \"컬럼18\", 'test19' AS \"컬럼19\", 'test20' AS \"컬럼20\", 'test21' AS \"컬럼21\", 'test22' AS \"컬럼22\", 'test23' AS \"컬럼23\", 'test24' AS \"컬럼24\", 'test25' AS \"컬럼25\", 'test26' AS \"컬럼26\", 'test27' AS \"컬럼27\", 'test28' AS \"컬럼28\", 'test29' AS \"컬럼29\", 'test30' AS \"컬럼30\", 'test31' AS \"컬럼31\", 'test32' AS \"컬럼32\", 'test33' AS \"컬럼33\", 'test34' AS \"컬럼34\", 'test35' AS \"컬럼35\", 'test36' AS \"컬럼36\", 'test37' AS \"컬럼37\", 'test38' AS \"컬럼38\", 'test39' AS \"컬럼39\", 'test40' AS \"컬럼40\", 'test41' AS \"컬럼41\", 'test42' AS \"컬럼42\", 'test43' AS \"컬럼43\", 'test44' AS \"컬럼44\", 'test45' AS \"컬럼45\", 'test46' AS \"컬럼46\", 'test47' AS \"컬럼47\", 'test48' AS \"컬럼48\", 'test49' AS \"컬럼49\", 'test50' AS \"컬럼50\" FROM dual"); // 첫번째 odi패러미터의 이름=값 //오즈서버 주소 model.addAttribute("ozServerNm", ozServerNm); // connectionReportname // exportApplyformat // exportFilename // odiKofairArgs1 model.addAttribute("connectionReportname", connectionReportname); model.addAttribute("exportApplyformat", exportApplyformat); model.addAttribute("exportFilename", exportFilename); model.addAttribute("odiKofairArgs1", query); } public void ozReportJson( JSONObject obj , ModelMap model ) { /* * 개행 오류 수정 * */ JsonStringEncoder encoder = JsonStringEncoder.getInstance(); char[] escapedJson = encoder.quoteAsString(obj.toJSONString()); System.out.println(escapedJson); // {\"type\":\"BIG\"} String p_json = new String(escapedJson); p_json = p_json.replace("\\\\\\\\r\\\\\\\\n", "\\\\r\\\\n").replace("\'", "\\'"); model.addAttribute("jsonData", p_json); //전체 통합 정보 /* * 개행 오류 수정 끝 * */ //오즈서버 주소 model.addAttribute("ozServerNm", ozServerNm); } }