주소록 유효성검사 cmm.js 패턴 추가

This commit is contained in:
hehihoho3@gmail.com 2024-11-07 11:19:40 +09:00
parent e7eee5528d
commit 81e14b01a4
5 changed files with 6982 additions and 131 deletions

View File

@ -65,9 +65,8 @@ public class AddrServiceImpl extends EgovAbstractServiceImpl implements AddrSer
private EgovIdGnrService idgenAddrTransHistId;
private static final String PHONE_REGEX = "^(01[016789]-?\\d{3,4}-?\\d{4})$";
private static final Pattern PHONE_PATTERN = Pattern.compile(PHONE_REGEX);
private static final String PHONE_REGEX = "^(010-?\\d{3,4}-?\\d{4}|01[1-9]-?\\d{3}-?\\d{4}|050\\d-?\\d{3,4}-?\\d{4})$";
private static final Pattern PHONE_PATTERN = Pattern.compile(PHONE_REGEX);
private static final Charset EUC_KR = Charset.forName("EUC-KR");
// private static final int MAX_ADDR_CNT = 500000;
//임시 500만개
@ -474,14 +473,11 @@ public class AddrServiceImpl extends EgovAbstractServiceImpl implements AddrSer
AtomicInteger invalid = new AtomicInteger(0); // 스레드-안전(thread-safe)하게 정수 값을 업데이트할 있는 기능을 제공
addrListVO.removeIf(addr -> {
String phoneNo = addr.getAddrPhoneNo();
// phoneNo = phoneNo != null ? phoneNo.replaceAll("-", "") : "";
// System.out.println("phoneNo : "+ phoneNo);
if (isValidPhoneNumber(phoneNo)) {
addr.setAddrPhoneNo(phoneNo); // 하이픈이 제거된 유효한 번호 설정
trimFieldsBytes(addr); // 다른 필드들에 대한 20바이트 체크 자르기
return false; // 유효한 번호는 제거하지 않음
} else {
// System.out.println(phoneNo + " is an invalid phone number. Removing from list.");
invalid.getAndIncrement(); // 유효하지 않은 번호 개수 증가
return true; // 유효하지 않은 번호는 제거
}

File diff suppressed because it is too large Load Diff

View File

@ -1060,40 +1060,12 @@ function fn_sendMsgData(){
return false;
}
var loginVO = '${LoginVO}';
if (!loginVO) {
alert("문자발송 서비스는 로그인 후 이용 가능합니다.");
return false;
}
// 폼 유효성 검사
if (!validateForm(form)) return false;
var adverYn = $("input[name='send_adYn']:checked").val();
var spamStatus = false;
var exceptSpamYn = $("#exceptSpamYn").val(); //금지어 필터링 예외 여부 - N 일 경우만 스팸 검사를 진행
//이벤트 진행중 회원의 경우 이벤트 잔여금액 비교 처리 필요.
/* var eventStatus = form.eventStatus.value;
var eventRemainCash = parseFloat(form.eventRemainCash.value);
if(eventStatus == 'Y'){
if(parseFloat(eventRemainCash) < parseFloat(totPriceOnly)){
alert("고객님의 이벤트 캐시 잔액은 " + eventRemainCash + "원으로 입력하신 수량의 문자를 전부 발송할 수 없습니다. 잔액 이하로 발송건수를 재설정하시기 바랍니다.");
return false;
}
} */
if(loginVO == "" || loginVO == null){
alert("문자발송 서비스는 로그인 후 이용 가능합니다.");
return false;
}
var blineCodeYn = $("#blineCode").val();
if(blineCodeYn != 'N'){
@ -1112,22 +1084,11 @@ function fn_sendMsgData(){
//광고 문자 내용 합쳐주기
var adverYn = $("input[name='send_adYn']:checked").val();
if(adverYn == 'Y'){
var adTxt = $('.ad_txt').text();
var denyTxt = $('.deny_txt').text();
var smsTxt = form.smsTxtArea.value;
var adverTxt = adTxt + smsTxt + '\n' + denyTxt;
form.smsTxt.value = adverTxt;
form.msgKind.value = "A"; //광고문자 종류 설정
}else{
var smsTxt = form.smsTxtArea.value;
form.smsTxt.value = smsTxt;
form.msgKind.value = "N"; //일반문자 종류 설정
}
//수신번호 리스트 체크하기
@ -1141,75 +1102,7 @@ function fn_sendMsgData(){
var selectedData = tableL.getRows();
if(selectedData == "" || selectedData == null){
alert("받는사람 주소를 한 건 이상 입력해주세요.");
return false;
}else{ // 선택한 Row '-' 문자 삭제하기
for(var i=0; i < selectedData.length; i++){
//일괄변환 문자에 콤마(,)가 들어가있으면 배열로 넘길때 문제가 발생하여 특수문자(§)로 치환하여 넘겨주도록 한다.
var name = tableL.getRows()[i].getData().name;
var phone = removeDash(tableL.getRows()[i].getData().phone);
var rep1 = tableL.getRows()[i].getData().rep1;
var rep2 = tableL.getRows()[i].getData().rep2;
var rep3 = tableL.getRows()[i].getData().rep3;
var rep4 = tableL.getRows()[i].getData().rep4;
if(phone == ""){
alert("수신 목록에 핸드폰 번호가 없는 항목이 있습니다.");
return false;
}else if(!checkHpNum(phone)){
alert("수신 목록에 잘 못된 핸드폰 번호가 있습니다. 핸드폰 번호 : " + phone + " 입니다.");
return false;
}else{
if(typeof(name) != 'undefined' && name != null && name !=""){
if(!emojiCheck(name)){//이모지 체크 해주기
return false;
}
nameList[i] = name.replaceAll(",","§");
}
phoneNum[i] = phone;
if(typeof(rep1) != 'undefined' && rep1 != null){
if(!emojiCheck(rep1)){//이모지 체크 해주기
return false;
}
rep1List[i] = rep1.replaceAll(",","§");
}
if(typeof(rep2) != 'undefined' && rep2 != null){
if(!emojiCheck(rep2)){//이모지 체크 해주기
return false;
}
rep2List[i] = rep2.replaceAll(",","§");
}
if(typeof(rep3) != 'undefined' && rep3 != null){
if(!emojiCheck(rep3)){//이모지 체크 해주기
return false;
}
rep3List[i] = rep3.replaceAll(",","§");
}
if(typeof(rep4) != 'undefined' && rep4 != null){
if(!emojiCheck(rep4)){//이모지 체크 해주기
return false;
}
rep4List[i] = rep4.replaceAll(",","§");
}
}
}
}
/*
var reserYn = $("input[name=reserYn]:checked").val(); // 예약 발송 여부 확인
if(reserYn == 'Y'){
@ -1241,10 +1134,9 @@ function fn_sendMsgData(){
form.reqDate.value = "";
}
var fileLinks = document.getElementsByName("fileLinks");
} */
/*
var conLeng = conByteLeng($('#smsTxt').val()); // 내용 문자 입력 바이트 수 계산하기
if(conLeng > 2000){
@ -1254,6 +1146,7 @@ function fn_sendMsgData(){
}
*/
console.log(' : 전송하시겠습니까 : ')
if(confirm("문자를 전송하시겠습니까?")){
@ -1320,11 +1213,11 @@ function fn_sendMsgData(){
form.reserveYn.value = reserYn; // 즉시 / 예약 문자 선택 여부
form.templateYn.value = templateYn;
form.imgFileId.value = imgFileId;
form.nameList.value = nameList;
form.rep1List.value = rep1List;
form.rep2List.value = rep2List;
form.rep3List.value = rep3List;
form.rep4List.value = rep4List;
// form.nameList.value = nameList;
// form.rep1List.value = rep1List;
// form.rep2List.value = rep2List;
// form.rep3List.value = rep3List;
// form.rep4List.value = rep4List;
//총 결제금액 천단위 콤마 삭제 후 전송
var totPrice = form.totPrice.value;
@ -1743,8 +1636,8 @@ function fn_sendMsgData(){
form.eventStatus.value = 'N';
form.eventYn.value = 'N';
// sendMsgAjax_advc(0,0);
sendMsgAjax(0,0);
sendMsgAjax_advc(0,0);
// sendMsgAjax(0,0);
}else{
@ -1765,16 +1658,16 @@ function fn_sendMsgData(){
}else{
//발송 Ajax 호출해주기
// sendMsgAjax_advc(0,0);
sendMsgAjax(0,0);
sendMsgAjax_advc(0,0);
// sendMsgAjax(0,0);
}
}else{
//발송 Ajax 호출해주기
// sendMsgAjax_advc(0,0);
sendMsgAjax(0,0);
sendMsgAjax_advc(0,0);
// sendMsgAjax(0,0);
}

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,9 @@ function isValidPhoneNumber(phone) {
// 유효한 형식 체크
return (
(numberOnly.startsWith("010") && numberOnly.length === 11) || // 010으로 시작하고 11자리
(/^01[1-9]/.test(numberOnly) && numberOnly.length === 10) || // 011~019로 시작하고 10자리
(numberOnly.startsWith("050") && numberOnly.length === 12) // 050X로 시작하고 12자리
(/^01[1-9]/.test(numberOnly) && numberOnly.length === 10 && // 011~019로 시작하고 10자리
!/^01[2-4]/.test(numberOnly)) || // 012, 013, 014는 유효하지 않음
(numberOnly.startsWith("050") && numberOnly.length === 12) // 050X로 시작하고 12자리
);
}