이호영 이호영 2024-12-16
문자 받는사람 체크
@b06cc7e71eb14d7bf63484f89d0f23ec1cb18577
src/main/resources/egovframework/sqlmap/let/msg/MjonMsgData_SQL_mysql.xml
--- src/main/resources/egovframework/sqlmap/let/msg/MjonMsgData_SQL_mysql.xml
+++ src/main/resources/egovframework/sqlmap/let/msg/MjonMsgData_SQL_mysql.xml
@@ -4119,7 +4119,7 @@
 		ON     MC.ORDER_ID = MMD.USERDATA
 		AND    MC.USER_ID = MMD.USER_ID
 	WHERE  1=1	  
-		AND	 MMD.SENT_DATE > date_add(now(), interval -7 day)
+	/*	AND	 MMD.SENT_DATE > date_add(now(), interval -7 day)*/
 		AND	 MMD.CUR_STATE          = '3'
 		AND    MMD.REFUND_YN          = 'N'
 		AND    MMD.RESERVE_C_YN       = 'N'
src/main/webapp/WEB-INF/jsp/web/msgdata/MsgDataSMLView.jsp
--- src/main/webapp/WEB-INF/jsp/web/msgdata/MsgDataSMLView.jsp
+++ src/main/webapp/WEB-INF/jsp/web/msgdata/MsgDataSMLView.jsp
@@ -1055,7 +1055,7 @@
 		
 
 		// 총 30만건이 넘으면 false
-		if (!validateRowLimit(result.count)) {
+		if (!validateRowLimit(result.uniqueCount)) {
 			return false;
 		}
 
src/main/webapp/WEB-INF/jsp/web/msgdata/include/msgDataIncludeExcel.jsp
--- src/main/webapp/WEB-INF/jsp/web/msgdata/include/msgDataIncludeExcel.jsp
+++ src/main/webapp/WEB-INF/jsp/web/msgdata/include/msgDataIncludeExcel.jsp
@@ -291,7 +291,6 @@
 
 		} 
 
-		
 		var addrData = $tableExcel.getData().map((row, index) => ({
 		    name: row.addrNm,
 		    phone: removeDash(row.addrPhoneNo),
@@ -301,11 +300,13 @@
 		    rep4: row.addrInfo4,
 		}));
 
+
+		
 		// 기존 tableL의 데이터를 가져옵니다.
 		var existingData = tableL.getData();
 		// 기존 데이터와 새로운 데이터를 합칩니다.
 		var combinedData = existingData.concat(addrData);
-		
+
 
 		/** 
 		* @ phone을 기준으로 중복 제거 및 갯수 계산
@@ -318,9 +319,11 @@
 		* 	};
 		*/
 		const result = removeDuplicatesAndCount(combinedData, 'phone');
+
+		console.table('result : ', result);
 		
 		// 총 30만건이 넘으면 false
-		if (!validateRowLimit(result.count)) {
+		if (!validateRowLimit(result.uniqueCount)) {
 			return false;
 		}
 		
@@ -336,23 +339,7 @@
 		
 		var totRows = tableL.getRows().length; 
 		updateTotCnt(totRows); //전체 데이터 갯수 구하기
-		console.log('totRows : ', totRows);
-		var smsTxtArea = $('#smsTxtArea').val();
-		if(smsTxtArea.indexOf("[*이름*]")  > -1 
-				|| smsTxtArea.indexOf("[*1*]") > -1
-				|| smsTxtArea.indexOf("[*2*]") > -1
-				|| smsTxtArea.indexOf("[*3*]") > -1
-				|| smsTxtArea.indexOf("[*4*]") > -1){
-			
-// 			fnReplCell();
-			
-		}else{
-			
-			//결제 금액 구하기
-// 		    totalPriceSum(totRows);
-			
-		} 
-	    totalPriceSum(totRows);
+		totalPriceSum(totRows);
 		
 		setAddrMassClose();
 		$('.field-selector').each(function() { $(this).val(''); });
src/main/webapp/js/MJUtill.js
--- src/main/webapp/js/MJUtill.js
+++ src/main/webapp/js/MJUtill.js
@@ -986,15 +986,22 @@
 * 	};
 */
 function removeDuplicatesAndCount(array, key) {
-	// 중복을 제거한 배열 생성
-	const uniqueArray = array.filter((item, index, self) => 
-		index === self.findIndex((t) => t[key] === item[key])
-	);
+	// 중복 체크를 위한 Map 사용
+	const seen = new Map();
+	const uniqueArray = [];
+	const duplicateArray = [];
 	
-	// 중복된 데이터만 추출
-	const duplicateArray = array.filter((item, index, self) =>
-		index !== self.findIndex((t) => t[key] === item[key])
-	);
+	array.forEach(item => {
+		const value = item[key];
+		if (seen.has(value)) {
+			// 중복된 데이터는 중복 배열에 추가
+			duplicateArray.push(item);
+		} else {
+			// 처음 본 데이터는 고유 배열에 추가하고 Map에 기록
+			uniqueArray.push(item);
+			seen.set(value, true);
+		}
+	});
 	
 	// 결과 반환
 	return {
@@ -1022,6 +1029,8 @@
 	// 숫자 변환
 	const totalRowsNum = Number(totalRows);
 	const limitNum = Number(limit);
+	console.log('totalRowsNum : ', totalRowsNum);
+	console.log('limitNum : ', limitNum);
 
 	// 변환 후 값 확인
 
src/main/webapp/js/web/addr/cmn.js
--- src/main/webapp/js/web/addr/cmn.js
+++ src/main/webapp/js/web/addr/cmn.js
@@ -4,7 +4,7 @@
 function isValidPhoneNumber(phone) {
     // 숫자만 추출
     const numberOnly = phone.replace(/\D/g, '');
-	console.log('numberOnly : ' ,numberOnly);
+	// console.log('numberOnly : ' ,numberOnly);
 
     // 유효한 형식 체크
     return (
Add a comment
List