알림톡 api 진행중

This commit is contained in:
hehihoho3@gmail.com 2025-07-29 17:46:53 +09:00
parent 60602a31bc
commit 95707e8965
6 changed files with 48 additions and 12 deletions

View File

@ -47,6 +47,7 @@ public class KakaoSendAdvcVO implements Serializable {
private String jsonStr; // jsonStr private String jsonStr; // jsonStr
private String sendKind; //문자전송 타입(H:홈페이지, A:API)
// ===== // =====
// ===== // =====
@ -89,6 +90,7 @@ public class KakaoSendAdvcVO implements Serializable {
"\n , subMsgType=[" + subMsgType + "]" + "\n , subMsgType=[" + subMsgType + "]" +
"\n , reqDate=[" + reqDate + "]" + "\n , reqDate=[" + reqDate + "]" +
"\n , jsonStr=[" + jsonStr + "]" + "\n , jsonStr=[" + jsonStr + "]" +
"\n , sendKind=[" + sendKind + "]" +
"\n , ==== MJ_MSG_DATA INSERT DATA END =======" + "\n , ==== MJ_MSG_DATA INSERT DATA END =======" +
"\n " + "\n " +
"\n , eachPrice=[" + eachPrice + "]" + "\n , eachPrice=[" + eachPrice + "]" +

View File

@ -218,7 +218,8 @@ public class KakaoSendUtil {
sendVO.setSubMsgType(sendType); sendVO.setSubMsgType(sendType);
if ("INVALID".equals(sendType)) { if ("INVALID".equals(sendType)) {
statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "전송 문자 길이를 초과하였습니다.");return kakaoSendAdvcListVO; // statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "전송 문자 길이를 초과하였습니다.");return kakaoSendAdvcListVO;
StatusResponse.statusResponseSet(statusResponse, HttpStatus.BAD_REQUEST, "전송 문자 길이를 초과하였습니다.", "STAT_1080");return kakaoSendAdvcListVO;
} }
boolean isMms = "MMS".equals(sendType); boolean isMms = "MMS".equals(sendType);

View File

@ -870,17 +870,25 @@ public class KakaoAlimTalkServiceImpl extends EgovAbstractServiceImpl implements
// KakaoSendAdvcVO // KakaoSendAdvcVO
Map<String, Object> returnMap = new HashMap<>(); Map<String, Object> returnMap = new HashMap<>();
Map<String, Object> apiReturnMap = new HashMap<>();
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated() String userId = "";
? (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser() if("A".equals(kakaoVO.getSendKind()))
: null; {
String userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId()); userId = kakaoVO.getMberId();
}else {
LoginVO loginVO = EgovUserDetailsHelper.isAuthenticated()
? (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser()
: null;
userId = loginVO == null ? "" : EgovStringUtil.isNullToString(loginVO.getId());
if (userId.equals("")) {
return new StatusResponse(HttpStatus.BAD_REQUEST, "로그인 후 이용이 가능합니다.");
}
if (userId.equals("")) {
return new StatusResponse(HttpStatus.BAD_REQUEST, "로그인 후 이용이 가능합니다.");
} }
kakaoVO.setUserId(userId); kakaoVO.setUserId(userId);
/** /**
* 회원 정지된 상태이면 문자 발송이 안되도록 처리함 현재 로그인 세션도 만료 처리함 * 회원 정지된 상태이면 문자 발송이 안되도록 처리함 현재 로그인 세션도 만료 처리함
@ -890,7 +898,7 @@ public class KakaoAlimTalkServiceImpl extends EgovAbstractServiceImpl implements
request.getSession().invalidate(); request.getSession().invalidate();
// UNAUTHORIZED : 인증되지 않은 사용자가 접근하려고 // UNAUTHORIZED : 인증되지 않은 사용자가 접근하려고
return new StatusResponse(HttpStatus.UNAUTHORIZED, return new StatusResponse(HttpStatus.UNAUTHORIZED,
"현재 고객님께서는 문자온 서비스 이용이 정지된 상태로 알림톡을 발송하실 수 없습니다. 이용정지 해제를 원하시면 고객센터로 연락주시기 바랍니다."); "현재 고객님께서는 문자온 서비스 이용이 정지된 상태로 알림톡을 발송하실 수 없습니다. 이용정지 해제를 원하시면 고객센터로 연락주시기 바랍니다.", "STAT_1070");
} }
@ -915,7 +923,7 @@ public class KakaoAlimTalkServiceImpl extends EgovAbstractServiceImpl implements
/** @전송금액 확인 --------------------------------------------------*/ /** @전송금액 확인 --------------------------------------------------*/
if (!isCashSufficient(userId, kakaoSendAdvcListVO)) { if (!isCashSufficient(userId, kakaoSendAdvcListVO)) {
log.error("Insufficient balance for message sending."); log.error("Insufficient balance for message sending.");
return new StatusResponse(HttpStatus.BAD_REQUEST, "문자 발송에 필요한 보유 잔액이 부족 합니다."); return new StatusResponse(HttpStatus.BAD_REQUEST, "문자 발송에 필요한 보유 잔액이 부족 합니다.", "STAT_1060");
} }
@ -931,6 +939,8 @@ public class KakaoAlimTalkServiceImpl extends EgovAbstractServiceImpl implements
// 임시 // 임시
List<String> nextMsgGroupIdA = new ArrayList<>(); List<String> nextMsgGroupIdA = new ArrayList<>();
// 대안: entrySet() 직접 사용 // 대안: entrySet() 직접 사용
String apiMsgGroupId = "";
String apiMsgType = "";
for (Map.Entry<String, List<KakaoSendAdvcVO>> entry : priceGroupedMessages.entrySet()) { for (Map.Entry<String, List<KakaoSendAdvcVO>> entry : priceGroupedMessages.entrySet()) {
// entry 사용 // entry 사용
@ -940,6 +950,14 @@ public class KakaoAlimTalkServiceImpl extends EgovAbstractServiceImpl implements
groupedMsgList.forEach(t -> t.setMsgGroupId(nextMsgGroupId)); groupedMsgList.forEach(t -> t.setMsgGroupId(nextMsgGroupId));
// api 전달
apiMsgGroupId = StringUtils.isNotEmpty(apiMsgGroupId)
? apiMsgGroupId + "," + nextMsgGroupId
: nextMsgGroupId;
apiMsgType = StringUtils.isNotEmpty(apiMsgType)
? apiMsgType + "," + kakaoSendAdvcListVO.get(0).getMsgType()
: kakaoSendAdvcListVO.get(0).getMsgType();
// 발송 데이터 삽입 // 발송 데이터 삽입
int instCnt = this.insertKakaoData_advc(groupedMsgList); int instCnt = this.insertKakaoData_advc(groupedMsgList);
// int instCnt = 6; // int instCnt = 6;
@ -995,7 +1013,14 @@ public class KakaoAlimTalkServiceImpl extends EgovAbstractServiceImpl implements
} }
apiReturnMap.put("resultSts", instTotalCnt);
// 그룹 ID
apiReturnMap.put("msgGroupId", apiMsgGroupId);
// 메세지 타입
apiReturnMap.put("msgType", apiMsgType);
returnMap.put("resultSts", instTotalCnt); returnMap.put("resultSts", instTotalCnt);
returnMap.put("reserYn", kakaoVO.getReserveYn()); returnMap.put("reserYn", kakaoVO.getReserveYn());
returnMap.put("groupIds", nextMsgGroupIdA); returnMap.put("groupIds", nextMsgGroupIdA);
@ -1025,6 +1050,9 @@ public class KakaoAlimTalkServiceImpl extends EgovAbstractServiceImpl implements
statusResponse.setStatus(HttpStatus.OK); statusResponse.setStatus(HttpStatus.OK);
statusResponse.setObject(returnMap); statusResponse.setObject(returnMap);
apiReturnMap.put("result", HttpStatus.OK);
apiReturnMap.put("message", "전송이 완료되었습니다.");
statusResponse.setApiReturn(apiReturnMap);
return statusResponse; return statusResponse;
} }
@ -1061,7 +1089,8 @@ public class KakaoAlimTalkServiceImpl extends EgovAbstractServiceImpl implements
Float totPrice = eachPrice * instCnt; Float totPrice = eachPrice * instCnt;
sendVO.setTotPrice(String.format("%.1f", totPrice)); sendVO.setTotPrice(String.format("%.1f", totPrice));
sendVO.setAtDelayYn(kakaoVO.getAtSmishingYn()); sendVO.setAtDelayYn(StringUtils.isEmpty(kakaoVO.getAtSmishingYn()) ? "N" : kakaoVO.getAtSmishingYn());
sendVO.setSendKind(StringUtils.isEmpty(kakaoVO.getSendKind()) ? "H" : kakaoVO.getSendKind());
sendVO.setBizKakaoResendOrgnlTxt(kakaoVO.getSubMsgTxt()); sendVO.setBizKakaoResendOrgnlTxt(kakaoVO.getSubMsgTxt());
sendVO.setBizKakaoResendType(sendVO.getSubMsgType()); sendVO.setBizKakaoResendType(sendVO.getSubMsgType());

View File

@ -4139,7 +4139,7 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
* */ * */
if (!isCashSufficient(mjonMsgVO, mjonMsgSendVOList)) { if (!isCashSufficient(mjonMsgVO, mjonMsgSendVOList)) {
log.error("Insufficient balance for message sending."); log.error("Insufficient balance for message sending.");
return new StatusResponse(HttpStatus.BAD_REQUEST, "문자 발송에 필요한 보유 잔액이 부족 합니다."); return new StatusResponse(HttpStatus.BAD_REQUEST, "문자 발송에 필요한 보유 잔액이 부족 합니다.", "STAT_1060");
} }
System.out.println("==================== insert 시작 ===================="); System.out.println("==================== insert 시작 ====================");

View File

@ -139,6 +139,7 @@
BEF_POINT, BEF_POINT,
TOT_PRICE, TOT_PRICE,
SEND_KIND,
AT_DELAY_YN, AT_DELAY_YN,
BIZ_KAKAO_RESEND_ORGNL_TXT, BIZ_KAKAO_RESEND_ORGNL_TXT,
@ -161,6 +162,7 @@
#befPoint#, #befPoint#,
#totPrice#, #totPrice#,
#sendKind#,
#atDelayYn#, #atDelayYn#,
#bizKakaoResendOrgnlTxt#, #bizKakaoResendOrgnlTxt#,

View File

@ -2319,6 +2319,7 @@
EVENT_YN, EVENT_YN,
DELAY_YN, DELAY_YN,
AT_DELAY_YN, AT_DELAY_YN,
SEND_KIND,
BIZ_KAKAO_RESEND_ORGNL_TXT, BIZ_KAKAO_RESEND_ORGNL_TXT,
SUBJECT_CHK_YN SUBJECT_CHK_YN
) )
@ -2346,6 +2347,7 @@
#eventYn#, #eventYn#,
#delayYn#, #delayYn#,
#atDelayYn#, #atDelayYn#,
#sendKind#,
#kakaoSubMagOrgnlTxt#, #kakaoSubMagOrgnlTxt#,
#subjectChkYn# #subjectChkYn#
) )