104 lines
3.2 KiB
Java
104 lines
3.2 KiB
Java
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 geoinfo.admins.apiManagement.service.ApiManagementService;
|
|
import geoinfo.session.UserInfo;
|
|
|
|
|
|
|
|
@Controller
|
|
public class ApiManagementController {
|
|
@Resource(name = "apiManagementService")
|
|
private ApiManagementService apiManagementService;
|
|
|
|
/**
|
|
* API 관리 > API 통계 화면
|
|
* @param params
|
|
* @param model
|
|
* @param response
|
|
* @param request
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
@RequestMapping(value = "admins/mgmtApi/mgmt-api-index.do")
|
|
public String goMgmtApiIndex(@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/api-request-statistics-index";
|
|
}
|
|
|
|
/**
|
|
* API 관리 > 관리 API 목록
|
|
* @param params
|
|
* @param model
|
|
* @param response
|
|
* @param request
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value = "/admins/mgmtApi/list.do", method = RequestMethod.POST)
|
|
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);
|
|
|
|
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/toggleSts.do", method = RequestMethod.POST)
|
|
public HashMap<String, Object> modMgmtApiActiveYn(
|
|
@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);
|
|
|
|
apiManagementService.updateInfoStatus(params);
|
|
|
|
List<?> listData = apiManagementService.selectInfo(params);
|
|
|
|
result.put("code", "SUCCESS");
|
|
result.put("msg", "관리 API 목록 조회를 성공했습니다.");
|
|
result.put("data", listData);
|
|
|
|
return result;
|
|
}
|
|
}
|