thkim 2025-11-14 14:30:20 +09:00
commit 695f4f03e8
29 changed files with 2892 additions and 445 deletions

32
pom.xml
View File

@ -83,11 +83,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>egovframework.rte</groupId>
<artifactId>egovframework.rte.psl.dataaccess</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>egovframework.rte</groupId>
<artifactId>egovframework.rte.fdl.idgnr</artifactId>
@ -351,12 +346,6 @@
<version>1.10</version>
</dependency>
<!-- EgovProperty -->
<dependency>
<groupId>egovframework.rte</groupId>
<artifactId>egovframework.rte.fdl.property</artifactId>
<version>2.7.0</version>
</dependency>
<!-- Log4j -->
<dependency>
@ -468,6 +457,27 @@
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Load from local system -->
<dependency>
<groupId>egovframework.rte</groupId>
<artifactId>egovframework.rte.psl.dataaccess</artifactId>
<version>2.7.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/egovframework.rte.psl.dataaccess-2.7.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>com.lowagie.itext</artifactId>
<version>2.1.7</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/itext-2.1.7.js2.jar</systemPath>
</dependency>
</dependencies>

View File

@ -1,5 +1,6 @@
package geoinfo.admins.apiManagement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -15,16 +16,16 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import egovframework.rte.psl.dataaccess.util.EgovMap;
import geoinfo.admins.apiManagement.service.ApiManagementService;
import geoinfo.admins.apiManagement.service.ApiInDataManagementService;
import geoinfo.comm.util.strUtil;
import geoinfo.session.UserInfo;
@Controller
public class ApiManagementController {
@Resource(name = "apiManagementService")
private ApiManagementService apiManagementService;
public class ApiInDataManagementController {
@Resource(name = "apiInDataManagementService")
private ApiInDataManagementService apiInDataManagementService;
/**
* API > API
@ -62,7 +63,7 @@ public class ApiManagementController {
HashMap<String, Object> result = new HashMap<String, Object>();
String CHART_DATE = sUtil.checkNull((String)params.get("chartDate"));
params.put("CHART_DATE", CHART_DATE);
EgovMap chartData = apiManagementService.selectDailyAccessCountByHour(params);
EgovMap chartData = apiInDataManagementService.selectDailyAccessCountByHour(params);
result.put("code", "SUCCESS");
result.put("msg", "일일접속량 데이터 조회를 성공했습니다.");
@ -70,6 +71,44 @@ public class ApiManagementController {
return result;
}
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApi/i_counts.do", method = RequestMethod.POST)
public HashMap<String, Object> getMgmtApiInDataCounts(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
strUtil sUtil = new strUtil();
HashMap<String, Object> result = new HashMap<String, Object>();
String STAT_TYPE = sUtil.checkNull((String)params.get("statType"));
String COUNT_FROM_DT = sUtil.checkNull((String)params.get("countFromDt"));
String COUNT_TO_DT = sUtil.checkNull((String)params.get("countToDt"));
params.put("COUNT_FROM_DT", COUNT_FROM_DT);
params.put("COUNT_TO_DT", COUNT_TO_DT);
List<?> countList = new ArrayList<>();
if("monthly".equals(STAT_TYPE)) {
countList = apiInDataManagementService.selectWebApiLogMonthlyCount(params);
} else if("yearly".equals(STAT_TYPE)) {
countList = apiInDataManagementService.selectWebApiLogYearlyCount(params);
} else { // daily(기본)
countList = apiInDataManagementService.selectWebApiLogDailyCount(params);
}
result.put("code", "SUCCESS");
result.put("msg", "일일접속량 데이터 조회를 성공했습니다.");
result.put("data", countList);
return result;
}
/**
* API > API
@ -85,7 +124,7 @@ public class ApiManagementController {
public HashMap<String, Object> getMgmtApiList(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
List<?> listData = apiManagementService.selectInfo(params);
List<?> listData = apiInDataManagementService.selectInfo(params);
result.put("code", "SUCCESS");
result.put("msg", "관리 API 목록 조회를 성공했습니다.");
@ -117,9 +156,9 @@ public class ApiManagementController {
params.put("idxArr", idxArr);
params.put("activeYn", activeYn);
apiManagementService.updateInfoStatus(params);
apiInDataManagementService.updateInfoStatus(params);
List<?> listData = apiManagementService.selectInfo(params);
List<?> listData = apiInDataManagementService.selectInfo(params);
result.put("code", "SUCCESS");
result.put("msg", "관리 API 목록 조회를 성공했습니다.");
@ -142,7 +181,7 @@ public class ApiManagementController {
public HashMap<String, Object> getMgmtApiLogList(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
List<?> listData = apiManagementService.selectWebApiLogList(params);
List<?> listData = apiInDataManagementService.selectWebApiLogList(params);
result.put("code", "SUCCESS");
result.put("msg", "API 호출 로그 목록 조회를 성공했습니다.");
@ -150,106 +189,5 @@ public class ApiManagementController {
return result;
}
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "admins/mgmtApi/mgmt-api-key.do")
public String goMgmtApiKey(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
if (!UserInfo.isValidSession(request, response, "admin")) {
return "";
}
model.addAttribute("params", params);
return "admins/mgmtApi/mgmt-api-key";
}
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApiKey/list.do", method = RequestMethod.POST)
public HashMap<String, Object> getMgmtApiKeyList(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
List<?> listData = apiManagementService.selectWebApiKeyList(params);
result.put("code", "SUCCESS");
result.put("msg", "API 신청 목록 조회를 성공했습니다.");
result.put("data", listData);
return result;
}
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApiKey/approve.do", method = RequestMethod.POST)
public HashMap<String, Object> modMgmtApiKeyApprove(@RequestParam(value="apiSeq") int apiSeq, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
HashMap<String,Object> params = new HashMap<>();
params.put("apiSeq", apiSeq);
params.put("approveYn", "Y");
apiManagementService.updateWebApiKeyApprove(params);
List<?> listData = apiManagementService.selectWebApiKeyList(params);
result.put("code", "SUCCESS");
result.put("msg", " API 신청 목록 조회를 성공했습니다.");
result.put("data", listData);
return result;
}
/**
* API > API .
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApiKey/revoke.do", method = RequestMethod.POST)
public HashMap<String, Object> modMgmtApiKeyRevoke(@RequestParam(value="apiSeq") int apiSeq, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
HashMap<String,Object> params = new HashMap<>();
params.put("apiSeq", apiSeq);
apiManagementService.deleteWebApiKey(params);
List<?> listData = apiManagementService.selectWebApiKeyList(params);
result.put("code", "SUCCESS");
result.put("msg", " API 신청 목록 조회를 성공했습니다.");
result.put("data", listData);
return result;
}
}

View File

@ -0,0 +1,133 @@
package geoinfo.admins.apiManagement;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 egovframework.rte.psl.dataaccess.util.EgovMap;
import geoinfo.admins.apiManagement.service.ApiKeyManagementService;
import geoinfo.comm.util.strUtil;
import geoinfo.session.UserInfo;
@Controller
public class ApiKeyManagementController {
@Resource(name = "apiKeyManagementService")
private ApiKeyManagementService apiKeyManagementService;
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "admins/mgmtApi/mgmt-api-key.do")
public String goMgmtApiKey(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
if (!UserInfo.isValidSession(request, response, "admin")) {
return "";
}
model.addAttribute("params", params);
return "admins/mgmtApi/mgmt-api-key";
}
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApiKey/list.do", method = RequestMethod.POST)
public HashMap<String, Object> getMgmtApiKeyList(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
List<?> listData = apiKeyManagementService.selectWebApiKeyList(params);
result.put("code", "SUCCESS");
result.put("msg", "API 신청 목록 조회를 성공했습니다.");
result.put("data", listData);
return result;
}
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApiKey/approve.do", method = RequestMethod.POST)
public HashMap<String, Object> modMgmtApiKeyApprove(
@RequestParam(value="seqArr", required=false) List<Integer> seqArr,
@RequestParam(value="approveYn", required=false) String approveYn,
@RequestParam(value="otype", required=false) String otype, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
HashMap<String,Object> params = new HashMap<>();
params.put("seqArr", seqArr);
params.put("approveYn", approveYn);
params.put("otype", otype);
apiKeyManagementService.updateWebApiKeyApprove(params);
List<?> listData = apiKeyManagementService.selectWebApiKeyList(params);
result.put("code", "SUCCESS");
result.put("msg", " API 신청 목록 조회를 성공했습니다.");
result.put("data", listData);
return result;
}
/**
* API > API .
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApiKey/revoke.do", method = RequestMethod.POST)
public HashMap<String, Object> modMgmtApiKeyRevoke(@RequestParam(value="apiSeq") int apiSeq, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
HashMap<String,Object> params = new HashMap<>();
params.put("apiSeq", apiSeq);
apiKeyManagementService.deleteWebApiKey(params);
List<?> listData = apiKeyManagementService.selectWebApiKeyList(params);
result.put("code", "SUCCESS");
result.put("msg", " API 신청 목록 조회를 성공했습니다.");
result.put("data", listData);
return result;
}
}

View File

@ -0,0 +1,192 @@
package geoinfo.admins.apiManagement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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 egovframework.rte.psl.dataaccess.util.EgovMap;
import geoinfo.admins.apiManagement.service.ApiOutDataManagementService;
import geoinfo.comm.util.strUtil;
import geoinfo.session.UserInfo;
@Controller
public class ApiOutDataManagementController {
@Resource(name = "apiOutDataManagementService")
private ApiOutDataManagementService apiOutDataManagementService;
/**
* API > API ( )
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "admins/mgmtApi/mgmt-api-outdata.do")
public String goMgmtApiOutdata(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
if (!UserInfo.isValidSession(request, response, "admin")) {
return "";
}
model.addAttribute("params", params);
return "admins/mgmtApi/mgmt-api-outdata";
}
/**
* API >
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApi/o_charts.do", method = RequestMethod.POST)
public HashMap<String, Object> getMgmtApiOutDataAccessChart(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
strUtil sUtil = new strUtil();
HashMap<String, Object> result = new HashMap<String, Object>();
String CHART_DATE = sUtil.checkNull((String)params.get("chartDate"));
params.put("CHART_DATE", CHART_DATE);
EgovMap chartData = apiOutDataManagementService.selectDailyAccessCountByHour(params);
result.put("code", "SUCCESS");
result.put("msg", "일일접속량 데이터 조회를 성공했습니다.");
result.put("data", chartData);
return result;
}
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApi/o_counts.do", method = RequestMethod.POST)
public HashMap<String, Object> getMgmtApiOutDataCounts(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
strUtil sUtil = new strUtil();
HashMap<String, Object> result = new HashMap<String, Object>();
String STAT_TYPE = sUtil.checkNull((String)params.get("statType"));
String COUNT_FROM_DT = sUtil.checkNull((String)params.get("countFromDt"));
String COUNT_TO_DT = sUtil.checkNull((String)params.get("countToDt"));
params.put("COUNT_FROM_DT", COUNT_FROM_DT);
params.put("COUNT_TO_DT", COUNT_TO_DT);
List<?> countList = new ArrayList<>();
if("monthly".equals(STAT_TYPE)) {
countList = apiOutDataManagementService.selectWebApiLogMonthlyCount(params);
} else if("yearly".equals(STAT_TYPE)) {
countList = apiOutDataManagementService.selectWebApiLogYearlyCount(params);
} else { // daily(기본)
countList = apiOutDataManagementService.selectWebApiLogDailyCount(params);
}
result.put("code", "SUCCESS");
result.put("msg", "일일접속량 데이터 조회를 성공했습니다.");
result.put("data", countList);
return result;
}
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApi/o_list.do", method = RequestMethod.POST)
public HashMap<String, Object> getMgmtApiOutDataList(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
List<?> listData = apiOutDataManagementService.selectInfo(params);
result.put("code", "SUCCESS");
result.put("msg", "관리 API 목록 조회를 성공했습니다.");
result.put("data", listData);
return result;
}
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApi/o_toggleSts.do", method = RequestMethod.POST)
public HashMap<String, Object> modMgmtApiOutDataActiveYn(
@RequestParam(value="idxArr") List<Integer> idxArr,
@RequestParam(value="activeYn", required=false) String activeYn, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
// String sIdxArr[] = params.get("idx").toString().split(",");
System.out.println("idxArr = " + idxArr);
System.out.println("activeYn = " + activeYn);
HashMap<String,Object> params = new HashMap<>();
params.put("idxArr", idxArr);
params.put("activeYn", activeYn);
apiOutDataManagementService.updateInfoStatus(params);
List<?> listData = apiOutDataManagementService.selectInfo(params);
result.put("code", "SUCCESS");
result.put("msg", "관리 API 목록 조회를 성공했습니다.");
result.put("data", listData);
return result;
}
/**
* API > API
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/admins/mgmtApi/o_logList.do", method = RequestMethod.POST)
public HashMap<String, Object> getMgmtApiOutDataLogList(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
List<?> listData = apiOutDataManagementService.selectWebApiLogList(params);
result.put("code", "SUCCESS");
result.put("msg", "API 호출 로그 목록 조회를 성공했습니다.");
result.put("data", listData);
return result;
}
}

View File

@ -0,0 +1,27 @@
package geoinfo.admins.apiManagement.service;
import java.util.HashMap;
import java.util.List;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import egovframework.rte.psl.dataaccess.util.EgovMap;
@Mapper("apiInDataManagementMapper")
public interface ApiInDataManagementMapper {
public EgovMap selectDailyAccessCountByHour(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogDailyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogMonthlyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogYearlyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectInfo(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogList(HashMap<String, Object> params) throws Exception;
public void saveInfo(HashMap<String, Object> params) throws Exception;
public void updateInfoStatus(HashMap<String, Object> params) throws Exception;
}

View File

@ -7,9 +7,15 @@ import egovframework.rte.psl.dataaccess.util.EgovMap;
public interface ApiManagementService {
public interface ApiInDataManagementService {
public EgovMap selectDailyAccessCountByHour(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogDailyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogMonthlyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogYearlyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectInfo(HashMap<String, Object> params) throws Exception;
@ -17,17 +23,6 @@ public interface ApiManagementService {
public void saveInfo(HashMap<String, Object> params) throws Exception;
// public EgovMap selectDetailInfo(HashMap<String, Object> params) throws Exception;
// public void deleteInfo(HashMap<String, Object> params) throws Exception;
// public EgovMap selectModifyInfo(HashMap<String, Object> params) throws Exception;
public void updateInfoStatus(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiKeyList(HashMap<String, Object> params) throws Exception;
public void updateWebApiKeyApprove(HashMap<String, Object> params) throws Exception;
public void deleteWebApiKey(HashMap<String, Object> params) throws Exception;
}

View File

@ -0,0 +1,17 @@
package geoinfo.admins.apiManagement.service;
import java.util.HashMap;
import java.util.List;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import egovframework.rte.psl.dataaccess.util.EgovMap;
@Mapper("apiKeyManagementMapper")
public interface ApiKeyManagementMapper {
public List<?> selectWebApiKeyList(HashMap<String, Object> params) throws Exception;
public void updateWebApiKeyApprove(HashMap<String, Object> params) throws Exception;
public void deleteWebApiKey(HashMap<String, Object> params) throws Exception;
}

View File

@ -0,0 +1,17 @@
package geoinfo.admins.apiManagement.service;
import java.util.HashMap;
import java.util.List;
import egovframework.rte.psl.dataaccess.util.EgovMap;
public interface ApiKeyManagementService {
public List<?> selectWebApiKeyList(HashMap<String, Object> params) throws Exception;
public void updateWebApiKeyApprove(HashMap<String, Object> params) throws Exception;
public void deleteWebApiKey(HashMap<String, Object> params) throws Exception;
}

View File

@ -6,10 +6,16 @@ import java.util.List;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import egovframework.rte.psl.dataaccess.util.EgovMap;
@Mapper("ApiManagementMapper")
public interface ApiManagementMapper {
@Mapper("apiOutDataManagementMapper")
public interface ApiOutDataManagementMapper {
public EgovMap selectDailyAccessCountByHour(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogDailyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogMonthlyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogYearlyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectInfo(HashMap<String, Object> params) throws Exception;
@ -17,17 +23,6 @@ public interface ApiManagementMapper {
public void saveInfo(HashMap<String, Object> params) throws Exception;
// public EgovMap selectDetailInfo(HashMap<String, Object> params) throws Exception;
// public void deleteInfo(HashMap<String, Object> params) throws Exception;
// public EgovMap selectModifyInfo(HashMap<String, Object> params) throws Exception;
public void updateInfoStatus(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiKeyList(HashMap<String, Object> params) throws Exception;
public void updateWebApiKeyApprove(HashMap<String, Object> params) throws Exception;
public void deleteWebApiKey(HashMap<String, Object> params) throws Exception;
}

View File

@ -0,0 +1,27 @@
package geoinfo.admins.apiManagement.service;
import java.util.HashMap;
import java.util.List;
import egovframework.rte.psl.dataaccess.util.EgovMap;
public interface ApiOutDataManagementService {
public EgovMap selectDailyAccessCountByHour(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogDailyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogMonthlyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogYearlyCount(HashMap<String, Object> params) throws Exception;
public List<?> selectInfo(HashMap<String, Object> params) throws Exception;
public List<?> selectWebApiLogList(HashMap<String, Object> params) throws Exception;
public void saveInfo(HashMap<String, Object> params) throws Exception;
public void updateInfoStatus(HashMap<String, Object> params) throws Exception;
}

View File

@ -0,0 +1,60 @@
package geoinfo.admins.apiManagement.service.impl;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import egovframework.rte.psl.dataaccess.util.EgovMap;
import geoinfo.admins.apiManagement.service.ApiInDataManagementMapper;
import geoinfo.admins.apiManagement.service.ApiInDataManagementService;
@Service("apiInDataManagementService")
public class ApiInDataManagementServiceImpl implements ApiInDataManagementService {
@Resource(name = "apiInDataManagementMapper")
private ApiInDataManagementMapper masterMapper;
@Override
public EgovMap selectDailyAccessCountByHour(HashMap<String, Object> params) throws Exception {
return masterMapper.selectDailyAccessCountByHour(params);
}
@Override
public List<?> selectWebApiLogDailyCount(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiLogDailyCount(params);
}
@Override
public List<?> selectWebApiLogMonthlyCount(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiLogMonthlyCount(params);
}
@Override
public List<?> selectWebApiLogYearlyCount(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiLogYearlyCount(params);
}
@Override
public List<?> selectInfo(HashMap<String, Object> params) throws Exception {
return masterMapper.selectInfo(params);
}
@Override
public List<?> selectWebApiLogList(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiLogList(params);
}
@Override
public void saveInfo(HashMap<String, Object> params) throws Exception {
masterMapper.saveInfo(params);
}
@Override
public void updateInfoStatus(HashMap<String, Object> params) throws Exception {
masterMapper.updateInfoStatus(params);
}
}

View File

@ -0,0 +1,35 @@
package geoinfo.admins.apiManagement.service.impl;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import geoinfo.admins.apiManagement.service.ApiKeyManagementMapper;
import geoinfo.admins.apiManagement.service.ApiKeyManagementService;
@Service("apiKeyManagementService")
public class ApiKeyManagementServiceImpl implements ApiKeyManagementService {
@Resource(name = "apiKeyManagementMapper")
private ApiKeyManagementMapper masterMapper;
@Override
public List<?> selectWebApiKeyList(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiKeyList(params);
}
@Override
public void updateWebApiKeyApprove(HashMap<String, Object> params) throws Exception {
masterMapper.updateWebApiKeyApprove(params);
}
@Override
public void deleteWebApiKey(HashMap<String, Object> params) throws Exception {
masterMapper.deleteWebApiKey(params);
}
}

View File

@ -1,76 +0,0 @@
package geoinfo.admins.apiManagement.service.impl;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import egovframework.rte.psl.dataaccess.util.EgovMap;
import geoinfo.admins.apiManagement.service.ApiManagementMapper;
import geoinfo.admins.apiManagement.service.ApiManagementService;
@Service("apiManagementService")
public class ApiManagementServiceImpl implements ApiManagementService {
@Resource(name = "ApiManagementMapper")
private ApiManagementMapper masterMapper;
@Override
public EgovMap selectDailyAccessCountByHour(HashMap<String, Object> params) throws Exception {
return masterMapper.selectDailyAccessCountByHour(params);
}
@Override
public List<?> selectInfo(HashMap<String, Object> params) throws Exception {
return masterMapper.selectInfo(params);
}
@Override
public List<?> selectWebApiLogList(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiLogList(params);
}
@Override
public void saveInfo(HashMap<String, Object> params) throws Exception {
masterMapper.saveInfo(params);
}
// @Override
// public EgovMap selectDetailInfo(HashMap<String, Object> params) throws Exception {
// return masterMapper.selectDetailInfo(params);
// }
// @Override
// public void deleteInfo(HashMap<String, Object> params) throws Exception {
// masterMapper.deleteInfo(params);
// }
// @Override
// public EgovMap selectModifyInfo(HashMap<String, Object> params) throws Exception {
// return masterMapper.selectModifyInfo(params);
// }
@Override
public void updateInfoStatus(HashMap<String, Object> params) throws Exception {
masterMapper.updateInfoStatus(params);
}
@Override
public List<?> selectWebApiKeyList(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiKeyList(params);
}
@Override
public void updateWebApiKeyApprove(HashMap<String, Object> params) throws Exception {
masterMapper.updateWebApiKeyApprove(params);
}
@Override
public void deleteWebApiKey(HashMap<String, Object> params) throws Exception {
masterMapper.deleteWebApiKey(params);
}
}

View File

@ -0,0 +1,59 @@
package geoinfo.admins.apiManagement.service.impl;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import egovframework.rte.psl.dataaccess.util.EgovMap;
import geoinfo.admins.apiManagement.service.ApiOutDataManagementMapper;
import geoinfo.admins.apiManagement.service.ApiOutDataManagementService;
@Service("apiOutDataManagementService")
public class ApiOutDataManagementServiceImpl implements ApiOutDataManagementService {
@Resource(name = "apiOutDataManagementMapper")
private ApiOutDataManagementMapper masterMapper;
@Override
public EgovMap selectDailyAccessCountByHour(HashMap<String, Object> params) throws Exception {
return masterMapper.selectDailyAccessCountByHour(params);
}
@Override
public List<?> selectWebApiLogDailyCount(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiLogDailyCount(params);
}
@Override
public List<?> selectWebApiLogMonthlyCount(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiLogMonthlyCount(params);
}
@Override
public List<?> selectWebApiLogYearlyCount(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiLogYearlyCount(params);
}
@Override
public List<?> selectInfo(HashMap<String, Object> params) throws Exception {
return masterMapper.selectInfo(params);
}
@Override
public List<?> selectWebApiLogList(HashMap<String, Object> params) throws Exception {
return masterMapper.selectWebApiLogList(params);
}
@Override
public void saveInfo(HashMap<String, Object> params) throws Exception {
masterMapper.saveInfo(params);
}
@Override
public void updateInfoStatus(HashMap<String, Object> params) throws Exception {
masterMapper.updateInfoStatus(params);
}
}

View File

@ -75,59 +75,6 @@ public class ConstructionProjectManagementController {
return "admins/constructionProjectManagement/construction-project-statistics-index";
}
/**
* >
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "admins/constructionProjectManagement/construction-user-mgmt-index.do")
public String goConstructionUserMgmt(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
if (!UserInfo.isValidSession(request, response, "admin")) {
return "";
}
/** 2023.10.25 LHJ 검색조건 추가 : 가입기간 시작/종료날짜를 8자리 숫자로 입력하지 않았을 때 처리 **/
String searchBgndt = (String) params.get("searchBgndt");
if(searchBgndt == null || searchBgndt.length() != 8 || !searchBgndt.matches("[0-9]+")) {
params.put("searchBgndt", "");
}
String searchEnddt = (String) params.get("searchEnddt");
if(searchEnddt == null || searchEnddt.length() != 8 || !searchEnddt.matches("[0-9]+")) {
params.put("searchEnddt", "");
}
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
if (params.get("pageIndex") == null || "".equals(params.get("pageIndex"))) {
paginationInfo.setCurrentPageNo(1);
params.put("pageIndex", 1);
} else {
paginationInfo.setCurrentPageNo(Integer.valueOf((String) params.get("pageIndex")));
}
paginationInfo.setRecordCountPerPage(10);
paginationInfo.setPageSize(10);
params.put("firstRecordIndex", paginationInfo.getFirstRecordIndex());
params.put("recordCountPerPage", paginationInfo.getRecordCountPerPage());
List<?> resultList = masterService.selectInfoList(params);
int totalCnt = resultList.size() == 0 ? 0 : Integer.valueOf(((EgovMap) resultList.get(0)).get("totalrows").toString());
paginationInfo.setTotalRecordCount(totalCnt);
model.addAttribute("params", params);
model.addAttribute("resultList", resultList);
model.addAttribute("paginationInfo", paginationInfo);
return "admins/constructionProjectManagement/construction-user-mgmt-index";
}
/**
*
* @param request
@ -603,4 +550,110 @@ public class ConstructionProjectManagementController {
return "admins/constructionProjectManagement/visit-training-approval-system";
}
/**
* >
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "admins/constructionProjectManagement/construction-user-mgmt-index.do")
public String goConstructionUserMgmt(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
if (!UserInfo.isValidSession(request, response, "admin")) {
return "";
}
/** 2023.10.25 LHJ 검색조건 추가 : 가입기간 시작/종료날짜를 8자리 숫자로 입력하지 않았을 때 처리 **/
String searchBgndt = (String) params.get("searchBgndt");
if(searchBgndt == null || searchBgndt.length() != 8 || !searchBgndt.matches("[0-9]+")) {
params.put("searchBgndt", "");
}
String searchEnddt = (String) params.get("searchEnddt");
if(searchEnddt == null || searchEnddt.length() != 8 || !searchEnddt.matches("[0-9]+")) {
params.put("searchEnddt", "");
}
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
if (params.get("pageIndex") == null || "".equals(params.get("pageIndex"))) {
paginationInfo.setCurrentPageNo(1);
params.put("pageIndex", 1);
} else {
paginationInfo.setCurrentPageNo(Integer.valueOf((String) params.get("pageIndex")));
}
paginationInfo.setRecordCountPerPage(10);
paginationInfo.setPageSize(10);
params.put("firstRecordIndex", paginationInfo.getFirstRecordIndex());
params.put("recordCountPerPage", paginationInfo.getRecordCountPerPage());
List<?> resultList = masterService.selectInfoList(params);
int totalCnt = resultList.size() == 0 ? 0 : Integer.valueOf(((EgovMap) resultList.get(0)).get("totalrows").toString());
paginationInfo.setTotalRecordCount(totalCnt);
model.addAttribute("params", params);
model.addAttribute("resultList", resultList);
model.addAttribute("paginationInfo", paginationInfo);
return "admins/constructionProjectManagement/construction-user-mgmt-index";
}
/**
* >
* @param params
* @param model
* @param response
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "admins/constructionProjectManagement/construction-user-login-history.do")
public String goConstructionUserloginHist(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
if (!UserInfo.isValidSession(request, response, "admin")) {
return "";
}
/** 2023.10.25 LHJ 검색조건 추가 : 가입기간 시작/종료날짜를 8자리 숫자로 입력하지 않았을 때 처리 **/
String searchBgndt = (String) params.get("searchBgndt");
if(searchBgndt == null || searchBgndt.length() != 8 || !searchBgndt.matches("[0-9]+")) {
params.put("searchBgndt", "");
}
String searchEnddt = (String) params.get("searchEnddt");
if(searchEnddt == null || searchEnddt.length() != 8 || !searchEnddt.matches("[0-9]+")) {
params.put("searchEnddt", "");
}
/** pageing */
PaginationInfo paginationInfo = new PaginationInfo();
if (params.get("pageIndex") == null || "".equals(params.get("pageIndex"))) {
paginationInfo.setCurrentPageNo(1);
params.put("pageIndex", 1);
} else {
paginationInfo.setCurrentPageNo(Integer.valueOf((String) params.get("pageIndex")));
}
paginationInfo.setRecordCountPerPage(10);
paginationInfo.setPageSize(10);
params.put("firstRecordIndex", paginationInfo.getFirstRecordIndex());
params.put("recordCountPerPage", paginationInfo.getRecordCountPerPage());
List<?> resultList = masterService.selectUserLoginHistory(params);
int totalCnt = resultList.size() == 0 ? 0 : Integer.valueOf(((EgovMap) resultList.get(0)).get("totalrows").toString());
paginationInfo.setTotalRecordCount(totalCnt);
model.addAttribute("params", params);
model.addAttribute("resultList", resultList);
model.addAttribute("paginationInfo", paginationInfo);
return "admins/constructionProjectManagement/construction-user-login-history";
}
}

View File

@ -48,4 +48,5 @@ public interface GeneralUserMngMapper {
public void updateUserPassInfo(HashMap<String, Object> params) throws Exception;
public List<?> selectUserLoginHistory(HashMap<String, Object> params) throws Exception;
}

View File

@ -46,5 +46,6 @@ public interface GeneralUserMngService {
public void updateUserPassInfo(HashMap<String, Object> params) throws Exception;
public List<?> selectUserLoginHistory(HashMap<String, Object> params) throws Exception;
}

View File

@ -113,4 +113,9 @@ public class GeneralUserMngServiceImpl implements GeneralUserMngService {
masterMapper.updateUserPassInfo(params);
}
@Override
public List<?> selectUserLoginHistory(HashMap<String, Object> params) throws Exception {
return masterMapper.selectUserLoginHistory(params);
}
}

View File

@ -1,7 +1,7 @@
<?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.admins.apiManagement.service.ApiManagementMapper">
<mapper namespace="geoinfo.admins.apiManagement.service.ApiInDataManagementMapper">
<!-- API 관리 > 일일 접속량 -->
<select id="selectDailyAccessCountByHour" parameterType="map" resultType="egovMap">
@ -30,12 +30,73 @@
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '21' THEN 1 END), 0) AS COUNT_21,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '22' THEN 1 END), 0) AS COUNT_22,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '23' THEN 1 END), 0) AS COUNT_23
FROM GEOINFO.WEB_API_LOG
FROM GEOINFO.WEB_API_INBOUND_LOG
WHERE ACCESS_DT >= TRUNC(TO_DATE(#{CHART_DATE}, 'YYYY-MM-DD'))
AND ACCESS_DT <![CDATA[<]]> TRUNC(TO_DATE(#{CHART_DATE}, 'YYYY-MM-DD')) + 1
</select>
<!-- API 관리 > 날짜별 통계 -->
<select id="selectWebApiLogDailyCount" parameterType="map" resultType="egovMap">
SELECT TO_CHAR(TRUNC(wal.access_dt), 'YYYY-MM-DD') AS period
,wai.name AS api_name
,COUNT(*) AS access_count
FROM WEB_API_INBOUND_LOG WAL
INNER JOIN WEB_API_INBOUND WAI ON WAL.API_SEQ = WAI.IDX
WHERE WAL.ACCESS_DT BETWEEN TO_DATE(#{COUNT_FROM_DT}, 'YYYY-MM-DD')
AND TO_DATE(#{COUNT_TO_DT}, 'YYYY-MM-DD') + 0.99999
GROUP BY TRUNC(WAL.ACCESS_DT)
,WAI.NAME
,WAI.IDX
HAVING COUNT(*) > 0
ORDER BY TRUNC(WAL.ACCESS_DT) DESC
,wai.idx ASC
,wai.NAME
</select>
<!-- API 관리 > 월별 통계 -->
<select id="selectWebApiLogMonthlyCount" parameterType="map" resultType="egovMap">
WITH MONTH_RANGE AS (
SELECT ADD_MONTHS(TRUNC(TO_DATE(#{COUNT_FROM_DT}, 'YYYY-MM'), 'MM'), LEVEL - 1) AS MONTH_START
FROM DUAL
CONNECT BY LEVEL <![CDATA[<=]]>
MONTHS_BETWEEN(
TRUNC(TO_DATE(#{COUNT_TO_DT}, 'YYYY-MM'), 'MM'),
TRUNC(TO_DATE(#{COUNT_FROM_DT}, 'YYYY-MM'), 'MM')
) + 1
)
SELECT TO_CHAR(MR.MONTH_START, 'YYYY-MM') AS period
,wai.name AS api_name
,NVL(COUNT(WAL.ACCESS_DT), 0) AS access_count
FROM MONTH_RANGE MR
LEFT JOIN GEOINFO.WEB_API_INBOUND_LOG WAL ON TRUNC(WAL.ACCESS_DT, 'MM') = MR.MONTH_START
INNER JOIN GEOINFO.WEB_API_INBOUND WAI ON WAL.API_SEQ = WAI.IDX
GROUP BY MR.MONTH_START, wai.name, wai.idx
ORDER BY MR.MONTH_START DESC, wai.idx ASC, wai.name
</select>
<!-- API 관리 > 연도별 통계 -->
<select id="selectWebApiLogYearlyCount" parameterType="map" resultType="egovMap">
WITH YEAR_RANGE AS (
SELECT ADD_MONTHS(TRUNC(TO_DATE(#{COUNT_FROM_DT}, 'YYYY'), 'YYYY'), (LEVEL - 1) * 12) AS YEAR_START
FROM DUAL
CONNECT BY LEVEL <![CDATA[<=]]>
FLOOR(
MONTHS_BETWEEN(
TRUNC(TO_DATE(#{COUNT_TO_DT}, 'YYYY'), 'YYYY'),
TRUNC(TO_DATE(#{COUNT_FROM_DT}, 'YYYY'), 'YYYY')
) / 12
) + 1
)
SELECT TO_CHAR(YR.YEAR_START, 'YYYY') AS period
,wai.name AS api_name
,NVL(COUNT(WAL.ACCESS_DT), 0) AS access_count
FROM YEAR_RANGE YR
LEFT JOIN GEOINFO.WEB_API_INBOUND_LOG WAL ON TRUNC(WAL.ACCESS_DT, 'YYYY') = YR.YEAR_START
INNER JOIN GEOINFO.WEB_API_INBOUND WAI ON WAL.API_SEQ = WAI.IDX
GROUP BY YR.YEAR_START, wai.name, wai.idx
ORDER BY YR.YEAR_START DESC, wai.idx ASC, wai.name
</select>
<select id="selectInfo" parameterType="map" resultType="egovMap">
SELECT TB.RN
,TB.IDX
@ -76,37 +137,10 @@
,IP_ADDRESS
,ROW_NUMBER() OVER(ORDER BY LOG_SEQ DESC) RN
,COUNT(*) OVER () AS TOTALROWS
FROM WEB_API_LOG
FROM WEB_API_INBOUND_LOG
WHERE 1=1
) TB
</select>
<!-- <insert id="saveInfo" parameterType="map">
<![CDATA[
INSERT INTO WEB_COMMUNITY
SELECT NVL(MAX(IDX),0) + 1, #{name}, #{password}, #{email}, #{homepage}, #{subject}, #{content}, NVL(MAX(IDX),0) + 1, 0, #{fileName1}, #{saveName1}, SYSDATE, 0, #{topnotice}, #{fileName2}, #{saveName2}, #{fileName3}, #{saveName3}
FROM WEB_COMMUNITY
]]>
</insert> -->
<!-- <select id="selectDetailInfo" parameterType="map" resultType="egovMap">
SELECT IDX, SUBJECT, EMAIL, HOMEPAGE, SAVENAME, FILENAME, SAVENAME2, FILENAME2, SAVENAME3, FILENAME3, CONTENT, NAME, READCOUNT, TO_CHAR(DATETIME,'YYYY-MM-DD') DATETIME, SEQ
FROM WEB_COMMUNITY
WHERE IDX = #{idx}
</select> -->
<!-- <delete id="deleteInfo" parameterType="map">
<![CDATA[
DELETE FROM WEB_COMMUNITY
WHERE IDX = #{idx}
]]>
</delete> -->
<!-- <select id="selectModifyInfo" parameterType="map" resultType="egovMap">
SELECT IDX, SUBJECT, CONTENT, NAME, READCOUNT, TO_CHAR(DATETIME,'YYYY-MM-DD') DATETIME, SEQ, FILENAME, SAVENAME, TOP, FILENAME2, SAVENAME2, FILENAME3, SAVENAME3
FROM WEB_COMMUNITY
WHERE IDX = #{idx}
</select> -->
<!-- API 호출 활성상태 변경 -->
<update id="updateInfoStatus" parameterType="map">
@ -121,46 +155,4 @@
</foreach>
)
</update>
<!-- API 신청 관리 목록 조회 -->
<select id="selectWebApiKeyList" parameterType="map" resultType="egovMap">
SELECT TB.RN
,TB.API_SEQ
,TB.USERID
,TB.USER_TYPE
,TB.API_KEY
,TO_CHAR(TB.START_DT, 'YYYY-MM-DD HH24:MI') AS START_DT
,TO_CHAR(TB.END_DT, 'YYYY-MM-DD HH24:MI') AS END_DT
,TB.APPROVE_YN
FROM (SELECT API_SEQ
,USERID
,USER_TYPE
,API_KEY
,START_DT
,END_DT
,APPROVE_YN
,ROW_NUMBER() OVER(ORDER BY API_SEQ ASC) RN
,TO_CHAR(LAST_VALUE(ROWNUM) OVER (ORDER BY ROWNUM ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)) AS TOTALROWS
FROM WEB_API_KEY
WHERE 1=1) TB
<!-- WHERE RN BETWEEN #{firstIndex} + 1 AND #{firstIndex} + #{recordCountPerPage} -->
</select>
<!-- API 신청 승인상태 변경 -->
<update id="updateWebApiKeyApprove" parameterType="map">
UPDATE WEB_API_KEY
SET
<if test="approveYn != null and approveYn !=''">
APPROVE_YN = #{approveYn}
</if>
WHERE API_SEQ IN (#{apiSeq})
</update>
<!-- 사용자 API 신청 삭제하기 -->
<delete id="deleteWebApiKey" parameterType="map">
DELETE
FROM WEB_API_KEY
WHERE API_SEQ IN (#{apiSeq})
</delete>
</mapper>

View File

@ -0,0 +1,59 @@
<?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.admins.apiManagement.service.ApiKeyManagementMapper">
<!-- API 신청 관리 목록 조회 -->
<select id="selectWebApiKeyList" parameterType="map" resultType="egovMap">
SELECT TB.RN
,TB.API_SEQ
,TB.USERID
,TB.USER_TYPE
,TB.API_KEY
,TO_CHAR(TB.START_DT, 'YYYY-MM-DD HH24:MI') AS START_DT
,TO_CHAR(TB.END_DT, 'YYYY-MM-DD HH24:MI') AS END_DT
,TB.APPROVE_YN
FROM (SELECT API_SEQ
,USERID
,USER_TYPE
,API_KEY
,START_DT
,END_DT
,APPROVE_YN
,ROW_NUMBER() OVER(ORDER BY API_SEQ ASC) RN
,TO_CHAR(LAST_VALUE(ROWNUM) OVER (ORDER BY ROWNUM ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)) AS TOTALROWS
FROM WEB_API_KEY
WHERE 1=1) TB
<!-- WHERE RN BETWEEN #{firstIndex} + 1 AND #{firstIndex} + #{recordCountPerPage} -->
</select>
<!-- API 신청 승인상태 변경 -->
<update id="updateWebApiKeyApprove" parameterType="map">
UPDATE WEB_API_KEY
SET
<if test="approveYn != null and approveYn !=''">
APPROVE_YN = #{approveYn}
</if>
<where>
<!-- seqArr 조건 -->
<if test="seqArr != null and seqArr.size() > 0">
API_SEQ IN
<foreach item="item" index="index" collection="seqArr" open="(" separator=", " close=")">
#{item}
</foreach>
</if>
<!-- otype 조건 -->
<if test="otype != null and otype != ''">
AND USER_TYPE = #{otype}
</if>
</where>
</update>
<!-- 사용자 API 신청 삭제하기 -->
<delete id="deleteWebApiKey" parameterType="map">
DELETE
FROM WEB_API_KEY
WHERE API_SEQ IN (#{apiSeq})
</delete>
</mapper>

View File

@ -0,0 +1,158 @@
<?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.admins.apiManagement.service.ApiOutDataManagementMapper">
<!-- API 관리 > 일일 접속량 -->
<select id="selectDailyAccessCountByHour" parameterType="map" resultType="egovMap">
SELECT
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '00' THEN 1 END), 0) AS COUNT_00,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '01' THEN 1 END), 0) AS COUNT_01,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '02' THEN 1 END), 0) AS COUNT_02,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '03' THEN 1 END), 0) AS COUNT_03,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '04' THEN 1 END), 0) AS COUNT_04,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '05' THEN 1 END), 0) AS COUNT_05,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '06' THEN 1 END), 0) AS COUNT_06,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '07' THEN 1 END), 0) AS COUNT_07,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '08' THEN 1 END), 0) AS COUNT_08,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '09' THEN 1 END), 0) AS COUNT_09,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '10' THEN 1 END), 0) AS COUNT_10,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '11' THEN 1 END), 0) AS COUNT_11,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '12' THEN 1 END), 0) AS COUNT_12,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '13' THEN 1 END), 0) AS COUNT_13,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '14' THEN 1 END), 0) AS COUNT_14,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '15' THEN 1 END), 0) AS COUNT_15,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '16' THEN 1 END), 0) AS COUNT_16,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '17' THEN 1 END), 0) AS COUNT_17,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '18' THEN 1 END), 0) AS COUNT_18,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '19' THEN 1 END), 0) AS COUNT_19,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '20' THEN 1 END), 0) AS COUNT_20,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '21' THEN 1 END), 0) AS COUNT_21,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '22' THEN 1 END), 0) AS COUNT_22,
NVL(SUM(CASE WHEN TO_CHAR(ACCESS_DT, 'HH24') = '23' THEN 1 END), 0) AS COUNT_23
FROM GEOINFO.WEB_API_OUTBOUND_LOG
WHERE ACCESS_DT >= TRUNC(TO_DATE(#{CHART_DATE}, 'YYYY-MM-DD'))
AND ACCESS_DT <![CDATA[<]]> TRUNC(TO_DATE(#{CHART_DATE}, 'YYYY-MM-DD')) + 1
</select>
<!-- API 관리 > 날짜별 통계 -->
<select id="selectWebApiLogDailyCount" parameterType="map" resultType="egovMap">
SELECT TO_CHAR(TRUNC(wal.access_dt), 'YYYY-MM-DD') AS period
,WAO.name AS api_name
,COUNT(*) AS access_count
FROM WEB_API_OUTBOUND_LOG WAL
INNER JOIN WEB_API_OUTBOUND WAO ON WAL.API_SEQ = WAO.IDX
WHERE WAL.ACCESS_DT BETWEEN TO_DATE(#{COUNT_FROM_DT}, 'YYYY-MM-DD')
AND TO_DATE(#{COUNT_TO_DT}, 'YYYY-MM-DD') + 0.99999
GROUP BY TRUNC(WAL.ACCESS_DT)
,WAO.NAME
,WAO.IDX
HAVING COUNT(*) > 0
ORDER BY TRUNC(WAL.ACCESS_DT) DESC
,WAO.idx ASC
,WAO.NAME
</select>
<!-- API 관리 > 월별 통계 -->
<select id="selectWebApiLogMonthlyCount" parameterType="map" resultType="egovMap">
WITH MONTH_RANGE AS (
SELECT ADD_MONTHS(TRUNC(TO_DATE(#{COUNT_FROM_DT}, 'YYYY-MM'), 'MM'), LEVEL - 1) AS MONTH_START
FROM DUAL
CONNECT BY LEVEL <![CDATA[<=]]>
MONTHS_BETWEEN(
TRUNC(TO_DATE(#{COUNT_TO_DT}, 'YYYY-MM'), 'MM'),
TRUNC(TO_DATE(#{COUNT_FROM_DT}, 'YYYY-MM'), 'MM')
) + 1
)
SELECT TO_CHAR(MR.MONTH_START, 'YYYY-MM') AS period
,WAO.name AS api_name
,NVL(COUNT(WAL.ACCESS_DT), 0) AS access_count
FROM MONTH_RANGE MR
LEFT JOIN GEOINFO.WEB_API_OUTBOUND_LOG WAL ON TRUNC(WAL.ACCESS_DT, 'MM') = MR.MONTH_START
INNER JOIN GEOINFO.WEB_API_OUTBOUND WAO ON WAL.API_SEQ = WAO.IDX
GROUP BY MR.MONTH_START, WAO.name, WAO.idx
ORDER BY MR.MONTH_START DESC, WAO.idx ASC, WAO.name
</select>
<!-- API 관리 > 연도별 통계 -->
<select id="selectWebApiLogYearlyCount" parameterType="map" resultType="egovMap">
WITH YEAR_RANGE AS (
SELECT ADD_MONTHS(TRUNC(TO_DATE(#{COUNT_FROM_DT}, 'YYYY'), 'YYYY'), (LEVEL - 1) * 12) AS YEAR_START
FROM DUAL
CONNECT BY LEVEL <![CDATA[<=]]>
FLOOR(
MONTHS_BETWEEN(
TRUNC(TO_DATE(#{COUNT_TO_DT}, 'YYYY'), 'YYYY'),
TRUNC(TO_DATE(#{COUNT_FROM_DT}, 'YYYY'), 'YYYY')
) / 12
) + 1
)
SELECT TO_CHAR(YR.YEAR_START, 'YYYY') AS period
,WAO.name AS api_name
,NVL(COUNT(WAL.ACCESS_DT), 0) AS access_count
FROM YEAR_RANGE YR
LEFT JOIN GEOINFO.WEB_API_OUTBOUND_LOG WAL ON TRUNC(WAL.ACCESS_DT, 'YYYY') = YR.YEAR_START
INNER JOIN GEOINFO.WEB_API_OUTBOUND WAO ON WAL.API_SEQ = WAO.IDX
GROUP BY YR.YEAR_START, WAO.name, WAO.idx
ORDER BY YR.YEAR_START DESC, WAO.idx ASC, WAO.name
</select>
<select id="selectInfo" parameterType="map" resultType="egovMap">
SELECT TB.RN
,TB.IDX
,TB."NAME"
,TB."DESC"
,TB.ACTIVE_YN
,TO_CHAR(LAST_VALUE(ROWNUM) OVER (ORDER BY ROWNUM ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)) AS TOTALROWS
FROM (SELECT IDX
,"NAME"
,"DESC"
,ACTIVE_YN
,ROW_NUMBER() OVER(ORDER BY IDX ASC) RN
,TO_CHAR(LAST_VALUE(ROWNUM) OVER (ORDER BY ROWNUM ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)) AS TOTALROWS
FROM WEB_API_OUTBOUND
WHERE 1=1
) TB
<!-- WHERE RN BETWEEN #{firstIndex} + 1 AND #{firstIndex} + #{recordCountPerPage} -->
</select>
<!-- API 관리 > API 호출 로그 목록 표시 -->
<select id="selectWebApiLogList" parameterType="map" resultType="egovMap">
SELECT TB.RN
,TB.LOG_SEQ
,SUBSTR(TB.API_KEY, 1, 10) || '...' AS API_KEY_CONCAT
,TB.API_KEY
,TB.ACCESS_ID
,TB.ACCESS_TYPE
,TB.ACCESS_TABLE
,TO_CHAR(TB.ACCESS_DT, 'YYYY-MM-DD HH24:MI') AS ACCESS_DT
,TB.IP_ADDRESS
,TO_CHAR(LAST_VALUE(ROWNUM) OVER (ORDER BY ROWNUM ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)) AS TOTALROWS
FROM (SELECT LOG_SEQ
,API_KEY
,ACCESS_ID
,ACCESS_TYPE
,ACCESS_TABLE
,ACCESS_DT
,IP_ADDRESS
,ROW_NUMBER() OVER(ORDER BY LOG_SEQ DESC) RN
,COUNT(*) OVER () AS TOTALROWS
FROM WEB_API_OUTBOUND_LOG
WHERE 1=1
) TB
</select>
<!-- API 호출 활성상태 변경 -->
<update id="updateInfoStatus" parameterType="map">
UPDATE WEB_API_OUTBOUND
SET
<if test="activeYn != null and activeYn !=''">
ACTIVE_YN = #{activeYn}
</if>
WHERE IDX IN (
<foreach item="item" index="index" collection="idxArr" open="" separator=", " close="">
#{item}
</foreach>
)
</update>
</mapper>

View File

@ -428,5 +428,30 @@
userid = #{userId}
]]>
</update>
<select id="selectUserLoginHistory" parameterType="map" resultType="egovMap">
SELECT
NUM
,USERID
,USER_NAME
,COMPANY_NAME
,DATETIME
,"note"
,TOTALROWS
FROM (
SELECT wmi.USERID
,wmi.USER_NAME
,wmi.COMPANY_NAME
,wrl.DATETIME
,'로그인' AS "note"
,ROW_NUMBER() OVER (ORDER BY wrl.DATETIME DESC, wmi.USERID) AS NUM
,TO_CHAR(LAST_VALUE(ROWNUM) OVER (ORDER BY ROWNUM ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)) AS TOTALROWS
FROM WEB_REQUEST_LOG wrl
LEFT JOIN WEB_MEMBER_IN wmi ON wrl.USERID = wmi.USERID
WHERE wmi.CLS = 2)
<!--<![CDATA[
WHERE NUM <= #{firstRecordIndex} + #{recordCountPerPage} AND NUM > #{firstRecordIndex}
]]> -->
</select>
</mapper>

Binary file not shown.

View File

@ -0,0 +1,179 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="${pageContext.request.contextPath}/js/jquery/jquery-1.10.2.min.js"></script>
<script src="${pageContext.request.contextPath}/js/admins/common.js"></script>
<link rel="stylesheet" HREF="${pageContext.request.contextPath}/css/admins/style.css" type="text/css">
<script>
document.addEventListener('DOMContentLoaded', function() {
var searchTitle = document.getElementById('searchTitle');
var searchValue = document.getElementById('searchValue');
var searchContainer = searchValue.parentNode;
var tildeText = document.createElement('span');
tildeText.innerHTML = '~';
var searchBgndt = document.createElement('input');
var searchEnddt = document.createElement('input');
function createInput(input, id) {
input.type = 'text';
input.id = id;
input.name = id;
input.className = 'search';
input.style.display = 'inline-block';
input.style.width = '12ch';
input.placeholder = 'YYYYMMDD';
input.style.color = '#000'; // Text color
input.maxLength = 8; // Limit input length
input.onfocus = function() {
this.placeholder = '';
this.style.color = '#000'; // Text color
};
input.onblur = function() {
if (this.value === '') {
this.placeholder = 'YYYYMMDD';
}
};
}
createInput(searchBgndt, 'searchBgndt');
createInput(searchEnddt, 'searchEnddt');
searchBgndt.style.marginRight = '2px';
searchEnddt.style.marginLeft = '2px';
searchBgndt.value = "${params.searchBgndt}";
searchEnddt.value = "${params.searchEnddt}";
function addInputs() {
searchValue.style.display = 'none';
searchContainer.insertBefore(searchBgndt, searchValue);
searchContainer.insertBefore(tildeText, searchValue);
searchContainer.insertBefore(searchEnddt, searchValue);
}
function removeInputs() {
if (document.getElementById('searchBgndt')) {
searchBgndt.remove();
tildeText.remove();
searchEnddt.remove();
}
searchValue.style.display = 'inline-block';
}
if (searchTitle.value == '7') {
addInputs();
}
searchTitle.addEventListener('change', function() {
if (this.value == '7') {
addInputs();
} else {
removeInputs();
}
});
});
var context = "${pageContext.request.contextPath}";
function linkPage(index){
$("#pageIndex").val(index);
$("#searchForm").attr("action", "${pageContext.request.contextPath}/admins/user/02.do").submit();
}
/* function excelDownload(){
$("#searchForm").attr("action", "${pageContext.request.contextPath}/admins/user/02_excel.do").submit();
$("#searchForm").attr("action", "${pageContext.request.contextPath}/admins/user/02.do");
}
*/
$(function(){
var searchTitle = "${params.searchTitle}";
searchTitle = searchTitle == "" ? "0" : searchTitle;
$("#searchTitle").val(searchTitle);
});
</script>
</head>
<body>
<form id="searchForm" name="searchForm" method="post">
<input type="hidden" id="pageIndex" name="pageIndex" value="${params.pageIndex}" />
<table id="Table_Main" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan=2><div style="background: #fff; border-radius: 12px; padding: 5px 10px;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);"><h3>발주기관 로그인 내역</h3></div></td>
</tr>
<tr height=20 colspan=2><td>&nbsp;</td></tr>
<%-- <tr height=25>
<!-- START : 엑셀 다운로드 ------------------------------------------------------------------------->
<td>
<img src="${pageContext.request.contextPath}/images/admins/excel.gif" style="cursor:hand" onClick="javascript:excelDownload()"></td>
<!-- END : 엑셀 다운로드 ------------------------------------------------------------------------->
<!-- START : 검색 ---------------------------------------------------------------------------------->
<td align="right" class="search">
<select id="searchTitle" name="searchTitle">
<option value="0" selected>전체</option>
<option value="2">아이디</option>
<option value="1">이름</option>
<option value="4">회사명</option>
<option value="3">업종</option>
<option value="6">사업자등록번호</option>
<option value="5">이메일</option>
<option value="7">가입기간</option>
</select>
<input type="text" class="search" id="searchValue" name="searchValue" value="${params.searchValue}" />
<input type="image" src="${pageContext.request.contextPath}/images/admins/search.gif" align="absmiddle">
</td>
<!-- END : 검색 ---------------------------------------------------------------------------------->
</tr>--%>
<tr height=12><td colspan=2><img src="${pageContext.request.contextPath}/images/admins/spacer.gif" width="1" height="12"></td></tr>
<tr>
<td colspan=2>
<tbody>
<table id="Table_List" width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D6D6D6">
<!-- START : list head ----------------------------------------------------------------------------->
<tr height=28 bgcolor="#FBF4E4" class="list_head" align="center">
<td width="4%">번호</td>
<td width="12%">아이디</td>
<td width="8%">이름</td>
<td width="13%">소속</td>
<td width="13%">로그인일시</td>
<td width="8%">로그인여부</td>
</tr>
<!-- END : list head ----------------------------------------------------------------------------->
<!-- REPEAT TABLE -->
<c:forEach items="${resultList}" var="resultList" varStatus="status">
<tr height=28 bgcolor="#FFFFFF" class="list_content" align="center">
<td>${resultList.num}</td>
<td>${resultList.userid}</td>
<td>${resultList.userName}</td>
<td>${resultList.companyName}</td>
<td><fmt:formatDate value="${resultList.datetime}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
<td>${resultList.note}</td>
</tr>
</c:forEach>
<!-- END OF REPEAT TABLE -->
</table>
</tbody>
</td>
</tr>
<tr height=42>
<!-- START : 네비게이션 ---------------------------------------------------------------------------->
<!-- <td align=center class="navi" colspan='2'> -->
<!-- <table width=100% > -->
<!-- <tr align="center"> -->
<!-- <td> -->
<!-- REPEAT LINK -->
<%-- <ui:pagination paginationInfo = "${paginationInfo}" type="image" jsFunction="linkPage"/> --%>
<!-- END OF REPEAT LINK -->
<!-- </td> -->
<!-- </tr> -->
<!-- </table> -->
<!-- </td> -->
<!-- END : 네비게이션 ---------------------------------------------------------------------------->
</tr>
</table>
</form>
</body>
</html>

View File

@ -80,6 +80,9 @@ img { border:0; }
<div class="menu-item">
<span style="cursor:hand" onClick="javascript:goUrl('construction-user-mgmt-index', '${menuId}')"><img src="${pageContext.request.contextPath}/images/renew/arrow-right.png" /> &nbsp;발주기관 계정</span>
</div>
<div class="menu-item">
<span style="cursor:hand" onClick="javascript:goUrl('construction-user-login-history', '${menuId}')"><img src="${pageContext.request.contextPath}/images/renew/arrow-right.png" /> &nbsp;발주기관 로그인 내역</span>
</div>
</td>
</tr>
</table>

View File

@ -3,27 +3,138 @@
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<!-- datepicker -->
<!-- Bootstrap Datepicker -->
<link rel="stylesheet" href="${pageContext.request.contextPath}/js/bootstrap-datepicker-1.9.0-dist/css/bootstrap-datepicker.min.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-datepicker-1.9.0-dist/js/bootstrap-datepicker.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-datepicker-1.9.0-dist/locales/bootstrap-datepicker.ko.min.js"></script>
<!-- MUI + Chart.js + jQuery -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link href="https://cdn.jsdelivr.net/npm/@mui/material@5.15.14/dist/material.min.css" rel="stylesheet">
<style>
body { font-family: 'Pretendard', 'Roboto', sans-serif; background-color: #f5f6fa; margin: 0; padding: 20px; }
body { font-family: 'Pretendard', 'Roboto', sans-serif; background-color: #f5f6fa; color: #333; margin: 0; padding: 20px; }
.chart-container {
background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
padding: 20px; margin-bottom: 20px;
}
.chart-container h3 { margin-bottom: 10px; }
/* 국토지반 API 호출 통계 */
.stats-container {
margin: 20px auto;
background-color: #ffffff;
border: 1px solid #dbe3e0;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
/* overflow: hidden; */
}
/* 헤더 영역 (버튼 배치를 위해 수정) */
.stats-header {
padding: 20px 30px;
border-bottom: 1px solid #eee;
overflow: hidden; /* float을 포함하기 위함 */
}
.stats-header h1 {
margin: 0;
color: #2c3e50;
font-size: 24px;
display: inline-block; /* 버튼과 정렬 */
float: left;
}
/* CSV 내보내기 버튼 스타일 */
.export-btn {
float: right;
background-color: #007bff;
color: white;
border: none;
padding: 8px 14px;
border-radius: 5px;
font-weight: 600;
cursor: pointer;
font-size: 14px;
transition: background-color 0.2s;
}
.export-btn:hover {
background-color: #0056b3;
}
/* (이하 탭, 테이블 스타일 동일) */
.tab-nav {
display: flex;
background-color: #fdfdfd;
border-bottom: 1px solid #eee;
padding: 0 30px;
}
.tab-link {
font-size: 16px;
font-weight: 600;
color: #555;
background-color: transparent;
border: none;
padding: 15px 20px;
cursor: pointer;
border-bottom: 3px solid transparent;
transition: all 0.3s ease;
margin-right: 10px;
}
.tab-link:hover {
color: #007bff;
}
.tab-link.active {
color: #007bff;
border-bottom-color: #007bff;
}
.tab-content-wrapper {
padding: 30px;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
.tab-content h2 {
font-size: 20px;
color: #34495e;
margin-bottom: 20px;
}
.stats-table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
.stats-table th,
.stats-table td {
border: 1px solid #e0e0e0;
padding: 12px 15px;
text-align: left;
}
.stats-table thead {
background-color: #f9fafa;
}
.stats-table th {
font-weight: 600;
color: #444;
}
.stats-table tbody tr:nth-child(even) {
background-color: #fcfcfc;
}
.stats-table td:last-child {
text-align: right;
font-weight: 600;
color: #e74c3c;
}
.stats-table .period-cell {
vertical-align: top;
font-weight: 600;
color: #333;
background-color: #fdfdfd;
}
/* 국토지반 API 호출 통계 END ------------------------- */
.dashboard-grid {
display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@ -183,6 +294,17 @@
.pagination button:hover:not(.active) {
background-color: #cbd5e1;
}
.datepicker-wrapper {
}
.datepicker-dropdown {
z-index: 99999 !important;
position: absolute;
left: 0 !important;
background: #fff;
border: 1px solid #e6e6e6;
}
</style>
</head>
<body>
@ -190,10 +312,79 @@
<!-- 일일 접속량 -->
<div class="chart-container">
<h3>📈 일일 접속량</h3>
<input type="text" name="chartDate" id="chartDate" class="input" placeholder="클릭하여 날짜 선택" >
<!-- <div id="chartDateContainer" style="position: relative;"><input type="text" name="chartDate" id="chartDate " class="input" placeholder="클릭하여 날짜 선택" ></div> -->
<div class="datepicker-wrapper" style="position: relative; display: inline-block;">
<input type="text" name="chartDate" id="chartDate" class="input" placeholder="클릭하여 날짜 선택">
</div>
<canvas id="trafficChart" height="100"></canvas>
</div>
<!-- 국토지반 API 호출 건수 통계 -->
<div class="stats-container">
<header class="stats-header">
<h1>국토지반 API 호출 통계</h1>
<button id="export-csv-btn" class="export-btn">CSV 내보내기</button>
</header>
<nav class="tab-nav">
<button class="tab-link active" data-tab="daily">일별 통계</button>
<button class="tab-link" data-tab="monthly">월별 통계</button>
<button class="tab-link" data-tab="yearly">연도별 통계</button>
</nav>
<div class="tab-content-wrapper">
<div class="datepicker-wrapper" style="position: relative; display: inline-block;">
<input type="text" name="count_from_dt" id="count_from_dt" class="input" placeholder="클릭하여 날짜 선택" >~
<input type="text" name="count_to_dt" id="count_to_dt" class="input" placeholder="클릭하여 날짜 선택" >
</div>
<div id="daily" class="tab-content active">
<h2>일별 API 호출 현황</h2>
<table class="stats-table">
<thead>
<tr>
<th>날짜</th>
<th>API 명</th>
<th>호출 건수</th>
</tr>
</thead>
<tbody id="daily-tbody">
<tr><td colspan="3">표시 할 통계데이타가 없습니다.</td></tr>
</tbody>
</table>
</div>
<div id="monthly" class="tab-content">
<h2>월별 API 호출 현황</h2>
<table class="stats-table">
<thead>
<tr>
<th>월</th>
<th>API 명</th>
<th>총 호출 건수</th>
</tr>
</thead>
<tbody id="monthly-tbody">
<tr><td colspan="3">표시 할 통계데이타가 없습니다.</td></tr>
</tbody>
</table>
</div>
<div id="yearly" class="tab-content">
<h2>연도별 API 호출 현황</h2>
<table class="stats-table">
<thead>
<tr>
<th>연도</th>
<th>API 명</th>
<th>총 호출 건수</th>
</tr>
</thead>
<tbody id="yearly-tbody">
<tr><td colspan="3">표시 할 통계데이타가 없습니다.</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="dashboard-grid">
<!-- API 호출 현황 -->
<div class="card">
@ -313,22 +504,123 @@
}
requestAnimationFrame(animation);
}
// --------- 일일 접속량 차트 관련 변수 --------------------
let trafficChart; // 전역 변수
// --------- 일일 접속량 차트 관련 변수 --------------------
// --------- API 호출 통계 기간 입력 관련 변수 --------------------
var today = new Date(); // (기준)오늘 날짜
var thisYear = today.getFullYear(); // (기준)올해연도
var thisMonth = today.getMonth+1; // (기준)이번달
var toDate = new Date(today.getFullYear(), today.getMonth(), 1); // (기준)이번달1일
var weekAgo = new Date(); // 7일 전 날짜
weekAgo.setDate(today.getDate() - 7);
var fvMonthAgo = new Date();
fvMonthAgo.setMonth(toDate.getMonth() -5);
// --------- API 호출 통계 기간 입력 관련 변수 --------------------
// --------- API 호출 통계 CSV 내보내기 관련 변수 --------------------
let processedStats = {
daily: new Map(),
monthly: new Map(),
yearly: new Map()
};
// --------- API 호출 통계 CSV 내보내기 관련 변수 --------------------
$(document).ready(function(){
// ----------------------------------------------------
// 1. 날짜 선택기 초기화
// ----------------------------------------------------
// datepicker
$("#chartDate").datepicker({
format: "yyyy-mm-dd",
$("#chartDate, #count_from_dt, #count_to_dt").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
autoclose: true,
todayHighlight: true,
container: $("#chartDate").closest(".datepicker-wrapper")
}).datepicker("setDate", new Date());
$("#count_from_dt").datepicker("setDate", weekAgo); // 국토지반 API 호출 통계 시작일 셋팅(저번주)
// API 호출 현황
// ----------------------------------------------------
// 2. 탭 전환 처리
// ----------------------------------------------------
$('.tab-link').on('click', function() {
const targetId = $(this).data('tab');
$('.tab-link').removeClass('active');
$(this).addClass('active');
$('.tab-content').removeClass('active');
$('#' + targetId).addClass('active');
$("#count_from_dt, #count_to_dt").datepicker('destroy'); // datepicker 재선언(format 변경)
// 일별 탭 클릭 시
if (targetId === 'daily') {
// 월 단위 datepicker 재초기화
$("#count_from_dt, #count_to_dt").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true,
minViewMode: 0, // 월 단위
todayHighlight: true,
container: $("#count_from_dt").closest(".datepicker-wrapper")
});
$("#count_to_dt").datepicker("setDate", today); // 국토지반 API 호출 통계 시작일 셋팅(저번주)
$("#count_from_dt").datepicker("setDate", weekAgo); // 국토지반 API 호출 통계 시작일 셋팅(저번주)
}
// 월별 탭 클릭 시
if (targetId === 'monthly') {
// 월 단위 datepicker 재초기화
$("#count_from_dt, #count_to_dt").datepicker({
format: "yyyy-mm",
language: "ko",
autoclose: true,
minViewMode: 1, // 월 단위
todayHighlight: true,
container: $("#count_from_dt").closest(".datepicker-wrapper")
});
$("#count_from_dt").datepicker("setDate", fvMonthAgo);
$("#count_to_dt").datepicker("setDate", thisMonth);
$("#count_from_dt").val($("#count_from_dt").val().substr(0,7));
$("#count_to_dt").val($("#count_to_dt").val().substr(0,7));
}
// 연도별 탭 클릭 시
if (targetId === 'yearly') {
// 월 단위 datepicker 재초기화
$("#count_from_dt, #count_to_dt").datepicker({
minViewMode: 'years',
format: "yyyy",
language: "ko",
autoclose: true,
todayHighlight: true,
container: $("#count_from_dt").closest(".datepicker-wrapper")
});
$("#count_to_dt").datepicker("setDate", new Date(thisYear, 0, 1));
$("#count_from_dt").datepicker("setDate", new Date((thisYear -5), 0, 1));
$("#count_to_dt").val($("#count_to_dt").val().substr(0,4))
$("#count_from_dt").val($("#count_from_dt").val().substr(0,4))
}
});
// ----------------------------------------------------
// 3. API 호출 현황 초기 로드
// ----------------------------------------------------
animateValue("successRate", 0, 100, 1500);
animateValue("failRate", 0, 0, 1500);
animateValue("delayRate", 0, 0, 1500);
animateValue("errorRate", 0, 0, 1500);
// API 호출 통계 > 일별, 월별, 연도별 통계
getApiStat();
// API 호출 통제 목록 조회
getMgmtApiList();
@ -342,6 +634,19 @@
$(document).on('change', '#chartDate', function() {
getMgmtApiChart();
});
// API 호출 현황 건수 - 날짜 변경 시 차트 다시 로드
$(document).on('change', '#count_from_dt, #count_to_dt', function() {
if(!validDate()){
return;
}
getApiStat();
});
// API 호출 통계 건수 - CSV 내보내기 클릭
$(document).on('click', '#export-csv-btn', function() {
exportToCSV();
})
});
// API 호출 통제 목록 조회
@ -432,6 +737,101 @@
return html;
}
// API 호출 통계 > 일별, 월별, 연도별 통계
function getApiStat(){
var statType = $('.stats-container > .tab-nav').find('.active').data("tab");
var fromDt = $('#count_from_dt').val();
var toDt = $('#count_to_dt').val();
// 날짜데이터가 올바르게 셋팅되지 않았을때는 요청하지 않는다.
if (statType === "monthly") {
if (fromDt.length < 7 || toDt.length < 7 ) return;
} else if (statType === "yearly") {
if (fromDt.length < 4 || toDt.length < 4 ) return;
} else { // statType === "daily"
if (fromDt.length < 10 || toDt.length < 10 ) return;
}
$.ajax({
type : "POST",
url : "/admins/mgmtApi/i_counts.do" ,
data : {
statType : statType,
countFromDt: $('#count_from_dt').val(),
countToDt: $('#count_to_dt').val()
},
dataType :"json",
success : function(res){ // res.code, res.msg, res.data
if (res.code == "SUCCESS") {
let countList = res.data;
let $listContainer;
// 활성화 된 탭의 tbody를 컨테이너로 지정
if (statType === "monthly") {
$listContainer = $("#monthly-tbody");
} else if (statType === "yearly") {
$listContainer = $("#yearly-tbody");
} else {
$listContainer = $("#daily-tbody");
}
// 활성화 된 탭의 csv 양식으로 지정
if (statType === "monthly") {
$listContainer = $("#monthly-tbody");
processedStats.monthly = countList;
} else if (statType === "yearly") {
$listContainer = $("#yearly-tbody");
processedStats.yearly = countList;
} else {
$listContainer = $("#daily-tbody");
processedStats.daily = countList;
}
// DOM에 추가
drawApiCountList(res.data, $listContainer);
} else {
alert("API 호출 로그 목록 조회중 오류가 발생하였습니다. 다시 시도해주세요.");
}
},
error : function(response){
alert("API 호출 로그 목록 조회중 내부 오류가 발생하였습니다. 다시 시도해주세요.");
}
});
};
function drawApiCountList(countList, $target) {
$target.empty();
if (!countList || countList.length === 0) {
$target.append('<tr><td colspan="3">표시 할 통계데이타가 없습니다.</td></tr>');
return;
}
const grouped = {};
let totalCount = 0; // 합계 초기화
countList.forEach(item => {
if (!grouped[item.period]) grouped[item.period] = [];
grouped[item.period].push(item);
totalCount += parseInt(item.accessCount);
});
let html = '';
Object.keys(grouped).sort((a, b) => b.localeCompare(a)).forEach(period => {
const items = grouped[period];
items.forEach((item, idx) => {
html += `<tr>
\${idx === 0 ? `<td rowspan="\${items.length}">\${period}</td>` : ''}
<td>\${item.apiName}</td>
<td>\${item.accessCount} 건</td>
</tr>`;
});
});
// 합계 row 추가
html += `<tr style="background:#f9fafa;">
<td colspan="2" style="font-weight:bold;">합계</td>
<td style="font-weight:bold;">\${totalCount} 건</td>
</tr>`;
$target.append(html);
}
// API 호출 로그 목록 조회
function getMgmtApiLogList(){
$.ajax({
@ -474,12 +874,10 @@
`;
return html;
}
// API 호출 로그 목록 조회
function getMgmtApiChart(){
var chartDate = $('#chartDate').val();
console.log($('#chartDate').val())
$.ajax({
type : "POST",
url : "/admins/mgmtApi/charts.do" ,
@ -549,80 +947,78 @@
}
});
}
function exportToCSV() {
// 1. 현재 활성화된 탭 찾기
const activeTab = document.querySelector('.tab-link.active');
if (!activeTab) return;
const tabId = activeTab.getAttribute('data-tab'); // 'daily', 'monthly', 'yearly'
const dataList = processedStats[tabId]; // 전역 변수에서 배열 데이터 가져오기
if (!Array.isArray(dataList) || dataList.length === 0) {
alert('내보낼 데이터가 없습니다.');
return;
}
let headers = [];
let filename = '';
// 2. 탭에 맞는 헤더와 파일명 설정
if (tabId === 'daily') {
headers = ['날짜', 'API 명', '호출 건수'];
filename = 'api_stats_daily.csv';
} else if (tabId === 'monthly') {
headers = ['월', 'API 명', '총 호출 건수'];
filename = 'api_stats_monthly.csv';
} else { // 'yearly'
headers = ['연도', 'API 명', '총 호출 건수'];
filename = 'api_stats_yearly.csv';
}
// 3. 날짜 기준으로 내림차순 정렬
const sortedData = [...dataList].sort((a, b) => b.period.localeCompare(a.period));
// 4. CSV 헤더 + 데이터 행 구성
const rows = [headers];
sortedData.forEach(item => {
const { period, apiName, accessCount } = item;
rows.push([period, apiName, accessCount]);
});
// 5. CSV 문자열로 변환
const csvContent = rows.map(row => row.join(',')).join('\r\n');
// 6. UTF-8 BOM 추가 및 파일 다운로드
const bom = '\uFEFF';
const blob = new Blob([bom + csvContent], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
// 6. 리소스 정리
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
/**
* 날짜형식 YYYYMMDDHHMI -> YYYY-MM-DD HH:MI
* API 호출 통계 날짜 유효검사
*/
function formatDateTime(raw) {
if (!raw || raw.length !== 12) return "";
return (
raw.slice(0, 4) + "-" +
raw.slice(4, 6) + "-" +
raw.slice(6, 8) + " " +
raw.slice(8, 10) + ":" +
raw.slice(10, 12)
);
function validDate(){
var statType = $('.stats-container > .tab-nav').find('.active').data("tab");
var from_dt_val = $('#count_from_dt').val();
var to_dt_val = $('#count_to_dt').val();
if ("daily" === statType && (from_dt_val.length != 10 || to_dt_val.length != 10)) return false; // YYYY-MM-DD
if ("monthly" === statType && (from_dt_val.length != 7 || to_dt_val.length != 7)) return false; // YYYY-MM
if ("yearly" === statType && (from_dt_val.length != 4 || to_dt_val.length != 4)) return false; // YYYY
return true;
}
// 예시 데이터 (100개 생성)
// const apiLogs = Array.from({ length: 100 }, (_, i) => ({
// api: i % 2 === 0 ? "/API_CHA_085/request" : "/API_BH_020/dc332",
// method: ["GET", "POST", "PUT"][Math.floor(Math.random() * 3)],
// params: `subCode=test${i}&prvcCode=x${i}`,
// status: [ "200 OK", "404 NOT FOUND", "500 INTERNAL ERROR" ][Math.floor(Math.random() * 3)],
// time: Math.floor(Math.random() * 500),
// result: ["성공", "지연", "실패"][Math.floor(Math.random() * 3)]
// }));
// const rowsPerPage = 10;
// let currentPage = 1;
// function renderTable(page) {
// const tableBody = document.getElementById("apiLogBody");
// tableBody.innerHTML = "";
// const start = (page - 1) * rowsPerPage;
// const end = start + rowsPerPage;
// const pageData = apiLogs.slice(start, end);
// pageData.forEach(row => {
// const tr = document.createElement("tr");
// tr.innerHTML += '<td>' + row.api + '</td><td>' + row.method + '</td><td>' + row.params + '</td><td>' + row.status + '</td><td>' + row.time + '</td><td>' + getResultIcon(row.result) + ' ' +row.result + '</td>';
// tableBody.appendChild(tr);
// });
// }
// function renderPagination() {
// const totalPages = Math.ceil(apiLogs.length / rowsPerPage);
// const pagination = document.getElementById("pagination");
// pagination.innerHTML = "";
// for (let i = 1; i <= totalPages; i++) {
// const btn = document.createElement("button");
// btn.textContent = i;
// if (i === currentPage) btn.classList.add("active");
// btn.addEventListener("click", () => {
// currentPage = i;
// renderTable(currentPage);
// renderPagination();
// });
// pagination.appendChild(btn);
// }
// }
// function getResultIcon(result) {
// if (result === "성공")
// return `<span style="color:#22c55e;">✔</span>`;
// if (result === "실패")
// return `<span style="color:#ef4444;">⚠</span>`;
// if (result === "지연")
// return `<span style="color:#3b82f6;">⏱</span>`;
// return "";
// }
// 초기 렌더링
// renderTable(currentPage);
// renderPagination();
</script>
</body>

View File

@ -75,7 +75,14 @@ img { border:0; }
<tr>
<td>
<div class="menu-item active">
<span style="cursor:hand" onClick="javascript:goUrl('mgmt-api-index', '${menuId}')"><img src="${pageContext.request.contextPath}/images/renew/arrow-right.png" /> &nbsp;API 통계</span>
<span style="cursor:hand" onClick="javascript:goUrl('mgmt-api-index', '${menuId}')"><img src="${pageContext.request.contextPath}/images/renew/arrow-right.png" /> &nbsp;API 통계(내부 데이타)</span>
</div>
</td>
</tr>
<tr>
<td>
<div class="menu-item active">
<span style="cursor:hand" onClick="javascript:goUrl('mgmt-api-outdata', '${menuId}')"><img src="${pageContext.request.contextPath}/images/renew/arrow-right.png" /> &nbsp;API 통계(외부 데이타)</span>
</div>
</td>
</tr>

View File

@ -8,7 +8,6 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- MUI + Chart.js + jQuery -->
<link href="https://cdn.jsdelivr.net/npm/@mui/material@5.15.14/dist/material.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
@ -16,8 +15,83 @@
body { font-family: 'Pretendard', 'Roboto', sans-serif; background-color: #f5f6fa; margin: 0; padding: 20px; }
.text-center {text-align: center}
/* 승인 토글스위치 */
/* 스위치들을 한 줄에 나란히 */
.switch-group {
display: flex;
align-items: center;
gap: 15px; /* 스위치 간 간격 */
}
.molit-g-switch,.mois-g-switch, .mof-g-switch {
display: flex;
align-items: center;
gap: 5px;
margin-right: 10px;
}
/* 스위치 디자인 */
.mui-switch {
position: relative;
flex-shrink: 0; /* 스위치 크기 줄어들지 않게 */
display: inline-block;
width: 48px;
height: 26px;
}
.mui-switch input {
opacity: 0;
width: 0;
height: 0;
}
.mui-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: 0.4s;
border-radius: 34px;
display: flex;
align-items: center;
justify-content: ${''}; /* 가운데 맞춤 */
}
.mui-slider:before {
position: absolute;
content: "OFF";
color: #fff;
font-size: 10px;
height: 20px;
width: 20px;
left: 3px;
bottom: 3px;
background-color: #999;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
transition: 0.4s;
}
input:checked + .mui-slider {
background-color: #4A90E2;
}
input:checked + .mui-slider:before {
transform: translateX(22px);
content: "ON";
background-color: #1A73E8;
}
/* API 신청 내역 테이블 */
.table-container {
display: flex;
align-items: center;
justify-content: space-between; /* 제목 왼쪽, 스위치 오른쪽 */
margin-top: 25px; background: #fff; border-radius: 12px; padding: 20px;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
@ -56,6 +130,29 @@
<!-- API 신청 테이블 -->
<div class="table-container home-trainning">
<h3>API 신청 내역</h3>
<div class="switch-group">
<div class="molit-g-switch">국토교통부
<label class="mui-switch">
<input type="checkbox" class="globalSwitch" data-otype="국토교통부" onchange="toggleApproveKey(this)" checked>
<span class="mui-slider"></span>
</label>
</div>
<div class="mois-g-switch">행정안전부
<label class="mui-switch">
<input type="checkbox" class="globalSwitch" data-otype="행정안전부" onchange="toggleApproveKey(this)" checked>
<span class="mui-slider"></span>
</label>
</div>
<div class="mof-g-switch">해양수산부
<label class="mui-switch">
<input type="checkbox" class="globalSwitch" data-otype="해양수산부" onchange="toggleApproveKey(this)" checked>
<span class="mui-slider"></span>
</label>
</div>
</div>
</div>
<div class="table-container home-trainning">
<table class="Table_Main course-list-table">
<colgroup>
<col style="width: 3%">
@ -121,13 +218,9 @@
});
}
function drawApiKeyList(item) {
// 승인 상태에 따른 표시
let approveHtml = "";
if (item.approveYn == "Y") {
approveHtml = "승인됨";
} else {
approveHtml = `<button class="approve-btn" data-id="\${item.apiSeq}" onclick="approveKey(this);">승인</button>`;
}
// approveYn 이 "Y"이면 체크 상태, 아니면 체크 해제
const isChecked = item.approveYn === "Y" ? "checked" : "";
// HTML 문자열 생성
const html = `
<tr data-idx="\${item.apiSeq}">
@ -137,20 +230,41 @@
<td>\${item.apiKey}</td>
<td class="text-center">\${item.startDt}</td>
<td class="text-center">\${item.endDt}</td>
<td class="text-center">\${approveHtml}</td>
<td class="text-center approve-switch">
<label class="mui-switch">
<input type="checkbox" class="key-toggle" data-seq="\${item.apiSeq}" onchange="toggleApproveKey(this)" \${isChecked}>
<span class="mui-slider"></span>
</label></td>
<td class="text-center"><button class="approve-btn" data-id="\${item.apiSeq}" onclick="revokeKey(this);">삭제</button></td>
</tr>
`;
return html;
}
// 승인처리하기
function approveKey(e) {
let apiSeq = $(e).data("id")
function toggleApproveKey(ele) {
let apiSeq = $(ele).data("seq")
let seqArr = [];
let otype = !$(ele).data("otype") ? '' : $(ele).data("otype"); // 일괄변경 스위치 클릭한 경우
let approve = $(ele).is(":checked") ? "Y" : "N";
if (otype == '') {
seqArr.push($(ele).data("seq"));
}
// if (btnType == 'globalSwitch') {
// $('.approve-switch').each(function(i, el) {
// const idx = $(el).data('seq');
// seqArr.push(idx);
// });
// } else {
// seqArr.push($(ele).data("seq"));
// }
$.ajax({
type : "POST",
url : "/admins/mgmtApiKey/approve.do" ,
data : {apiSeq:apiSeq},
data : {seqArr:seqArr, approveYn: approve, otype: otype},
traditional: true,
dataType :"json",
success : function(res){ // res.code, res.msg, res.data

File diff suppressed because it is too large Load Diff