package geoinfo.admins.constructionProjectManagement; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import egovframework.rte.psl.dataaccess.util.EgovMap; import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; import geoinfo.admins.constructionProjectManagement.service.ConstructionProjectManagementService; import geoinfo.admins.user.service.DrillingInquiryService; import geoinfo.admins.user.service.GeneralUserMngService; import geoinfo.admins.user.service.HomeTrainingService; import geoinfo.comm.util.strUtil; import geoinfo.session.UserInfo; import geoinfo.util.MyUtil; @Controller public class ConstructionProjectManagementController { @Resource(name = "generalUserMngService") private GeneralUserMngService masterService; @Resource(name = "homeTrainingService") private HomeTrainingService homeTrainingService; // [변경] 새로 만든 서비스 주입 @Resource(name = "constructionProjectManagementService") private ConstructionProjectManagementService constructionProjectManagementService; // [추가] 기존 검색/조회 기능을 위해 필요 (변수 선언 추가) @Resource(name = "drillingInquiryService") private DrillingInquiryService drillingInquiryService; /** * 건설현장 통계 화면 * @param params * @param model * @param response * @param request * @return * @throws Exception */ @RequestMapping(value = "admins/constructionProjectManagement/construction-project-statistics-index.do") public String homeTrainingIndex(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { if (!UserInfo.isValidSession(request, response, "admin")) { return ""; } model.addAttribute("params", params); return "admins/constructionProjectManagement/construction-project-statistics-index"; } /** * 건설현장 통계 데이터 조회 (AJAX) */ @RequestMapping(value = "admins/constructionProjectManagement/selectStatistics.do", method = RequestMethod.POST) @ResponseBody public JSONObject selectStatistics(HttpServletRequest request, @RequestBody String strJSON, HttpServletResponse response) { JSONObject jsonResponse = new JSONObject(); try { // 1. 파라미터 파싱 JSONParser jsonParser = new JSONParser(); JSONObject jsonObject = (JSONObject) jsonParser.parse(strJSON); HashMap params = new HashMap<>(); if (jsonObject != null) { for(Object key : jsonObject.keySet()){ params.put((String)key, jsonObject.get(key)); } } // 2. 서비스 호출 (새로 만든 서비스 사용) Map stats = constructionProjectManagementService.selectConstructionProjectStatistics(params); jsonResponse.put("result", "true"); jsonResponse.put("data", stats); } catch (Exception e) { jsonResponse.put("result", "false"); jsonResponse.put("message", e.getMessage()); e.printStackTrace(); } return jsonResponse; } /** * 집합교육 추가 * @param request * @param strJSON * @param response * @return */ @RequestMapping(value = "admins/constructionProjectManagement/home-training-index/add.do", method = RequestMethod.POST) @ResponseBody public JSONObject addHomeTraining( HttpServletRequest request, @RequestBody String strJSON, HttpServletResponse response) { JSONObject jsonResponse = new JSONObject(); System.out.println( "\n--------------------------------------------------------------\n" + request.getRequestURI() + " IN:" + "\n--------------------------------------------------------------\n" + "strJSON" + strJSON + "\n" + "\n--------------------------------------------------------------\n" ); JSONParser jsonParser = new JSONParser(); JSONArray jsonArr = null; boolean isFail = false; String failMsg = ""; try { jsonArr = (JSONArray)jsonParser.parse(strJSON); for (Object obj : jsonArr) { JSONObject jsonObject = (JSONObject) obj; // JSONObject를 HashMap으로 변환 HashMap params = new HashMap<>(); for (Object key : jsonObject.keySet()) { String keyStr = (String) key; Object value = jsonObject.get(keyStr); params.put(keyStr, value); } try { HashMap hashMap = homeTrainingService.addHomeTraining(request, response, params); int nRetCode = MyUtil.getIntegerFromObject(hashMap.get("p_result_code")); String lpszRetMsg = MyUtil.getStringFromObject(hashMap.get("p_err_msg")); long lWvtRegId = MyUtil.getLongFromObject(hashMap.get("p_wvt_reg_id")); if( nRetCode == 100 ) { jsonResponse.put("resultCode", nRetCode); jsonResponse.put("result", "true"); jsonResponse.put("message", "등록이 완료되었습니다."); } else { if( nRetCode == 11 ) { lpszRetMsg += "\n" + "사업명: " + params.get("constName"); } jsonResponse.put("resultCode", nRetCode); jsonResponse.put("result", "false"); jsonResponse.put("message", lpszRetMsg); isFail = true; failMsg = lpszRetMsg; break; } } catch (Exception e) { // TODO Auto-generated catch block String strTxt = "---------- BUG REPORTING START ----------" + "\n" + "에러 문구:[" + request.getRequestURI() + " " + "]" + "\n" + "strJSON:[\n" + strJSON + "\n]\n" + "e.getMessage():[\n" + e.getMessage() + "\n]\n" + "\n" + "new Date().toString():[" + new Date().toString() + "]\n" + "\n" + "---------- BUG REPORTING END ----------" + "\n" + ""; System.out.println(strTxt); jsonResponse.put("resultCode", -1); jsonResponse.put("result", "false"); jsonResponse.put("message", e.getMessage()); } } } catch (org.json.simple.parser.ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } if( isFail ) { jsonResponse.put("resultCode", -2); jsonResponse.put("result", "false"); jsonResponse.put("message", failMsg); } System.out.println("\n--------------------------------------------------------------\n" + request.getRequestURI() + " OUT:" + "\n--------------------------------------------------------------\n" + "jsonResponse.toJSONString():[" + jsonResponse.toJSONString() + "]\n" + "\n--------------------------------------------------------------\n"); return jsonResponse; } /** * 집합교육 수정 * @param request * @param strJSON * @param response * @return */ @RequestMapping(value = "admins/constructionProjectManagement/home-training-index/update.do", method = RequestMethod.POST) @ResponseBody public JSONObject updateHomeTraining( HttpServletRequest request, @RequestBody String strJSON, HttpServletResponse response) { JSONObject jsonResponse = new JSONObject(); System.out.println( "\n--------------------------------------------------------------\n" + request.getRequestURI() + " IN:" + "\n--------------------------------------------------------------\n" + "strJSON" + strJSON + "\n" + "\n--------------------------------------------------------------\n" ); JSONParser jsonParser = new JSONParser(); JSONArray jsonArr = null; boolean isFail = false; String failMsg = ""; try { jsonArr = (JSONArray)jsonParser.parse(strJSON); for (Object obj : jsonArr) { JSONObject jsonObject = (JSONObject) obj; // JSONObject를 HashMap으로 변환 HashMap params = new HashMap<>(); for (Object key : jsonObject.keySet()) { String keyStr = (String) key; Object value = jsonObject.get(keyStr); params.put(keyStr, value); } try { HashMap hashMap = homeTrainingService.updateHomeTraining(request, response, params); int nRetCode = MyUtil.getIntegerFromObject(hashMap.get("p_result_code")); String lpszRetMsg = MyUtil.getStringFromObject(hashMap.get("p_err_msg")); if( nRetCode == 100 ) { jsonResponse.put("resultCode", nRetCode); jsonResponse.put("result", "true"); jsonResponse.put("message", "수정이 완료되었습니다."); } else { if( nRetCode == 11 ) { lpszRetMsg += "\n" + "사업명: " + params.get("constName"); } jsonResponse.put("resultCode", nRetCode); jsonResponse.put("result", "false"); jsonResponse.put("message", lpszRetMsg); isFail = true; failMsg = lpszRetMsg; break; } } catch (Exception e) { // TODO Auto-generated catch block String strTxt = "---------- BUG REPORTING START ----------" + "\n" + "에러 문구:[" + request.getRequestURI() + " " + "]" + "\n" + "strJSON:[\n" + strJSON + "\n]\n" + "e.getMessage():[\n" + e.getMessage() + "\n]\n" + "\n" + "new Date().toString():[" + new Date().toString() + "]\n" + "\n" + "---------- BUG REPORTING END ----------" + "\n" + ""; System.out.println(strTxt); jsonResponse.put("resultCode", -1); jsonResponse.put("result", "false"); jsonResponse.put("message", e.getMessage()); } } } catch (org.json.simple.parser.ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } if( isFail ) { jsonResponse.put("resultCode", -2); jsonResponse.put("result", "false"); jsonResponse.put("message", failMsg); } System.out.println("\n--------------------------------------------------------------\n" + request.getRequestURI() + " OUT:" + "\n--------------------------------------------------------------\n" + "jsonResponse.toJSONString():[" + jsonResponse.toJSONString() + "]\n" + "\n--------------------------------------------------------------\n"); return jsonResponse; } @RequestMapping(value = "admins/constructionProjectManagement/home-training-index/list.do", method = RequestMethod.GET) @ResponseBody public JSONObject getHomeTraining( HttpServletRequest request, @RequestParam HashMap params, HttpServletResponse response) { JSONObject jsonResponse = new JSONObject(); System.out.println( "\n--------------------------------------------------------------\n" + request.getRequestURI() + " IN:" + "\n--------------------------------------------------------------\n" + "params.toString()" + params.toString() + "\n" + "\n--------------------------------------------------------------\n" ); try { homeTrainingService.getHomeTraining(request, response, jsonResponse, params); jsonResponse.put("resultCode", 100); jsonResponse.put("result", "true"); jsonResponse.put("message", "조회가 완료되었습니다."); } catch (Exception e) { // TODO Auto-generated catch block String strTxt = "---------- BUG REPORTING START ----------" + "\n" + "에러 문구:[" + request.getRequestURI() + " " + "]" + "\n" + "e.getMessage():[\n" + e.getMessage() + "\n]\n" + "\n" + "new Date().toString():[" + new Date().toString() + "]\n" + "\n" + "---------- BUG REPORTING END ----------" + "\n" + ""; System.out.println(strTxt); String eMsg = e.getMessage(); if( eMsg != null ) { if( eMsg.equals("로그인이 필요한 서비스입니다.") ) { jsonResponse.put("resultCode", 401); } } jsonResponse.put("resultCode", -1); jsonResponse.put("result", "false"); jsonResponse.put("message", e.getMessage()); } System.out.println( "\n--------------------------------------------------------------\n" + request.getRequestURI() + " OUT:" + "\n--------------------------------------------------------------\n" + "jsonResponse.toJSONString():[" + jsonResponse.toJSONString() + "]\n" + "\n--------------------------------------------------------------\n" ); return jsonResponse; } /** * 특정 집합교육에 참여한 사용자 목록을 조회한다. * @param request * @param params * @param response * @return */ @RequestMapping(value = "admins/constructionProjectManagement/home-training-index/item/list.do", method = RequestMethod.GET) @ResponseBody public JSONObject getHomeTrainingItemList( HttpServletRequest request, @RequestParam HashMap params, HttpServletResponse response) { JSONObject jsonResponse = new JSONObject(); System.out.println( "\n--------------------------------------------------------------\n" + request.getRequestURI() + " IN:" + "\n--------------------------------------------------------------\n" + "params.toString()" + params.toString() + "\n" + "\n--------------------------------------------------------------\n" ); try { homeTrainingService.getHomeTrainingItemList(request, response, jsonResponse, params); jsonResponse.put("resultCode", 100); jsonResponse.put("result", "true"); jsonResponse.put("message", "조회가 완료되었습니다."); } catch (Exception e) { // TODO Auto-generated catch block String strTxt = "---------- BUG REPORTING START ----------" + "\n" + "에러 문구:[" + request.getRequestURI() + " " + "]" + "\n" + "e.getMessage():[\n" + e.getMessage() + "\n]\n" + "\n" + "new Date().toString():[" + new Date().toString() + "]\n" + "\n" + "---------- BUG REPORTING END ----------" + "\n" + ""; System.out.println(strTxt); jsonResponse.put("resultCode", -1); jsonResponse.put("result", "false"); jsonResponse.put("message", e.getMessage()); } System.out.println( "\n--------------------------------------------------------------\n" + request.getRequestURI() + " OUT:" + "\n--------------------------------------------------------------\n" + "jsonResponse.toJSONString():[" + jsonResponse.toJSONString() + "]\n" + "\n--------------------------------------------------------------\n" ); return jsonResponse; } @RequestMapping(value = "admins/constructionProjectManagement/home-training-index/item/delete.do", method = RequestMethod.POST) @ResponseBody public JSONObject deleteHomeTrainingItem( HttpServletRequest request, @RequestBody String strJSON, HttpServletResponse response) { JSONObject jsonResponse = new JSONObject(); System.out.println( "\n--------------------------------------------------------------\n" + request.getRequestURI() + " IN:" + "\n--------------------------------------------------------------\n" + "strJSON" + strJSON + "\n" + "\n--------------------------------------------------------------\n" ); JSONParser jsonParser = new JSONParser(); JSONArray jsonArr = null; boolean isFail = false; String failMsg = ""; try { jsonArr = (JSONArray)jsonParser.parse(strJSON); for (Object obj : jsonArr) { JSONObject jsonObject = (JSONObject) obj; // JSONObject를 HashMap으로 변환 HashMap params = new HashMap<>(); for (Object key : jsonObject.keySet()) { String keyStr = (String) key; Object value = jsonObject.get(keyStr); params.put(keyStr, value); } try { HashMap hashMap = homeTrainingService.deleteHomeTrainingItem(request, response, params); int nRetCode = MyUtil.getIntegerFromObject(hashMap.get("p_result_code")); String lpszRetMsg = MyUtil.getStringFromObject(hashMap.get("p_err_msg")); if( nRetCode == 100 ) { jsonResponse.put("resultCode", nRetCode); jsonResponse.put("result", "true"); jsonResponse.put("message", "삭제가 완료되었습니다."); } else { if( nRetCode == 11 ) { lpszRetMsg += "\n" + "사업명: " + params.get("constName"); } jsonResponse.put("resultCode", nRetCode); jsonResponse.put("result", "false"); jsonResponse.put("message", lpszRetMsg); isFail = true; failMsg = lpszRetMsg; break; } } catch (Exception e) { // TODO Auto-generated catch block String strTxt = "---------- BUG REPORTING START ----------" + "\n" + "에러 문구:[" + request.getRequestURI() + " " + "]" + "\n" + "strJSON:[\n" + strJSON + "\n]\n" + "e.getMessage():[\n" + e.getMessage() + "\n]\n" + "\n" + "new Date().toString():[" + new Date().toString() + "]\n" + "\n" + "---------- BUG REPORTING END ----------" + "\n" + ""; System.out.println(strTxt); jsonResponse.put("resultCode", -1); jsonResponse.put("result", "false"); jsonResponse.put("message", e.getMessage()); } } } catch (org.json.simple.parser.ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } if( isFail ) { jsonResponse.put("resultCode", -2); jsonResponse.put("result", "false"); jsonResponse.put("message", failMsg); } System.out.println("\n--------------------------------------------------------------\n" + request.getRequestURI() + " OUT:" + "\n--------------------------------------------------------------\n" + "jsonResponse.toJSONString():[" + jsonResponse.toJSONString() + "]\n" + "\n--------------------------------------------------------------\n"); return jsonResponse; } /** * 집합교육 승인 화면 * @param params * @param model * @param response * @param request * @return * @throws Exception */ @RequestMapping(value = "admins/constructionProjectManagement/home-training-approval-system") public String homeTrainingApprovalSystem(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { if (!UserInfo.isValidSession(request, response, "admin")) { return ""; } model.addAttribute("params", params); return "admins/constructionProjectManagement/home-training-approval-system"; } /** * 방문교육 달력 화면 * @param params * @param model * @param response * @param request * @return * @throws Exception */ @RequestMapping(value = "admins/constructionProjectManagement/visit-training-index.do") public String visitTrainingIndex(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { if (!UserInfo.isValidSession(request, response, "admin")) { return ""; } model.addAttribute("params", params); return "admins/constructionProjectManagement/visit-training-index"; } /** * 방문교육 승인 화면 * @param params * @param model * @param response * @param request * @return * @throws Exception */ @RequestMapping(value = "admins/constructionProjectManagement/visit-training-approval-system") public String visitTrainingApprovalSystem(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { if (!UserInfo.isValidSession(request, response, "admin")) { return ""; } model.addAttribute("params", params); return "admins/constructionProjectManagement/visit-training-approval-system"; } /** * 건설현장 조회 목록화면 * @param params * @param model * @param response * @param request * @return * @throws Exception */ @RequestMapping(value = "admins/constructionProjectManagement/construction-site-index.do") public String constructionSiteIndex(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { if (!UserInfo.isValidSession(request, response, "admin")) { return ""; } model.addAttribute("params", params); return "admins/constructionProjectManagement/construction-site-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", ""); } params.put("cls", "2"); /** 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-detail.do") public String goConstructionUserDetail(@RequestParam HashMap params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception { if (!UserInfo.isValidSession(request, response, "admin")) { return ""; } model.addAttribute("params", params); return "admins/constructionProjectManagement/construction-user-detail"; } /** * 프로젝트 목록 조회 프로젝트명 자동검색 * @param request * @param response * @param params * @return * @throws Exception */ @ResponseBody @RequestMapping(value = "/drilling-project-list", method = RequestMethod.GET, produces = "application/json; charset=UTF-8") public String getDrillingProjectList(HttpServletRequest request, HttpServletResponse response, @RequestParam HashMap params) throws Exception { if (!UserInfo.isValidSession(request, response, "admin")) { return ""; } JSONObject jsonObject = new JSONObject(); strUtil sUtil = new strUtil(); String projectName = sUtil.checkNull((String)params.get("projectName")); JSONArray jsonListObject = new JSONArray(); JSONObject result = new JSONObject(); result.put("list", drillingInquiryService.drillingInquiryAutocompleteList(request, params)); jsonObject.put("resultMessage", "OK"); jsonObject.put("resultCode", 200); jsonObject.put("result", result); response.setContentType("application/json; charset=UTF-8"); // 응답 헤더 설정 response.setCharacterEncoding("UTF-8"); // 응답 데이터 인코딩 설정 (중요) try (OutputStream os = response.getOutputStream()) { // OutputStream 사용 os.write(jsonObject.toString().getBytes("UTF-8")); // UTF-8 인코딩하여 출력 } return null; // @ResponseBody이므로 반환 값은 필요 없습니다. } /** * 발주기관 프로젝트목록 가져오기 * @param request * @param params * @param response * @return * @throws IOException */ @RequestMapping(value = "/drilling/inquiry/list.do", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ResponseBody public ResponseEntity drillingInquiryList ( HttpServletRequest request, @RequestParam HashMap params, HttpServletResponse response ) throws IOException { if (!UserInfo.isValidSession(request, response, "admin")) { return null; } System.out.println( "\n--------------------------------------------------------------\n" + request.getRequestURI() + " IN:" + "\n--------------------------------------------------------------\n" + "params" + params.toString() + "\n" + "\n--------------------------------------------------------------\n" ); JSONObject jSONOResponse = null; try { jSONOResponse = drillingInquiryService.drillingInquiryList( request, params ); } catch (Exception e) { // TODO Auto-generated catch block jSONOResponse = new JSONObject(); String strTxt = "---------- BUG REPORTING START ----------" + "\n" + "에러 문구:[" + request.getRequestURI() + " " + "]" + "\n" + "params:[\n" + params.toString() + "\n]\n" + "e.getMessage():[\n" + e.getMessage() + "\n]\n" + "\n" + "new Date().toString():[" + new Date().toString() + "]\n" + "\n" + "---------- BUG REPORTING END ----------" + "\n" + ""; System.out.println(strTxt); jSONOResponse.put("resultCode", -1); jSONOResponse.put("result", "false"); jSONOResponse.put("message", e.getMessage()); } System.out.println( "\n--------------------------------------------------------------\n" + request.getRequestURI() + " OUT:" + "\n--------------------------------------------------------------\n" + "jSONOResponse.toJSONString():[" + jSONOResponse.toJSONString() + "]\n" + "\n--------------------------------------------------------------\n" ); int contentLength = 0; try { contentLength = jSONOResponse.toJSONString().getBytes("UTF-8").length; } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } response.setStatus(HttpServletResponse.SC_OK); response.setCharacterEncoding("UTF-8"); response.setHeader("Content-Type", "application/json; charset=utf-8"); response.setContentLength(contentLength); // Content-Length 설정 try { response.getWriter().print(jSONOResponse); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } /** * 건설현장 관리 > 발주기관 로그인 내역 화면 * @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"; } }