API 키 신청(KEY 발급 회원의 경우 KEY 정보 표시)
parent
f4898c508d
commit
39c4fb1f46
|
|
@ -3,6 +3,7 @@ package geoinfo.main.api;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
|
@ -13,22 +14,30 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.util.EgovMap;
|
||||||
|
import geoinfo.main.api.service.ApiService;
|
||||||
import geoinfo.util.KeyGenerator;
|
import geoinfo.util.KeyGenerator;
|
||||||
import ictway.comm.util.parseData;
|
import ictway.comm.util.parseData;
|
||||||
import ictway.comm.util.strUtil;
|
import ictway.comm.util.strUtil;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class ApiController {
|
public class ApiController {
|
||||||
Logger log = Logger.getLogger(this.getClass());
|
Logger log = Logger.getLogger(this.getClass());
|
||||||
|
|
||||||
|
@Resource(name = "apiService")
|
||||||
|
private ApiService apiService;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 사용자 > API 신청 화면
|
* 사용자 > API 신청 화면
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "apiKey.do")
|
@RequestMapping(value = "apiKey.do")
|
||||||
public ModelAndView goApiKeyPage(ModelAndView model, @RequestParam HashMap<String, Object> params) throws Exception {
|
public ModelAndView goApiKeyPage(HttpServletRequest request, HttpServletResponse response, ModelAndView model, @RequestParam HashMap<String, Object> params) throws Exception {
|
||||||
|
|
||||||
|
String loginUserId = String.valueOf(request.getSession().getAttribute("USERID"));
|
||||||
|
params.put("userid", loginUserId);
|
||||||
|
HashMap<String, Object> userLastApiKey = apiService.selectUserLatestKey(params);
|
||||||
|
|
||||||
|
model.addObject("userLastApiKey", userLastApiKey);
|
||||||
model.setViewName("body/api/apiKey");
|
model.setViewName("body/api/apiKey");
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package geoinfo.main.api.service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import egovframework.rte.psl.dataaccess.util.EgovMap;
|
||||||
|
|
||||||
|
@Mapper("ApiMapper")
|
||||||
|
public interface ApiMapper {
|
||||||
|
|
||||||
|
public int selectInfoListCnt(HashMap<String, Object> params) throws Exception;
|
||||||
|
|
||||||
|
public List<?> selectInfoList(HashMap<String, Object> params) throws Exception;
|
||||||
|
|
||||||
|
HashMap<String, Object> selectUserLatestKey(HashMap<String, Object> params) throws Exception;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package geoinfo.main.api.service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.util.EgovMap;
|
||||||
|
|
||||||
|
public interface ApiService {
|
||||||
|
|
||||||
|
int selectInfoListCnt(HashMap<String, Object> params) throws Exception;
|
||||||
|
|
||||||
|
List<?> selectInfoList(HashMap<String, Object> params) throws Exception;
|
||||||
|
|
||||||
|
HashMap<String, Object> selectUserLatestKey(HashMap<String, Object> params) throws Exception;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package geoinfo.main.api.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.main.api.service.ApiMapper;
|
||||||
|
import geoinfo.main.api.service.ApiService;
|
||||||
|
|
||||||
|
@Service("apiService")
|
||||||
|
public class ApiServiceImpl implements ApiService{
|
||||||
|
|
||||||
|
@Resource(name="ApiMapper")
|
||||||
|
private ApiMapper ApiMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int selectInfoListCnt(HashMap<String, Object> params) throws Exception {
|
||||||
|
return ApiMapper.selectInfoListCnt(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<?> selectInfoList(HashMap<String, Object> params) throws Exception {
|
||||||
|
return ApiMapper.selectInfoList(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<String, Object> selectUserLatestKey(HashMap<String, Object> params) throws Exception {
|
||||||
|
return ApiMapper.selectUserLatestKey(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?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.main.api.service.ApiMapper">
|
||||||
|
<select id="selectInfoList" parameterType="hashmap" resultType="org.apache.commons.collections.map.CaseInsensitiveMap">
|
||||||
|
<![CDATA[
|
||||||
|
SELECT IDX, NAME, Substr(SUBJECT, 1, 29) AS SUBJECT, SUBJECT AS SUBJECTLEN,
|
||||||
|
READCOUNT, DATETIME, RN, REPLACE(CONTENT, '<br>', '') CONTENT
|
||||||
|
FROM (SELECT ROWNUM RN, IDX, NAME, SUBJECT, READCOUNT, DATETIME, CONTENT
|
||||||
|
FROM (SELECT IDX, NAME, SUBJECT, READCOUNT, CONTENT,
|
||||||
|
To_char(DATETIME, 'YYYY-MM-DD') DATETIME
|
||||||
|
FROM WEB_BOARD_CH
|
||||||
|
WHERE CLS=2
|
||||||
|
ORDER BY DATETIME DESC
|
||||||
|
)
|
||||||
|
]]>
|
||||||
|
<if test="searchKey != null">
|
||||||
|
WHERE SUBJECT LIKE '%' || #{searchKey} || '%' OR CONTENT LIKE '%' || #{searchKey} || '%'
|
||||||
|
</if>
|
||||||
|
<![CDATA[
|
||||||
|
)
|
||||||
|
WHERE RN BETWEEN #{firstIndex} + 1
|
||||||
|
AND #{firstIndex} + #{recordCountPerPage}
|
||||||
|
]]>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectInfoListCnt" parameterType="hashmap" resultType="int">
|
||||||
|
<![CDATA[
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM WEB_BOARD_CH
|
||||||
|
WHERE CLS=2
|
||||||
|
]]>
|
||||||
|
<if test="searchKey != null">
|
||||||
|
AND SUBJECT LIKE '%' || #{searchKey} || '%' OR CONTENT LIKE '%' || #{searchKey} || '%'
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 사용자 최근 API KEY 조회 -->
|
||||||
|
<select id="selectUserLatestKey" parameterType="map" resultType="HashMap">
|
||||||
|
SELECT *
|
||||||
|
FROM (SELECT *
|
||||||
|
FROM WEB_API_KEY
|
||||||
|
WHERE USERID = #{userid}
|
||||||
|
AND END_DT >= SYSDATE
|
||||||
|
ORDER BY END_DT DESC)
|
||||||
|
WHERE ROWNUM = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -1,24 +1,62 @@
|
||||||
<%@ page language="java" contentType="text/html; charset=utf-8"%>
|
<%@ page language="java" contentType="text/html; charset=utf-8"%>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||||
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form name="frm" method="post">
|
<c:choose>
|
||||||
|
<c:when test="${not empty userLastApiKey}">
|
||||||
|
<!-- <div> -->
|
||||||
|
<%-- <p>API_SEQ: ${userLastApiKey.API_SEQ}</p> --%>
|
||||||
|
<%-- <p>USERID: ${userLastApiKey.USERID}</p> --%>
|
||||||
|
<%-- <p>USER_TYPE: ${userLastApiKey.USER_TYPE}</p> --%>
|
||||||
|
<%-- <p>API_KEY: ${userLastApiKey.API_KEY}</p> --%>
|
||||||
|
<%-- <p>START_DT: <fmt:formatDate value="${userLastApiKey.START_DT}" pattern="yyyy-MM-dd HH:mm:ss" /></p> --%>
|
||||||
|
<%-- <p>END_DT: <fmt:formatDate value="${userLastApiKey.END_DT}" pattern="yyyy-MM-dd HH:mm:ss" /></p> --%>
|
||||||
|
<%-- <p>APPROVE_YN: ${userLastApiKey.APPROVE_YN}</p> --%>
|
||||||
|
<!-- </div> -->
|
||||||
|
|
||||||
|
<div class="table-scrollable">
|
||||||
|
|
||||||
|
<table class="table table-bordered table-data">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>신청일</th>
|
||||||
|
<td><fmt:formatDate value="${userLastApiKey.START_DT}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
|
||||||
|
<th>만료일</th>
|
||||||
|
<td><fmt:formatDate value="${userLastApiKey.END_DT}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
|
||||||
|
<th>승인상태</th>
|
||||||
|
<td>${userLastApiKey.APPROVE_YN eq 'Y' ? '승인' : '미승인'}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="6">신청 KEY</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">${userLastApiKey.API_KEY}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<form name="frm" method="post">
|
||||||
|
|
||||||
|
<%-- 사용자 타입(국토교통부/행정안전부/해안수산부/기타공공기관/일반) --%>
|
||||||
|
<ul class="row marB30">
|
||||||
|
<li class="col col-xs-4 text-center"><label><input type="radio" name="userType" value="국토교통부">국토교통부</label></li>
|
||||||
|
<li class="col col-xs-4 text-center"><label><input type="radio" name="userType" value="행정안전부">행정안전부</label></li>
|
||||||
|
<li class="col col-xs-4 text-center"><label><input type="radio" name="userType" value="해양수산부">해양수산부</label></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="row text-center">
|
||||||
|
<a href="javascript:void(0);" class="apiKeyReq btn btn-large btn-green" onclick="javascript:generateApiKey();"> 신청하기 </a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
|
||||||
<%-- 사용자 타입(국토교통부/행정안전부/해안수산부/기타공공기관/일반) --%>
|
|
||||||
<ul class="row marB30">
|
|
||||||
<li class="col col-xs-4 text-center"><label><input type="radio" name="userType" value="국토교통부">국토교통부</label></li>
|
|
||||||
<li class="col col-xs-4 text-center"><label><input type="radio" name="userType" value="행정안전부">행정안전부</label></li>
|
|
||||||
<li class="col col-xs-4 text-center"><label><input type="radio" name="userType" value="해양수산부">해양수산부</label></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="row text-center">
|
|
||||||
<a href="javascript:void(0);" class="apiKeyReq btn btn-large btn-green" onclick="javascript:generateApiKey();"> 신청하기 </a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!--function 정의 -->
|
<!--function 정의 -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,7 @@
|
||||||
$(".nav > li.dropdown:eq(6)").addClass("on");
|
$(".nav > li.dropdown:eq(6)").addClass("on");
|
||||||
// 왼쪽메뉴 활성화
|
// 왼쪽메뉴 활성화
|
||||||
$("#community_sub_menu").css("display", "block");
|
$("#community_sub_menu").css("display", "block");
|
||||||
$("#community_sub_menu > li.nav-item:eq(4)").addClass("active");
|
$("#community_sub_menu > li.nav-item:eq(5)").addClass("active");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<!-- 커뮤니티 > 시추정보 Q&A 끝 -->
|
<!-- 커뮤니티 > 시추정보 Q&A 끝 -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue