diff --git a/pom.xml b/pom.xml index aa83b33..ba3ca0a 100644 --- a/pom.xml +++ b/pom.xml @@ -83,11 +83,6 @@ - - egovframework.rte - egovframework.rte.psl.dataaccess - 2.7.0 - egovframework.rte egovframework.rte.fdl.idgnr @@ -351,12 +346,6 @@ 1.10 - - - egovframework.rte - egovframework.rte.fdl.property - 2.7.0 - @@ -468,6 +457,27 @@ json-simple 1.1.1 + + + + + + egovframework.rte + egovframework.rte.psl.dataaccess + 2.7.0 + system + ${project.basedir}/src/main/webapp/WEB-INF/lib/egovframework.rte.psl.dataaccess-2.7.0.jar + + + + + com.lowagie + com.lowagie.itext + 2.1.7 + system + ${project.basedir}/src/main/webapp/WEB-INF/lib/itext-2.1.7.js2.jar + + diff --git a/src/main/java/geoinfo/admins/apiManagement/ApiManagementController.java b/src/main/java/geoinfo/admins/apiManagement/ApiInDataManagementController.java similarity index 58% rename from src/main/java/geoinfo/admins/apiManagement/ApiManagementController.java rename to src/main/java/geoinfo/admins/apiManagement/ApiInDataManagementController.java index cf17f17..0cef203 100644 --- a/src/main/java/geoinfo/admins/apiManagement/ApiManagementController.java +++ b/src/main/java/geoinfo/admins/apiManagement/ApiInDataManagementController.java @@ -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 result = new HashMap(); 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 getMgmtApiInDataCounts(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { + strUtil sUtil = new strUtil(); + HashMap result = new HashMap(); + 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 getMgmtApiList(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { HashMap result = new HashMap(); - 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 getMgmtApiLogList(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { HashMap result = new HashMap(); - 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 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 getMgmtApiKeyList(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { - HashMap result = new HashMap(); - - 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 modMgmtApiKeyApprove(@RequestParam(value="apiSeq") int apiSeq, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { - HashMap result = new HashMap(); - - HashMap 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 modMgmtApiKeyRevoke(@RequestParam(value="apiSeq") int apiSeq, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { - HashMap result = new HashMap(); - - HashMap 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; - } } diff --git a/src/main/java/geoinfo/admins/apiManagement/ApiKeyManagementController.java b/src/main/java/geoinfo/admins/apiManagement/ApiKeyManagementController.java new file mode 100644 index 0000000..ffaa6e7 --- /dev/null +++ b/src/main/java/geoinfo/admins/apiManagement/ApiKeyManagementController.java @@ -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 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 getMgmtApiKeyList(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { + HashMap result = new HashMap(); + + 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 modMgmtApiKeyApprove( + @RequestParam(value="seqArr", required=false) List seqArr, + @RequestParam(value="approveYn", required=false) String approveYn, + @RequestParam(value="otype", required=false) String otype, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { + HashMap result = new HashMap(); + + HashMap 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 modMgmtApiKeyRevoke(@RequestParam(value="apiSeq") int apiSeq, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { + HashMap result = new HashMap(); + + HashMap 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; + } +} diff --git a/src/main/java/geoinfo/admins/apiManagement/ApiOutDataManagementController.java b/src/main/java/geoinfo/admins/apiManagement/ApiOutDataManagementController.java new file mode 100644 index 0000000..15b97fd --- /dev/null +++ b/src/main/java/geoinfo/admins/apiManagement/ApiOutDataManagementController.java @@ -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 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 getMgmtApiOutDataAccessChart(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { + strUtil sUtil = new strUtil(); + HashMap result = new HashMap(); + 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 getMgmtApiOutDataCounts(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { + strUtil sUtil = new strUtil(); + HashMap result = new HashMap(); + 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 getMgmtApiOutDataList(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { + HashMap result = new HashMap(); + + 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 modMgmtApiOutDataActiveYn( + @RequestParam(value="idxArr") List idxArr, + @RequestParam(value="activeYn", required=false) String activeYn, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { + HashMap result = new HashMap(); +// String sIdxArr[] = params.get("idx").toString().split(","); + System.out.println("idxArr = " + idxArr); + System.out.println("activeYn = " + activeYn); + + HashMap 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 getMgmtApiOutDataLogList(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { + HashMap result = new HashMap(); + + List listData = apiOutDataManagementService.selectWebApiLogList(params); + + result.put("code", "SUCCESS"); + result.put("msg", "API 호출 로그 목록 조회를 성공했습니다."); + result.put("data", listData); + + return result; + } +} diff --git a/src/main/java/geoinfo/admins/apiManagement/service/ApiInDataManagementMapper.java b/src/main/java/geoinfo/admins/apiManagement/service/ApiInDataManagementMapper.java new file mode 100644 index 0000000..b5fee9a --- /dev/null +++ b/src/main/java/geoinfo/admins/apiManagement/service/ApiInDataManagementMapper.java @@ -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 params) throws Exception; + + public List selectWebApiLogDailyCount(HashMap params) throws Exception; + + public List selectWebApiLogMonthlyCount(HashMap params) throws Exception; + + public List selectWebApiLogYearlyCount(HashMap params) throws Exception; + + public List selectInfo(HashMap params) throws Exception; + + public List selectWebApiLogList(HashMap params) throws Exception; + + public void saveInfo(HashMap params) throws Exception; + + public void updateInfoStatus(HashMap params) throws Exception; +} diff --git a/src/main/java/geoinfo/admins/apiManagement/service/ApiManagementService.java b/src/main/java/geoinfo/admins/apiManagement/service/ApiInDataManagementService.java similarity index 51% rename from src/main/java/geoinfo/admins/apiManagement/service/ApiManagementService.java rename to src/main/java/geoinfo/admins/apiManagement/service/ApiInDataManagementService.java index bb57386..806c2ec 100644 --- a/src/main/java/geoinfo/admins/apiManagement/service/ApiManagementService.java +++ b/src/main/java/geoinfo/admins/apiManagement/service/ApiInDataManagementService.java @@ -7,9 +7,15 @@ import egovframework.rte.psl.dataaccess.util.EgovMap; -public interface ApiManagementService { +public interface ApiInDataManagementService { public EgovMap selectDailyAccessCountByHour(HashMap params) throws Exception; + + public List selectWebApiLogDailyCount(HashMap params) throws Exception; + + public List selectWebApiLogMonthlyCount(HashMap params) throws Exception; + + public List selectWebApiLogYearlyCount(HashMap params) throws Exception; public List selectInfo(HashMap params) throws Exception; @@ -17,17 +23,6 @@ public interface ApiManagementService { public void saveInfo(HashMap params) throws Exception; -// public EgovMap selectDetailInfo(HashMap params) throws Exception; - -// public void deleteInfo(HashMap params) throws Exception; - -// public EgovMap selectModifyInfo(HashMap params) throws Exception; - public void updateInfoStatus(HashMap params) throws Exception; - public List selectWebApiKeyList(HashMap params) throws Exception; - - public void updateWebApiKeyApprove(HashMap params) throws Exception; - - public void deleteWebApiKey(HashMap params) throws Exception; } diff --git a/src/main/java/geoinfo/admins/apiManagement/service/ApiKeyManagementMapper.java b/src/main/java/geoinfo/admins/apiManagement/service/ApiKeyManagementMapper.java new file mode 100644 index 0000000..eb6bc33 --- /dev/null +++ b/src/main/java/geoinfo/admins/apiManagement/service/ApiKeyManagementMapper.java @@ -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 params) throws Exception; + + public void updateWebApiKeyApprove(HashMap params) throws Exception; + + public void deleteWebApiKey(HashMap params) throws Exception; +} diff --git a/src/main/java/geoinfo/admins/apiManagement/service/ApiKeyManagementService.java b/src/main/java/geoinfo/admins/apiManagement/service/ApiKeyManagementService.java new file mode 100644 index 0000000..786ab05 --- /dev/null +++ b/src/main/java/geoinfo/admins/apiManagement/service/ApiKeyManagementService.java @@ -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 params) throws Exception; + + public void updateWebApiKeyApprove(HashMap params) throws Exception; + + public void deleteWebApiKey(HashMap params) throws Exception; +} diff --git a/src/main/java/geoinfo/admins/apiManagement/service/ApiManagementMapper.java b/src/main/java/geoinfo/admins/apiManagement/service/ApiOutDataManagementMapper.java similarity index 52% rename from src/main/java/geoinfo/admins/apiManagement/service/ApiManagementMapper.java rename to src/main/java/geoinfo/admins/apiManagement/service/ApiOutDataManagementMapper.java index c89ef0e..4896b22 100644 --- a/src/main/java/geoinfo/admins/apiManagement/service/ApiManagementMapper.java +++ b/src/main/java/geoinfo/admins/apiManagement/service/ApiOutDataManagementMapper.java @@ -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 params) throws Exception; + + public List selectWebApiLogDailyCount(HashMap params) throws Exception; + + public List selectWebApiLogMonthlyCount(HashMap params) throws Exception; + + public List selectWebApiLogYearlyCount(HashMap params) throws Exception; public List selectInfo(HashMap params) throws Exception; @@ -17,17 +23,6 @@ public interface ApiManagementMapper { public void saveInfo(HashMap params) throws Exception; -// public EgovMap selectDetailInfo(HashMap params) throws Exception; - -// public void deleteInfo(HashMap params) throws Exception; - -// public EgovMap selectModifyInfo(HashMap params) throws Exception; - public void updateInfoStatus(HashMap params) throws Exception; - public List selectWebApiKeyList(HashMap params) throws Exception; - - public void updateWebApiKeyApprove(HashMap params) throws Exception; - - public void deleteWebApiKey(HashMap params) throws Exception; } diff --git a/src/main/java/geoinfo/admins/apiManagement/service/ApiOutDataManagementService.java b/src/main/java/geoinfo/admins/apiManagement/service/ApiOutDataManagementService.java new file mode 100644 index 0000000..0c7e16b --- /dev/null +++ b/src/main/java/geoinfo/admins/apiManagement/service/ApiOutDataManagementService.java @@ -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 params) throws Exception; + + public List selectWebApiLogDailyCount(HashMap params) throws Exception; + + public List selectWebApiLogMonthlyCount(HashMap params) throws Exception; + + public List selectWebApiLogYearlyCount(HashMap params) throws Exception; + + public List selectInfo(HashMap params) throws Exception; + + public List selectWebApiLogList(HashMap params) throws Exception; + + public void saveInfo(HashMap params) throws Exception; + + public void updateInfoStatus(HashMap params) throws Exception; +} diff --git a/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiInDataManagementServiceImpl.java b/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiInDataManagementServiceImpl.java new file mode 100644 index 0000000..1b1903a --- /dev/null +++ b/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiInDataManagementServiceImpl.java @@ -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 params) throws Exception { + return masterMapper.selectDailyAccessCountByHour(params); + } + + @Override + public List selectWebApiLogDailyCount(HashMap params) throws Exception { + return masterMapper.selectWebApiLogDailyCount(params); + } + + @Override + public List selectWebApiLogMonthlyCount(HashMap params) throws Exception { + return masterMapper.selectWebApiLogMonthlyCount(params); + } + + @Override + public List selectWebApiLogYearlyCount(HashMap params) throws Exception { + return masterMapper.selectWebApiLogYearlyCount(params); + } + + @Override + public List selectInfo(HashMap params) throws Exception { + return masterMapper.selectInfo(params); + } + + @Override + public List selectWebApiLogList(HashMap params) throws Exception { + return masterMapper.selectWebApiLogList(params); + } + + @Override + public void saveInfo(HashMap params) throws Exception { + masterMapper.saveInfo(params); + } + + @Override + public void updateInfoStatus(HashMap params) throws Exception { + masterMapper.updateInfoStatus(params); + } + +} diff --git a/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiKeyManagementServiceImpl.java b/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiKeyManagementServiceImpl.java new file mode 100644 index 0000000..19de7aa --- /dev/null +++ b/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiKeyManagementServiceImpl.java @@ -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 params) throws Exception { + return masterMapper.selectWebApiKeyList(params); + } + + @Override + public void updateWebApiKeyApprove(HashMap params) throws Exception { + masterMapper.updateWebApiKeyApprove(params); + } + + @Override + public void deleteWebApiKey(HashMap params) throws Exception { + masterMapper.deleteWebApiKey(params); + + } + +} diff --git a/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiManagementServiceImpl.java b/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiManagementServiceImpl.java deleted file mode 100644 index 22decf7..0000000 --- a/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiManagementServiceImpl.java +++ /dev/null @@ -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 params) throws Exception { - return masterMapper.selectDailyAccessCountByHour(params); - } - - @Override - public List selectInfo(HashMap params) throws Exception { - return masterMapper.selectInfo(params); - } - - @Override - public List selectWebApiLogList(HashMap params) throws Exception { - return masterMapper.selectWebApiLogList(params); - } - - @Override - public void saveInfo(HashMap params) throws Exception { - masterMapper.saveInfo(params); - } - -// @Override -// public EgovMap selectDetailInfo(HashMap params) throws Exception { -// return masterMapper.selectDetailInfo(params); -// } - -// @Override -// public void deleteInfo(HashMap params) throws Exception { -// masterMapper.deleteInfo(params); -// } - -// @Override -// public EgovMap selectModifyInfo(HashMap params) throws Exception { -// return masterMapper.selectModifyInfo(params); -// } - - @Override - public void updateInfoStatus(HashMap params) throws Exception { - masterMapper.updateInfoStatus(params); - } - - @Override - public List selectWebApiKeyList(HashMap params) throws Exception { - return masterMapper.selectWebApiKeyList(params); - } - - @Override - public void updateWebApiKeyApprove(HashMap params) throws Exception { - masterMapper.updateWebApiKeyApprove(params); - } - - @Override - public void deleteWebApiKey(HashMap params) throws Exception { - masterMapper.deleteWebApiKey(params); - - } - -} diff --git a/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiOutDataManagementServiceImpl.java b/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiOutDataManagementServiceImpl.java new file mode 100644 index 0000000..25abcf9 --- /dev/null +++ b/src/main/java/geoinfo/admins/apiManagement/service/impl/ApiOutDataManagementServiceImpl.java @@ -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 params) throws Exception { + return masterMapper.selectDailyAccessCountByHour(params); + } + + @Override + public List selectWebApiLogDailyCount(HashMap params) throws Exception { + return masterMapper.selectWebApiLogDailyCount(params); + } + + @Override + public List selectWebApiLogMonthlyCount(HashMap params) throws Exception { + return masterMapper.selectWebApiLogMonthlyCount(params); + } + + @Override + public List selectWebApiLogYearlyCount(HashMap params) throws Exception { + return masterMapper.selectWebApiLogYearlyCount(params); + } + + @Override + public List selectInfo(HashMap params) throws Exception { + return masterMapper.selectInfo(params); + } + + @Override + public List selectWebApiLogList(HashMap params) throws Exception { + return masterMapper.selectWebApiLogList(params); + } + + @Override + public void saveInfo(HashMap params) throws Exception { + masterMapper.saveInfo(params); + } + + @Override + public void updateInfoStatus(HashMap params) throws Exception { + masterMapper.updateInfoStatus(params); + } +} diff --git a/src/main/java/geoinfo/admins/constructionProjectManagement/ConstructionProjectManagementController.java b/src/main/java/geoinfo/admins/constructionProjectManagement/ConstructionProjectManagementController.java index 0064c94..5655059 100644 --- a/src/main/java/geoinfo/admins/constructionProjectManagement/ConstructionProjectManagementController.java +++ b/src/main/java/geoinfo/admins/constructionProjectManagement/ConstructionProjectManagementController.java @@ -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 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 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 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"; + } + } diff --git a/src/main/java/geoinfo/admins/user/service/GeneralUserMngMapper.java b/src/main/java/geoinfo/admins/user/service/GeneralUserMngMapper.java index d1535fd..916319f 100644 --- a/src/main/java/geoinfo/admins/user/service/GeneralUserMngMapper.java +++ b/src/main/java/geoinfo/admins/user/service/GeneralUserMngMapper.java @@ -48,4 +48,5 @@ public interface GeneralUserMngMapper { public void updateUserPassInfo(HashMap params) throws Exception; + public List selectUserLoginHistory(HashMap params) throws Exception; } diff --git a/src/main/java/geoinfo/admins/user/service/GeneralUserMngService.java b/src/main/java/geoinfo/admins/user/service/GeneralUserMngService.java index d49e708..c4a9743 100644 --- a/src/main/java/geoinfo/admins/user/service/GeneralUserMngService.java +++ b/src/main/java/geoinfo/admins/user/service/GeneralUserMngService.java @@ -46,5 +46,6 @@ public interface GeneralUserMngService { public void updateUserPassInfo(HashMap params) throws Exception; - + public List selectUserLoginHistory(HashMap params) throws Exception; + } diff --git a/src/main/java/geoinfo/admins/user/service/impl/GeneralUserMngServiceImpl.java b/src/main/java/geoinfo/admins/user/service/impl/GeneralUserMngServiceImpl.java index d8ec5e7..789e367 100644 --- a/src/main/java/geoinfo/admins/user/service/impl/GeneralUserMngServiceImpl.java +++ b/src/main/java/geoinfo/admins/user/service/impl/GeneralUserMngServiceImpl.java @@ -113,4 +113,9 @@ public class GeneralUserMngServiceImpl implements GeneralUserMngService { masterMapper.updateUserPassInfo(params); } + @Override + public List selectUserLoginHistory(HashMap params) throws Exception { + return masterMapper.selectUserLoginHistory(params); + } + } diff --git a/src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_SQL.xml b/src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_Indata_SQL.xml similarity index 61% rename from src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_SQL.xml rename to src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_Indata_SQL.xml index 430332b..1ba8a6e 100644 --- a/src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_SQL.xml +++ b/src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_Indata_SQL.xml @@ -1,7 +1,7 @@ - + + + + + + + + + - - - - - - - - @@ -121,46 +155,4 @@ ) - - - - - - - - UPDATE WEB_API_KEY - SET - - APPROVE_YN = #{approveYn} - - WHERE API_SEQ IN (#{apiSeq}) - - - - - DELETE - FROM WEB_API_KEY - WHERE API_SEQ IN (#{apiSeq}) - \ No newline at end of file diff --git a/src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_Key_SQL.xml b/src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_Key_SQL.xml new file mode 100644 index 0000000..d2dd8ac --- /dev/null +++ b/src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_Key_SQL.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + UPDATE WEB_API_KEY + SET + + APPROVE_YN = #{approveYn} + + + + + API_SEQ IN + + #{item} + + + + + + AND USER_TYPE = #{otype} + + + + + + + DELETE + FROM WEB_API_KEY + WHERE API_SEQ IN (#{apiSeq}) + + \ No newline at end of file diff --git a/src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_Outdata_SQL.xml b/src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_Outdata_SQL.xml new file mode 100644 index 0000000..331650b --- /dev/null +++ b/src/main/resources/geoinfo/sqlmap/mappers/admins/mgmt/Mgmt_Api_Outdata_SQL.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE WEB_API_OUTBOUND + SET + + ACTIVE_YN = #{activeYn} + + WHERE IDX IN ( + + #{item} + + ) + + \ No newline at end of file diff --git a/src/main/resources/geoinfo/sqlmap/mappers/admins/user/GeneralUserMng_SQL.xml b/src/main/resources/geoinfo/sqlmap/mappers/admins/user/GeneralUserMng_SQL.xml index 7fe6328..2393e3c 100644 --- a/src/main/resources/geoinfo/sqlmap/mappers/admins/user/GeneralUserMng_SQL.xml +++ b/src/main/resources/geoinfo/sqlmap/mappers/admins/user/GeneralUserMng_SQL.xml @@ -428,5 +428,30 @@ userid = #{userId} ]]> + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/lib/itext-2.1.7.js2.jar b/src/main/webapp/WEB-INF/lib/itext-2.1.7.js2.jar new file mode 100644 index 0000000..5d319fc Binary files /dev/null and b/src/main/webapp/WEB-INF/lib/itext-2.1.7.js2.jar differ diff --git a/src/main/webapp/WEB-INF/views/admins/constructionProjectManagement/construction-user-login-history.jsp b/src/main/webapp/WEB-INF/views/admins/constructionProjectManagement/construction-user-login-history.jsp new file mode 100644 index 0000000..8c99c1b --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admins/constructionProjectManagement/construction-user-login-history.jsp @@ -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" %> + + + + + + + + + +
+ + + + + + +<%-- + + + + + + + --%> + + + +

발주기관 로그인 내역

 
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
번호아이디이름소속로그인일시로그인여부
${resultList.num}${resultList.userid}${resultList.userName}${resultList.companyName}${resultList.note}
+ + + + + + + + + + +<%-- --%> + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/admins/constructionProjectManagement/left.jsp b/src/main/webapp/WEB-INF/views/admins/constructionProjectManagement/left.jsp index e4bbf32..011ee34 100644 --- a/src/main/webapp/WEB-INF/views/admins/constructionProjectManagement/left.jsp +++ b/src/main/webapp/WEB-INF/views/admins/constructionProjectManagement/left.jsp @@ -80,6 +80,9 @@ img { border:0; } + diff --git a/src/main/webapp/WEB-INF/views/admins/mgmtApi/api-request-statistics-index.jsp b/src/main/webapp/WEB-INF/views/admins/mgmtApi/api-request-statistics-index.jsp index 7ad1702..358c620 100644 --- a/src/main/webapp/WEB-INF/views/admins/mgmtApi/api-request-statistics-index.jsp +++ b/src/main/webapp/WEB-INF/views/admins/mgmtApi/api-request-statistics-index.jsp @@ -3,27 +3,138 @@ <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%> - - + + - - + - @@ -190,10 +312,79 @@

📈 일일 접속량

- + +
+ +
+ +
+
+

국토지반 API 호출 통계

+ +
+ + + +
+
+ ~ + +
+
+

일별 API 호출 현황

+ + + + + + + + + + + +
날짜API 명호출 건수
표시 할 통계데이타가 없습니다.
+
+
+

월별 API 호출 현황

+ + + + + + + + + + + +
API 명총 호출 건수
표시 할 통계데이타가 없습니다.
+
+
+

연도별 API 호출 현황

+ + + + + + + + + + + +
연도API 명총 호출 건수
표시 할 통계데이타가 없습니다.
+
+
+
+
@@ -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('표시 할 통계데이타가 없습니다.'); + 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 += ` + \${idx === 0 ? `\${period}` : ''} + \${item.apiName} + \${item.accessCount} 건 + `; + }); + }); + + // 합계 row 추가 + html += ` + 합계 + \${totalCount} 건 + `; + + $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 += '' + row.api + '' + row.method + '' + row.params + '' + row.status + '' + row.time + '' + getResultIcon(row.result) + ' ' +row.result + ''; -// 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 ``; -// if (result === "실패") -// return ``; -// if (result === "지연") -// return ``; -// return ""; -// } - - // 초기 렌더링 -// renderTable(currentPage); -// renderPagination(); diff --git a/src/main/webapp/WEB-INF/views/admins/mgmtApi/left.jsp b/src/main/webapp/WEB-INF/views/admins/mgmtApi/left.jsp index 3d7525b..7cf32c2 100644 --- a/src/main/webapp/WEB-INF/views/admins/mgmtApi/left.jsp +++ b/src/main/webapp/WEB-INF/views/admins/mgmtApi/left.jsp @@ -75,7 +75,14 @@ img { border:0; } + + + + + diff --git a/src/main/webapp/WEB-INF/views/admins/mgmtApi/mgmt-api-key.jsp b/src/main/webapp/WEB-INF/views/admins/mgmtApi/mgmt-api-key.jsp index 55ac374..ed4d0b8 100644 --- a/src/main/webapp/WEB-INF/views/admins/mgmtApi/mgmt-api-key.jsp +++ b/src/main/webapp/WEB-INF/views/admins/mgmtApi/mgmt-api-key.jsp @@ -8,7 +8,6 @@ - @@ -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 신청 내역

+ +
+
국토교통부 + +
+
행정안전부 + +
+
해양수산부 + +
+
+
+
@@ -121,13 +218,9 @@ }); } function drawApiKeyList(item) { - // 승인 상태에 따른 표시 - let approveHtml = ""; - if (item.approveYn == "Y") { - approveHtml = "승인됨"; - } else { - approveHtml = ``; - } + + // approveYn 이 "Y"이면 체크 상태, 아니면 체크 해제 + const isChecked = item.approveYn === "Y" ? "checked" : ""; // HTML 문자열 생성 const html = ` @@ -137,20 +230,41 @@ - + `; 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 diff --git a/src/main/webapp/WEB-INF/views/admins/mgmtApi/mgmt-api-outdata.jsp b/src/main/webapp/WEB-INF/views/admins/mgmtApi/mgmt-api-outdata.jsp new file mode 100644 index 0000000..ddf8e2d --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admins/mgmtApi/mgmt-api-outdata.jsp @@ -0,0 +1,1025 @@ +<%@ 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"%> + + + + + + + + + + + + + + + + +
+

📈 일일 접속량

+ +
+ +
+ +
+ + +
+
+

국토지반 API 호출 통계

+ +
+ + + +
+
+ ~ + +
+
+

일별 API 호출 현황

+
\${item.apiKey} \${item.startDt} \${item.endDt}\${approveHtml} +
+ + + + + + + + + + +
날짜API 명호출 건수
표시 할 통계데이타가 없습니다.
+
+
+

월별 API 호출 현황

+ + + + + + + + + + + +
API 명총 호출 건수
표시 할 통계데이타가 없습니다.
+
+
+

연도별 API 호출 현황

+ + + + + + + + + + + +
연도API 명총 호출 건수
표시 할 통계데이타가 없습니다.
+
+
+
+ +
+ +
+
+

API 호출 현황

+
+ +
+
+
+
+
호출 성공
+ 3초 이내 응답 +
+
+
0%
+
+ +
+
+
+
+
호출 실패
+ API 실패 +
+
+
0%
+
+ +
+
+
🕓
+
+
호출 지연
+ 3초 초과 지연 +
+
+
0%
+
+ +
+
+
⚠️
+
+
호출 오류
+ 오류 응답 +
+
+
0%
+
+
+ + +
+
+

API 호출 통제

+ +
+ +
+
+
+
표시 할 API 목록이 존재하지 않습니다.
+
API를 등록해주세요.
+
+
+
+
+
+ + +
+

API 호출 로그

+ + + + + + + + + + + + + + + + + + + + + + + +
No.API_KEYACCESS_IDACCESS_TYPEACCESS_TABLEACCESS_DTIP_ADDRESS
+ + + +
+ + + + +