스미싱 알림 테스트 배포

This commit is contained in:
hehihoho3@gmail.com 2024-12-26 20:06:53 +09:00
parent 489827d951
commit a39ec55092
3 changed files with 24 additions and 18 deletions

View File

@ -198,13 +198,13 @@ public final class MsgSendUtils {
* @param statusResponse * @param statusResponse
* @param agentSendCounts * @param agentSendCounts
* @param sendRateList * @param sendRateList
* @param isNotified * @param isHolidayNotified
* @return call by reference * @return call by reference
* @throws Exception * @throws Exception
*/ */
public static Boolean populateSendLists(MjonMsgVO mjonMsgVO, List<MjonMsgSendVO> mjonMsgSendListVO public static Boolean populateSendLists(MjonMsgVO mjonMsgVO, List<MjonMsgSendVO> mjonMsgSendListVO
, StatusResponse statusResponse, List<String> resultSpamTxt , StatusResponse statusResponse, List<String> resultSpamTxt
, Map<String, Integer> agentSendCounts, List<MjonMsgVO> sendRateList, boolean isNotified) throws Exception{ , Map<String, Integer> agentSendCounts, List<MjonMsgVO> sendRateList, boolean isHolidayNotified) throws Exception{
log.info(" :: populateSendLists :: "); log.info(" :: populateSendLists :: ");
@ -300,7 +300,7 @@ public final class MsgSendUtils {
if (!replaceYN) { if (!replaceYN) {
// 스팸 체크와 메시지 타입 체크 각각 번만 수행 // 스팸 체크와 메시지 타입 체크 각각 번만 수행
if (!hasPerformedSpamCheck) { if (!hasPerformedSpamCheck) {
checkSpamAndSetStatus(mjonMsgVO, smsSpamChkTxt, resultSpamTxt, isNotified); checkSpamAndSetStatus(mjonMsgVO, smsSpamChkTxt, resultSpamTxt, isHolidayNotified);
hasPerformedSpamCheck = true; hasPerformedSpamCheck = true;
} }
if (!hasPerformedMsgType) { if (!hasPerformedMsgType) {
@ -316,7 +316,7 @@ public final class MsgSendUtils {
{// 치환 문자인 경우 {// 치환 문자인 경우
// 스팸 체크는 `spamChkSize`만큼 반복 수행 // 스팸 체크는 `spamChkSize`만큼 반복 수행
if (sampleCounter < spamChkSize && !"Y".equals(mjonMsgVO.getSpamStatus())) { if (sampleCounter < spamChkSize && !"Y".equals(mjonMsgVO.getSpamStatus())) {
checkSpamAndSetStatus(mjonMsgVO, smsSpamChkTxt, resultSpamTxt, isNotified); checkSpamAndSetStatus(mjonMsgVO, smsSpamChkTxt, resultSpamTxt, isHolidayNotified);
sampleCounter++; sampleCounter++;
} }
@ -422,7 +422,7 @@ public final class MsgSendUtils {
sendVO.setFileCnt(mjonMsgVO.getFileCnt()); sendVO.setFileCnt(mjonMsgVO.getFileCnt());
} }
private static void checkSpamAndSetStatus(MjonMsgVO mjonMsgVO, String personalizedSmsTxt, List<String> resultSpamTxt, boolean isNotified) throws Exception { private static void checkSpamAndSetStatus(MjonMsgVO mjonMsgVO, String personalizedSmsTxt, List<String> resultSpamTxt, boolean isHolidayNotified) throws Exception {
mjonMsgVO.setSpamStatus("N"); mjonMsgVO.setSpamStatus("N");
@ -451,7 +451,7 @@ public final class MsgSendUtils {
} }
mjonMsgVO.setSpamStatus("Y"); mjonMsgVO.setSpamStatus("Y");
if(isNotified) { if(isHolidayNotified) {
mjonMsgVO.setDelayYn("Y"); mjonMsgVO.setDelayYn("Y");
} }
} }
@ -925,7 +925,6 @@ public final class MsgSendUtils {
} }
// SMS 텍스트를 단위로 나누기 // SMS 텍스트를 단위로 나누기
String[] split = smsTxt.split("\n"); String[] split = smsTxt.split("\n");
log.info(" : split.length :: [{}]", split.length);
if (split.length > 0) { if (split.length > 0) {
// "C" 메시지 종류인 경우 번째 , 그렇지 않으면 번째 줄을 제목으로 설정 // "C" 메시지 종류인 경우 번째 , 그렇지 않으면 번째 줄을 제목으로 설정

View File

@ -531,8 +531,9 @@ private int parseIntOrDefault(String value, int defaultValue) {
} }
// 스미싱 알림 처리 // 스미싱 알림 처리
private boolean handleSmishingAlert(MjonMsgVO mjonMsgVO) throws Exception { public boolean handleSmishingAlert(MjonMsgVO mjonMsgVO) throws Exception {
JoinSettingVO joinSettingVO = egovSiteManagerService.selectAdminNotiDetail(); JoinSettingVO joinSettingVO = egovSiteManagerService.selectAdminNotiDetail();
if (joinSettingVO == null || !"Y".equals(joinSettingVO.getHoliSmishingNoti()) || if (joinSettingVO == null || !"Y".equals(joinSettingVO.getHoliSmishingNoti()) ||
!"Y".equals(joinSettingVO.getSlackNoti())) { !"Y".equals(joinSettingVO.getSlackNoti())) {
return false; // 알림 조건 미충족 return false; // 알림 조건 미충족
@ -543,13 +544,11 @@ private int parseIntOrDefault(String value, int defaultValue) {
List<MsgHolidayVO> holidayList = getHolidayList(); List<MsgHolidayVO> holidayList = getHolidayList();
boolean isNotificationAllowed = new MjonHolidayApi().getHolidaySmishingPassStatus(alarmList, holidayList); boolean isNotificationAllowed = new MjonHolidayApi().getHolidaySmishingPassStatus(alarmList, holidayList);
// 알림 발송 System.out.println(" :: isNotificationAllowed : "+ isNotificationAllowed);
if (!isNotificationAllowed) { System.out.println(" :: isNotificationAllowed : "+ isNotificationAllowed);
// getAdminSandSlack(mjonMsgVO); System.out.println(" :: isNotificationAllowed : "+ isNotificationAllowed);
return true; // 알림 발송 성공 System.out.println(" :: isNotificationAllowed : "+ isNotificationAllowed);
} return !isNotificationAllowed; // 알림 발송 조건 미충족
return false; // 알림 발송 조건 미충족
} }
// 안전하게 문자열 가져오기 // 안전하게 문자열 가져오기

View File

@ -4056,8 +4056,16 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
System.out.println("================================");
// 스팸 스미싱 의심이면 slack 알림 // 스팸 스미싱 의심이면 slack 알림
boolean isNotified = mjonCommon.processUserAndCheckSms(mjonMsgVO, userId); boolean isHolidayNotified = mjonCommon.handleSmishingAlert(mjonMsgVO);
System.out.println("isNotified :: "+ isHolidayNotified);
System.out.println("isNotified :: "+ isHolidayNotified);
System.out.println("isNotified :: "+ isHolidayNotified);
System.out.println("isNotified :: "+ isHolidayNotified);
System.out.println("isNotified :: "+ isHolidayNotified);
// boolean isNotified = mjonCommon.processUserAndCheckSms(mjonMsgVO, userId);
// 스팸관련 키워드 select // 스팸관련 키워드 select
@ -4072,7 +4080,7 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
* 전송사 코드 셋팅 * 전송사 코드 셋팅
*/ */
if (!MsgSendUtils.populateSendLists(mjonMsgVO, mjonMsgSendVOList, statusResponse, resultSpamTxt, if (!MsgSendUtils.populateSendLists(mjonMsgVO, mjonMsgSendVOList, statusResponse, resultSpamTxt,
agentSendCounts, sendRateList, isNotified)) { agentSendCounts, sendRateList, isHolidayNotified)) {
; ;
// 문자 치환 전송 문자 길이를 초과하였습니다. // 문자 치환 전송 문자 길이를 초과하였습니다.
// 문자 치환 오류가 발생하였습니다. // 문자 치환 오류가 발생하였습니다.
@ -4160,7 +4168,7 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
// //
if (isNotified) { if (isHolidayNotified) {
System.out.println("스미싱 알림이 처리되었습니다."); System.out.println("스미싱 알림이 처리되었습니다.");
mjonCommon.getAdminSandSlack(mjonMsgVO); mjonCommon.getAdminSandSlack(mjonMsgVO);
} else if("Y".equalsIgnoreCase(mjonMsgVO.getSpamStatus())){ } else if("Y".equalsIgnoreCase(mjonMsgVO.getSpamStatus())){