diff --git a/src/main/java/geoinfo/api/geoinfo/GeoinfoApiV1Controller.java b/src/main/java/geoinfo/api/geoinfo/GeoinfoApiV1Controller.java index 47e30fe7..a5f76cd6 100644 --- a/src/main/java/geoinfo/api/geoinfo/GeoinfoApiV1Controller.java +++ b/src/main/java/geoinfo/api/geoinfo/GeoinfoApiV1Controller.java @@ -51,7 +51,8 @@ public class GeoinfoApiV1Controller { "- 예시 URL: /api/geoinfo/v1/getProjectInfo.do, /api/geoinfo/v1/getBoreholeInfo.do
" + "- 변경자명 : 김종훈
" + "- 변경일자 : 2025.08.14") - @RequestMapping(value = "/{spName}.do", method = RequestMethod.GET) +// @RequestMapping(value = "/{spName}.do", method = RequestMethod.GET) + @RequestMapping(value = "/{spName:^(?!borehole-log$).+}.do", method = RequestMethod.GET) @ResponseBody public JSONObject handleApiService( @ApiParam(value = "URL 경로에 포함된 서비스 이름", required = true, example = "getProjectInfo") @PathVariable("spName") String spName, @@ -115,4 +116,41 @@ public class GeoinfoApiV1Controller { return jsonResponse; } + + + @RequestMapping(value = "/borehole-log.do", method = RequestMethod.GET) + public void getBoreholeLogPdf( + @RequestParam String holeCode, + @RequestParam HashMap params, + HttpServletResponse response) throws Exception { + int validApiKey = 0; + validApiKey = geoinfoApiV1Service.isValidWebApiKey(params); + + if (validApiKey != 1) { + JSONObject jsonResponse = new JSONObject(); + if (validApiKey == -1) { + jsonResponse.put("resultCode", -1); + jsonResponse.put("result", "false"); + jsonResponse.put("message", "미승인 API키 입니다."); + } else if (validApiKey == -2) { + jsonResponse.put("resultCode", -2); + jsonResponse.put("result", "false"); + jsonResponse.put("message", "기간이 만료된 API키 입니다."); + } else { // validApiKey == 0 + jsonResponse.put("resultCode", 0); + jsonResponse.put("result", "false"); + jsonResponse.put("message", "등록되지 않은 API키 입니다."); + } + // JSON 반환 설정 + response.setContentType("application/json; charset=UTF-8"); + response.getWriter().write(jsonResponse.toJSONString()); + return; + } + + + // 3. API Key 정상일 경우 PDF URL로 리디렉션 실행 + String redirectUrl = "/ClipReport4/export/exportForPDF_Jusangdo.jsp?data=" + holeCode; + + response.sendRedirect(redirectUrl); + } } diff --git a/src/main/java/geoinfo/api/geoinfo/service/GeoinfoApiV1Mapper.java b/src/main/java/geoinfo/api/geoinfo/service/GeoinfoApiV1Mapper.java index 9fdd3a1c..2beb2786 100644 --- a/src/main/java/geoinfo/api/geoinfo/service/GeoinfoApiV1Mapper.java +++ b/src/main/java/geoinfo/api/geoinfo/service/GeoinfoApiV1Mapper.java @@ -134,4 +134,7 @@ public interface GeoinfoApiV1Mapper { public int spCntTblRockReptTriU(HashMap params) throws SQLException; public ArrayList spGetTblRockReptTri(HashMap params) throws SQLException; public int spCntTblRockReptTri(HashMap params) throws SQLException; + + // API Key 검증 + public int spIsValidWebApiKeyId(HashMap params) throws SQLException; } diff --git a/src/main/java/geoinfo/api/geoinfo/service/GeoinfoApiV1Service.java b/src/main/java/geoinfo/api/geoinfo/service/GeoinfoApiV1Service.java index a30b8420..d66f638f 100644 --- a/src/main/java/geoinfo/api/geoinfo/service/GeoinfoApiV1Service.java +++ b/src/main/java/geoinfo/api/geoinfo/service/GeoinfoApiV1Service.java @@ -9,4 +9,5 @@ import org.json.simple.JSONObject; public interface GeoinfoApiV1Service { int handleApiService(HttpServletRequest request, HashMap params, String spName, JSONObject jsonResponse) throws Exception; + int isValidWebApiKey(HashMap params) throws Exception; } diff --git a/src/main/java/geoinfo/api/geoinfo/service/impl/GeoinfoApiV1ServiceImpl.java b/src/main/java/geoinfo/api/geoinfo/service/impl/GeoinfoApiV1ServiceImpl.java index 302ef3f7..553107c5 100644 --- a/src/main/java/geoinfo/api/geoinfo/service/impl/GeoinfoApiV1ServiceImpl.java +++ b/src/main/java/geoinfo/api/geoinfo/service/impl/GeoinfoApiV1ServiceImpl.java @@ -232,4 +232,9 @@ public class GeoinfoApiV1ServiceImpl implements GeoinfoApiV1Service { // 성공 코드 반환 return 0; } + + @Override + public int isValidWebApiKey(HashMap params) throws Exception { + return geoinfoApiV1Mapper.spIsValidWebApiKeyId(params); + } } diff --git a/src/main/resources/egovframework/sqlmap/mapper/api/geoinfo/GeoinfoApiV1Mapper.xml b/src/main/resources/egovframework/sqlmap/mapper/api/geoinfo/GeoinfoApiV1Mapper.xml index 3ed63778..2a248170 100644 --- a/src/main/resources/egovframework/sqlmap/mapper/api/geoinfo/GeoinfoApiV1Mapper.xml +++ b/src/main/resources/egovframework/sqlmap/mapper/api/geoinfo/GeoinfoApiV1Mapper.xml @@ -750,4 +750,10 @@ ) FROM DUAL + \ No newline at end of file