woo 2023-07-03
문자전송, 선거문자 하단 문자샘플, 그림샘플, 내문자함 검색어 입력 특수문자 입력 금지 기능 추가 - 기존 헤더부분 통합검색에만 적용되었던 기능을 확대 적용하였음.
 - 기존 헤더부분 통합검색에만 적용되었던 기능을 확대 적용하였음.
@3d8054fa83f98f9d64babdf3314e55272c740784
src/main/java/itn/com/cmm/util/StringUtil.java
--- src/main/java/itn/com/cmm/util/StringUtil.java
+++ src/main/java/itn/com/cmm/util/StringUtil.java
@@ -578,4 +578,26 @@
 		return ntceEndde;
 	}
 	
+	/*
+	 * 검색 키워드 내용에 한글, 영문, 숫자를 제외한 특수문자가 있는 경우 검색이 안되도록 처리
+	 * 
+	 * 
+	 * */
+	public static boolean getSearchKeywordValidation(String paramKeyword) {
+		
+		boolean resultType = false;
+		String keyword = paramKeyword;
+		
+		keyword = keyword.replaceAll("[ㄱ-ㅎㅏ-ㅣ가-힣a-zA-Z0-9 ]", "");
+		
+		//검색어에 특수기호가 없어서 공백이 되는 경우만 true를 리턴한다.
+		if(keyword.equals("")) {
+		
+			resultType = true;
+		}
+		
+		return resultType;
+		
+	}
+	
 }
(No newline at end of file)
src/main/java/itn/let/mjo/msgcampain/web/MjonMsgCampainDataController.java
--- src/main/java/itn/let/mjo/msgcampain/web/MjonMsgCampainDataController.java
+++ src/main/java/itn/let/mjo/msgcampain/web/MjonMsgCampainDataController.java
@@ -1201,6 +1201,18 @@
 			RedirectAttributes redirectAttributes) throws Exception {
 
 		
+		//검색 키워드 체크 기능 추가
+		String keyword = letterVO.getSearchKeyword();
+		boolean searchKeyType = StringUtil.getSearchKeywordValidation(keyword);
+		
+		if(!searchKeyType) {//검색 결과 Null로 리턴함.
+			
+			List<?> exceptionLetterList = new ArrayList<>();
+			
+			model.addAttribute("resultLetterList", exceptionLetterList);
+			return "web/msgcampain/LetterListAjax";
+		}
+		
 		CateCode cateCode = new CateCode();
 		cateCode.setCateNo(letterVO.getCategoryCode());
 		CateCode cateCodeInfoVO = cmmnDetailCodeManageService.selectCateCodeInfo(cateCode); //카테고리 상세 조회
@@ -1340,6 +1352,18 @@
 			SessionStatus status, 
 			RedirectAttributes redirectAttributes) throws Exception {
 
+		
+		//검색 키워드 체크 기능 추가
+		String keyword = letterVO.getSearchKeyword();
+		boolean searchKeyType = StringUtil.getSearchKeywordValidation(keyword);
+		
+		if(!searchKeyType) {//검색 결과 Null로 리턴함.
+			
+			List<?> exceptionPhoList = new ArrayList<>();
+			
+			model.addAttribute("resultPhoList", exceptionPhoList);
+			return "web/msgcampain/PhotoListAjax";
+		}
 		
 		CateCode cateCode = new CateCode();
 		cateCode.setCateNo(letterVO.getCategoryCode());
@@ -1555,6 +1579,19 @@
     	
     	mjonMsgDataVO.setUserId(userId);
 		
+    	
+    	//검색 키워드 체크 기능 추가
+		String keyword = mjonMsgDataVO.getSearchKeyword();
+		boolean searchKeyType = StringUtil.getSearchKeywordValidation(keyword);
+		
+		if(!searchKeyType) {//검색 결과 Null로 리턴함.
+			
+			List<?> exceptionMyMsgList = new ArrayList<>();
+			
+			model.addAttribute("resultMyMsgList", exceptionMyMsgList);
+			return "web/msgcampain/MyMsgListAjax";
+		}
+    	
 		//그림 문자 리스트 불러오기
 		//LetterVO letterVO = new LetterVO();
 		if(mjonMsgDataVO.getPageUnit() != 10) {
src/main/java/itn/let/mjo/msgdata/web/MjonMsgDataController.java
--- src/main/java/itn/let/mjo/msgdata/web/MjonMsgDataController.java
+++ src/main/java/itn/let/mjo/msgdata/web/MjonMsgDataController.java
@@ -1131,6 +1131,20 @@
 			SessionStatus status, 
 			RedirectAttributes redirectAttributes) throws Exception {
 
+		
+		//검색 키워드 체크 기능 추가
+		String keyword = letterVO.getSearchKeyword();
+		boolean searchKeyType = StringUtil.getSearchKeywordValidation(keyword);
+		
+		if(!searchKeyType) {//검색 결과 Null로 리턴함.
+			
+			List<?> exceptionLetterList = new ArrayList<>();
+			
+			model.addAttribute("resultLetterList", exceptionLetterList);
+			return "web/msgdata/LetterListAjax";
+		}
+		
+		
 		CateCode cateCode = new CateCode();
 		cateCode.setCateNo(letterVO.getCategoryCode());
 		CateCode cateCodeInfoVO = cmmnDetailCodeManageService.selectCateCodeInfo(cateCode); //카테고리 상세 조회
@@ -1302,6 +1316,18 @@
 		} else if(subStr.equals("") && !letterVO.getUpperCateNo().equals("")) { //하위분류에서 전체 클릭 시 중분류의 코드로 문자샘플 조회
 			letterVO.setCategoryCode(letterVO.getUpperCateNo().substring(0, 3));
 		}*/
+		
+		//검색 키워드 체크 기능 추가
+		String keyword = letterVO.getSearchKeyword();
+		boolean searchKeyType = StringUtil.getSearchKeywordValidation(keyword);
+		
+		if(!searchKeyType) {//검색 결과 Null로 리턴함.
+			
+			List<?> exceptionPhoList = new ArrayList<>();
+			
+			model.addAttribute("resultPhoList", exceptionPhoList);
+			return "web/msgdata/PhotoListAjax";
+		}
 		
 		CateCode cateCode = new CateCode();
 		cateCode.setCateNo(letterVO.getCategoryCode());
@@ -1528,6 +1554,20 @@
 		if(loginVO == null) {
             return "redirect:/web/main/mainPage.do";
          }
+		
+		
+		//검색 키워드 체크 기능 추가
+		String keyword = mjonMsgDataVO.getSearchKeyword();
+		boolean searchKeyType = StringUtil.getSearchKeywordValidation(keyword);
+		
+		if(!searchKeyType) {//검색 결과 Null로 리턴함.
+			
+			List<?> exceptionMyMsgList = new ArrayList<>();
+			
+			model.addAttribute("resultPhoList", exceptionMyMsgList);
+			return "web/msgdata/MyMsgListAjax";
+		}
+		
     	
     	mjonMsgDataVO.setUserId(userId);
 		
@@ -5064,14 +5104,15 @@
 		 * 2023-04-24 우영두
 		 * 
 		 * */
-		String keyword = mjonMsgDataVO.getSearchKeyword();
-		keyword = keyword.replaceAll("[ㄱ-ㅎㅏ-ㅣ가-힣a-zA-Z0-9 ]", "");
 		
-		if(!keyword.equals("")) {
+		String keyword = mjonMsgDataVO.getSearchKeyword();
+		boolean searchKeyType = StringUtil.getSearchKeywordValidation(keyword);
+		
+		if(!searchKeyType) {
 			
 			modelAndView.addObject("status", "wordFail");
 			modelAndView.addObject("message", "잘못된 검색어 입니다.");
-			return modelAndView;
+ 			return modelAndView;
 		}
 		
 		//욕설 및 금지 단어 리스트 불러오기
Add a comment
List