fix: 검색유통에서 사업검색 시 시험항목에서 현장시험 내 현장수압시험과 현탕투수시험 필터링 안 되는 버그 수정

main
thkim 2025-08-19 15:41:21 +09:00
parent 52e885fb51
commit 2d6bfce180
9 changed files with 303 additions and 19 deletions

View File

@ -73,6 +73,13 @@
<dependencies>
<!-- Swagger API Annotation -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.22</version>
</dependency>
<!-- SMS -->
<dependency>
<groupId>org.apache.ws.xmlrpc</groupId>

View File

@ -0,0 +1,118 @@
package geoinfo.api.geoinfo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import java.util.Date;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import geoinfo.api.geoinfo.service.GeoinfoApiV1Service;
import geoinfo.util.MyUtil;
@Controller
@RequiredArgsConstructor
@RequestMapping("/api/geoinfo/v1")
public class GeoinfoApiV1Controller {
private final Logger logger = LoggerFactory.getLogger(GeoinfoApiV1Controller.class);
@Autowired
GeoinfoApiV1Service geoinfoApiV1Service;
/**
* GeoInfo API .
* URL .
* @param serviceName URL (: abc, def)
* @param request HttpServletRequest
* @param strJSON JSON
* @param response HttpServletResponse
* @return JSONObject
*/
@ApiOperation(value = "GeoInfo API 서비스 통합 엔드포인트", notes = "URL 경로에 지정된 서비스명에 따라 적절한 비즈니스 로직을 동적으로 처리합니다.<br />" +
"- 요청 본문(body)에 JSON 형식의 파라미터를 전달해야 합니다.<br />" +
"- 예시 URL: /api/geoinfo/v1/getProjectInfo.do, /api/geoinfo/v1/getBoreholeInfo.do<br />" +
"- 변경자명 : 김종훈<br />" +
"- 변경일자 : 2025.08.14")
@RequestMapping(value = "/{spName}.do", method = RequestMethod.GET)
@ResponseBody
public JSONObject handleApiService(
@ApiParam(value = "URL 경로에 포함된 서비스 이름", required = true, example = "getProjectInfo") @PathVariable("spName") String spName,
HttpServletRequest request,
@RequestParam HashMap<String, String> params,
HttpServletResponse response) {
JSONObject jsonResponse = new JSONObject();
// 2. HashMap을 사용하여 JSONObject 생성
JSONObject jsonObject = new JSONObject();
for (HashMap.Entry<String, String> entry : params.entrySet()) {
if ("".equals(entry.getValue())) {
entry.setValue(null);
jsonObject.put(entry.getKey(), entry.getValue());
}
}
// 3. toJSONString() 메서드로 JSON 문자열 출력
String jsonString = jsonObject.toJSONString();
logger.info("\n--------------------------------------------------------------\n" +
request.getRequestURI() + " IN:" +
"\n--------------------------------------------------------------\n" +
"procedure Name: " + spName + "\n" +
"Request params: \n" + jsonString + "\n" +
"\n--------------------------------------------------------------\n"
);
JSONParser jsonParser = new JSONParser();
JSONArray jsonArr = null;
try {
geoinfoApiV1Service.handleApiService(request, params, spName, jsonResponse);
} catch (Exception e) {
// TODO Auto-generated catch block
String strTxt =
"---------- BUG REPORTING START ----------" + "\n" +
"에러 문구:[" + request.getRequestURI() + " " + "]" + "\n" +
"jsonString:[\n" + jsonString + "\n]\n" +
"e.getMessage():[\n" + e.getMessage() + "\n]\n" + "\n" +
"new Date().toString():[" + new Date().toString() + "]\n" + "\n" +
"---------- BUG REPORTING END ----------" + "\n" +
"";
System.out.println(strTxt);
jsonResponse.put("resultCode", -1);
jsonResponse.put("result", "false");
jsonResponse.put("message", e.getMessage());
}
logger.info("\n--------------------------------------------------------------\n" +
request.getRequestURI() + " OUT:" +
"\n--------------------------------------------------------------\n" +
"Response JSON: [" + jsonResponse.toJSONString() + "]\n" +
"\n--------------------------------------------------------------\n");
return jsonResponse;
}
}

View File

@ -0,0 +1,16 @@
package geoinfo.api.geoinfo.service;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import egovframework.rte.psl.dataaccess.util.EgovMap;
@Mapper("geoinfoApiV1Mapper")
public interface GeoinfoApiV1Mapper {
public ArrayList<EgovMap> spGetTblProjectInfo(HashMap<String, String> params) throws SQLException;
}

View File

@ -0,0 +1,12 @@
package geoinfo.api.geoinfo.service;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import org.json.simple.JSONObject;
public interface GeoinfoApiV1Service {
int handleApiService(HttpServletRequest request, HashMap<String, String> params, String spName, JSONObject jsonResponse) throws Exception;
}

View File

@ -0,0 +1,74 @@
package geoinfo.api.geoinfo.service.impl;
import geoinfo.api.geoinfo.service.GeoinfoApiV1Mapper;
import geoinfo.api.geoinfo.service.GeoinfoApiV1Service;
import geoinfo.drilling.input.service.DrillingInputMapper;
import geoinfo.drilling.input.service.DrillingInputService;
import geoinfo.drilling.inquiry.service.DrillingInquiryService;
import geoinfo.main.login.service.LoginMapper;
import geoinfo.util.MyUtil;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import egovframework.rte.psl.dataaccess.util.EgovMap;
@Service("geoinfoApiV1Service")
public class GeoinfoApiV1ServiceImpl implements GeoinfoApiV1Service {
@Resource(name="geoinfoApiV1Mapper")
private GeoinfoApiV1Mapper geoinfoApiV1Mapper;
public int handleApiService(HttpServletRequest request, HashMap<String, String> params, String spName, JSONObject jsonResponse) throws Exception {
//호출 프로시저 유효성 체크
spName = spName.trim();
// 서비스 이름에 따라 분기 처리
HashMap<String, Object> resultMap = null;
int nRetCode = -1;
String lpszRetMsg = null;
if ("sp-get-tbl-project-info".equalsIgnoreCase(spName)) {
ArrayList<EgovMap> hashMapList = geoinfoApiV1Mapper.spGetTblProjectInfo(params);
jsonResponse.put("data", hashMapList);
//nRetCode = MyUtil.getIntegerFromObject(hashMap.get("v_RetCode"));
//lpszRetMsg = MyUtil.getStringFromObject(hashMap.get("v_RetMsg"));
} else if ("def".equalsIgnoreCase(spName)) {
} else {
// 지원하지 않는 서비스명인 경우 오류 처리
throw new Exception("Unsupported service name: " + spName);
}
if( false ) {
if( nRetCode == 100 ) {
jsonResponse.put("resultCode", nRetCode);
jsonResponse.put("result", "true");
jsonResponse.put("message", "SUCCESS");
} else {
jsonResponse.put("resultCode", nRetCode);
jsonResponse.put("result", "false");
jsonResponse.put("message", lpszRetMsg);
}
}
return nRetCode;
}
}

View File

@ -106,6 +106,7 @@ public class DrillingInputServiceImpl implements DrillingInputService {
//String[] words = projectMasterCompanyName.split(" ");
//String lastWord = words[words.length - 1];
//spGetMasterCompanyDistrictParams.put("projectMasterCompanyName", lastWord);
projectMasterCompanyName = projectMasterCompanyName.trim();
spGetMasterCompanyDistrictParams.put("projectMasterCompanyName", projectMasterCompanyName);
drillingInputMapper.spGetMasterCompanyDistrict(spGetMasterCompanyDistrictParams);

View File

@ -0,0 +1,56 @@
<?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="geoinfo.api.geoinfo.service.GeoinfoApiV1Mapper">
<!--
Oracle 테이블 반환 함수(SP_GET_TBL_PROJECT_INFO)를 호출하는 MyBatis 쿼리입니다.
- id: 서비스 레이어에서 호출할 쿼리의 고유 식별자입니다.
-->
<select id="spGetTblProjectInfo" parameterType="map" resultType="egovMap">
SELECT * FROM TABLE(SP_GET_TBL_PROJECT_INFO(
#{prjCode, jdbcType=VARCHAR},
#{prjName, jdbcType=VARCHAR},
#{mastCompany, jdbcType=VARCHAR},
#{addr, jdbcType=VARCHAR},
#{startDate, jdbcType=VARCHAR},
#{endDate, jdbcType=VARCHAR}
))
</select>
<!--
Oracle 함수(SP_CNT_TBL_PROJECT_INFO)를 호출하여 조건에 맞는 프로젝트 정보의 총 개수를 반환합니다.
-->
<select id="spCntTblProjectInfo" parameterType="map" resultType="int">
SELECT SP_CNT_TBL_PROJECT_INFO(
#{prjCode, jdbcType=VARCHAR},
#{prjName, jdbcType=VARCHAR},
#{mastCompany, jdbcType=VARCHAR},
#{addr, jdbcType=VARCHAR},
#{startDate, jdbcType=VARCHAR},
#{endDate, jdbcType=VARCHAR}
) FROM DUAL
</select>
<!--
Oracle 함수(SP_GET_ADDR_BY_ADDRCODE)를 호출하여 주소 코드를 전체 주소 문자열로 변환합니다.
-->
<select id="spGetAddrByAddrCode" parameterType="map" resultType="String">
SELECT SP_GET_ADDR_BY_ADDRCODE(
#{prjCode, jdbcType=VARCHAR},
#{addrCode, jdbcType=VARCHAR}
) FROM DUAL
</select>
<!--
Oracle 테이블 반환 함수(SP_GET_SELECTCLASS_INFO_P)를 호출하여 프로젝트와 관련된 각 테이블의 데이터 개수를 조회합니다.
- resultType: "egovMap"으로 설정하여 결과 행을 Map 객체로 받습니다.
-->
<select id="spGetSelectclassInfoP" parameterType="map" resultType="egovMap">
SELECT * FROM TABLE(SP_GET_SELECTCLASS_INFO_P(
#{projCode, jdbcType=VARCHAR}
))
</select>
</mapper>

View File

@ -87,12 +87,12 @@
<!-- 현장수압시험 -->
<if test="waterpressure == 'on'">
AND EXISTS (SELECT 1 FROM TBL_FIELD_PERMEABILITY C WHERE B.HOLE_CODE = C.HOLE_CODE )
AND EXISTS (SELECT 1 FROM TBL_FIELD_WATERPRESSURE C WHERE B.HOLE_CODE = C.HOLE_CODE )
</if>
<!-- 현장투수시험 -->
<if test="permeability == 'on'">
AND EXISTS (SELECT 1 FROM TBL_FIELD_WATERPRESSURE C WHERE B.HOLE_CODE = C.HOLE_CODE )
AND EXISTS (SELECT 1 FROM TBL_FIELD_PERMEABILITY C WHERE B.HOLE_CODE = C.HOLE_CODE )
</if>
<!-- 점하중 -->
@ -276,13 +276,13 @@
<!-- 현장수압시험 -->
<if test="waterpressure == 'on'">
UNION ALL
SELECT DISTINCT HOLE_CODE FROM TBL_FIELD_PERMEABILITY
SELECT DISTINCT HOLE_CODE FROM TBL_FIELD_WATERPRESSURE
</if>
<!-- 현장투수시험 -->
<if test="permeability == 'on'">
UNION ALL
SELECT DISTINCT HOLE_CODE FROM TBL_FIELD_WATERPRESSURE
SELECT DISTINCT HOLE_CODE FROM TBL_FIELD_PERMEABILITY
</if>
<!-- 점하중 -->
@ -496,12 +496,12 @@
<!-- 현장수압시험 -->
<if test="waterpressure == 'on'">
AND EXISTS (SELECT 1 FROM TBL_FIELD_PERMEABILITY C WHERE B.HOLE_CODE = C.HOLE_CODE )
AND EXISTS (SELECT 1 FROM TBL_FIELD_WATERPRESSURE C WHERE B.HOLE_CODE = C.HOLE_CODE )
</if>
<!-- 현장투수시험 -->
<if test="permeability == 'on'">
AND EXISTS (SELECT 1 FROM TBL_FIELD_WATERPRESSURE C WHERE B.HOLE_CODE = C.HOLE_CODE )
AND EXISTS (SELECT 1 FROM TBL_FIELD_PERMEABILITY C WHERE B.HOLE_CODE = C.HOLE_CODE )
</if>
<!-- 점하중 -->
@ -685,13 +685,13 @@
<!-- 현장수압시험 -->
<if test="waterpressure == 'on'">
UNION ALL
SELECT DISTINCT HOLE_CODE FROM TBL_FIELD_PERMEABILITY
SELECT DISTINCT HOLE_CODE FROM TBL_FIELD_WATERPRESSURE
</if>
<!-- 현장투수시험 -->
<if test="permeability == 'on'">
UNION ALL
SELECT DISTINCT HOLE_CODE FROM TBL_FIELD_WATERPRESSURE
SELECT DISTINCT HOLE_CODE FROM TBL_FIELD_PERMEABILITY
</if>
<!-- 점하중 -->