수정건 수정

This commit is contained in:
USER
2022-08-03 17:40:17 +09:00
parent abb5db5b97
commit 811986fa6d
24 changed files with 327 additions and 161 deletions

View File

@@ -32,4 +32,6 @@ public interface LoginMapper {
int updateAdmUser(AuthUser authUser);
void insertSendMsg(SendMsgDto sendMsgDto);
public List<AuthNum> getAuthNumList(AuthNum authNum);
}

View File

@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
@@ -39,6 +40,15 @@ public class LoginService {
@Value("${sendMsg.tableNm}")
private String sendMsgTableName;
@Value("${authentication.searchTime.min-30: 30}")
private String searchTime30M;
@Value("${authentication.searchTime.min-01: 1}")
private String searchTime01M;
@Value("${authentication.cntLimit: 10}")
private int cntLimit;
/**
* 1차 로그인 인증
*
@@ -145,8 +155,51 @@ public class LoginService {
if (autchrFailCnt >= Const.MAX_AUTHNUM_FAIL) {
return new AuthNumResDto(ApiResponseCode.CE_AUTHNUM_LOCK);
}
/*------------------------ 인증요청 임계 체크 2022.08.01 --------------------------------------- */
// 인증 요청 시간에서 30분 데이터 가져오기
Date nowDate = new Date();
String now = DateUtils.dateToStr(nowDate, "yyyyMMddHHmmss");
AuthNum authParam = new AuthNum();
authParam.setRegDt(now);
authParam.setSttusCd(Const.AUTH_STTUS_CD_03);
authParam.setHpNo(user.getHpNo());
authParam.setSearchTime(searchTime30M);
List<AuthNum> authNumList = loginMapper.getAuthNumList(authParam);
if(authNumList != null && authNumList.size() > 0) { // 30분 이내에 lock 상태가 존재함
return new AuthNumResDto(ApiResponseCode.CE_AUTHNUM_STAT_LOCK);
}
authParam = new AuthNum();
authParam.setRegDt(now);
authParam.setSttusCd(Const.AUTH_STTUS_CD_01);
authParam.setHpNo(user.getHpNo());
authParam.setSearchTime(searchTime01M);
authNumList = null;
authNumList = loginMapper.getAuthNumList(authParam);
String authNum = TextUtils.randNumStr(6);
if(authNumList != null) {
if(authNumList.size() >= cntLimit) {
// 발송 요청 건수가 1분에 10개 이상
// 발행한 인증번호 DB에 저장
AuthNum anum = new AuthNum();
anum.setAuthTpCd(Const.AUTH_TP_CD);
anum.setSttusCd(Const.AUTH_STTUS_CD_03);
anum.setHpNo(user.getHpNo());
anum.setChrVal(authNum);
anum.setRegId(user.getOprtrId());
loginMapper.addAuthNum(anum);
return new AuthNumResDto(ApiResponseCode.CE_AUTHNUM_STAT_LOCK);
}
}
// 발행한 인증번호 DB에 저장
AuthNum anum = new AuthNum();

View File

@@ -18,4 +18,6 @@ public class AuthNum {
private String chgDt; // 변경 일시
private String oprtrId; // 어드민 ID
private Integer authchrFailCnt; // 인증 실패 카운트
private String searchTime; // 조회시간
}

View File

@@ -63,6 +63,8 @@ public enum ApiResponseCode {
,CE_SYSMGT_AUTHCODE_EXISTS_USER("4020", "해당 권한코드에 해당하는 어드민 사용자가 존재함.")
/** 이미 등록된 발신번호로 저장 불가. */
,CE_SENDMGT_DUPLICATE_SENDNUM("4021", "이미 등록된 발신번호로 저장 불가.")
/** 인증번호 발송 요청 임계값 초과 분당 10회 */
,CE_AUTHNUM_STAT_LOCK("4022", "인증요청 제한")
// 시스템
/** 알 수 없는 에러. */
,SE_UNKNOWN("9999", "알 수 없는 에러");

View File

@@ -14,6 +14,7 @@ public class Const {
public static final String AUTH_TP_CD = "01"; // 어드민 로그인
public static final String AUTH_STTUS_CD_01 = "01"; // 인증대기
public static final String AUTH_STTUS_CD_02 = "02"; // 인증완료
public static final String AUTH_STTUS_CD_03 = "03"; // 인증Lock
public static final String AUTH_CD_ADMIN = "1001";
public static final String AUTH_CD_AGENCY = "1002";