알림톡 친구톡 api 완료
This commit is contained in:
parent
faba5b99cf
commit
f8e8388aaa
@ -38,9 +38,12 @@ public class MsgAtRequestVO implements Serializable {
|
||||
|
||||
private String callFrom; // value = "발신번호 :: 정책이 필요함", example = "01011112222"
|
||||
|
||||
private String reserveYn = "N"; // 예약발송 여부 (기본: N)
|
||||
// 대체문자 여부
|
||||
private String subMsgSendYn;
|
||||
|
||||
private Boolean hasTemplateTitle = false; // 템플릿에 타이틀이 있으면 true
|
||||
|
||||
private String test_yn;
|
||||
|
||||
private List<VarAtListMapVO> varListMap = new ArrayList<>();
|
||||
|
||||
@ -44,7 +44,6 @@ public class AtIndexedParameterParserService {
|
||||
Map<Integer, Map<String, String>> indexedDataMap = new HashMap<>();
|
||||
|
||||
|
||||
String subMsgSendYn = msgAtRequestVO.getSubMsgSendYn();
|
||||
|
||||
// 모든 파라미터를 순회하며 인덱스된 파라미터 찾기
|
||||
for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
|
||||
@ -65,7 +64,9 @@ public class AtIndexedParameterParserService {
|
||||
// 인덱스 순서대로 VarListMapVO 생성
|
||||
List<Integer> sortedIndexes = new ArrayList<>(indexedDataMap.keySet());
|
||||
Collections.sort(sortedIndexes);
|
||||
|
||||
|
||||
// 대체문자전송여부
|
||||
String subMsgSendYn = msgAtRequestVO.getSubMsgSendYn();
|
||||
for (Integer index : sortedIndexes) {
|
||||
Map<String, String> dataMap = indexedDataMap.get(index);
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ public class AtParameterProcessingService {
|
||||
if (STAT_2010 != null) return STAT_2010;
|
||||
|
||||
// 템플릿 코드 확인
|
||||
String STAT_2030 = this.validateTemplateCode(msgAtRequestVO.getMberId(), msgAtRequestVO.getSenderKey(), msgAtRequestVO.getTemplateCode());
|
||||
String STAT_2030 = this.validateTemplateCode(msgAtRequestVO);
|
||||
if (STAT_2030 != null) return STAT_2030;
|
||||
|
||||
// 파싱 로직을 IndexedParameterParserService에 위임
|
||||
@ -67,7 +67,7 @@ public class AtParameterProcessingService {
|
||||
|
||||
// 파싱된 각 VO에 대해 검증 수행
|
||||
for (VarAtListMapVO vo : parsedList) {
|
||||
String validationError = MunjaUtil.kakaoAtValidate(vo, msgAtRequestVO.getSubMsgSendYn());
|
||||
String validationError = MunjaUtil.kakaoAtValidate(vo, msgAtRequestVO);
|
||||
|
||||
if (StringUtils.isNotEmpty(validationError)) {
|
||||
return validationError; // 검증 실패 시 오류 코드 반환
|
||||
@ -80,7 +80,13 @@ public class AtParameterProcessingService {
|
||||
return null; // 모든 검증 통과
|
||||
}
|
||||
|
||||
private String validateTemplateCode(String mberId, String senderKey, String templateCode) {
|
||||
private String validateTemplateCode(MsgAtRequestVO msgAtRequestVO) {
|
||||
// private String validateTemplateCode(String mberId, String senderKey, String templateCode) {
|
||||
|
||||
String mberId = msgAtRequestVO.getMberId();
|
||||
String senderKey = msgAtRequestVO.getSenderKey();
|
||||
String templateCode = msgAtRequestVO.getTemplateCode();
|
||||
|
||||
try {
|
||||
BizTemplateRequest request = BizTemplateRequest.builder()
|
||||
.mberId(mberId)
|
||||
@ -91,8 +97,19 @@ public class AtParameterProcessingService {
|
||||
RestResponse response = inqryService.getTemplateDetail(request);
|
||||
JsonNode node = new ObjectMapper().valueToTree(response.getData());
|
||||
// 전체 출력
|
||||
// log.info("data 전체 :: {}", node.toPrettyString());
|
||||
// resultCode가 있으면 채널ID 오류 + inqryService.getTemplateDetail 참조
|
||||
|
||||
// 로그 출력
|
||||
log.info("JsonNode :: {}", node.toPrettyString()); // 보기 좋게 출력
|
||||
if (node.path("data").has("templateTitle") && !node.path("data").get("templateTitle").isNull()) {
|
||||
// log.info("templateTitle 있음 :: {}", node.path("data").get("templateTitle").asText());
|
||||
msgAtRequestVO.setHasTemplateTitle(true);
|
||||
} else {
|
||||
// log.info("templateTitle 없음 또는 null");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (node.has("resultCode")) {
|
||||
return "STAT_"+node.get("resultCode").asText();
|
||||
}
|
||||
|
||||
@ -67,11 +67,6 @@ public class SendAtServiceImpl implements SendAtService {
|
||||
return new RestResponse(new FailRestResponse(falseCode,""));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
MjonResponseVO munjaSendResponse = apiService.postForEntity(
|
||||
"/web/mjon/kakao/alimtalk/kakaoAlimTalkMsgSendAjax_advc.do"
|
||||
, msgAtRequestVO
|
||||
|
||||
@ -71,7 +71,6 @@ public class FtParameterProcessingService {
|
||||
// if (STAT_2030 != null) return STAT_2030;
|
||||
|
||||
// 파싱 로직을 IndexedParameterParserService에 위임
|
||||
log.info("msgFtRequestVO.getAdFlag() :: [{}]", msgFtRequestVO.getAdFlag());
|
||||
List<VarFtListMapVO> parsedList = indexedParameterParserService.parseIndexedParameters(msgFtRequestVO, request);
|
||||
|
||||
// 파싱된 각 VO에 대해 검증 수행
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.itn.mjonApi.util;
|
||||
|
||||
import com.itn.mjonApi.mjon.api.kakao.at.send.mapper.domain.MsgAtRequestVO;
|
||||
import com.itn.mjonApi.mjon.api.kakao.at.send.mapper.domain.VarAtListMapVO;
|
||||
import com.itn.mjonApi.mjon.api.kakao.ft.send.mapper.domain.MsgFtRequestVO;
|
||||
import com.itn.mjonApi.mjon.api.kakao.ft.send.mapper.domain.VarFtListMapVO;
|
||||
@ -106,11 +107,14 @@ public class MunjaUtil {
|
||||
* VarListMapVO의 필드들을 검증
|
||||
*
|
||||
* @param vo 검증할 VarListMapVO 객체
|
||||
* @param subMsgSendYn 대체문자 발송 여부
|
||||
* @param msgAtRequestVO
|
||||
* @return 검증 실패 시 오류 코드, 성공 시 null
|
||||
*/
|
||||
public static String kakaoAtValidate(VarAtListMapVO vo, String subMsgSendYn) {
|
||||
public static String kakaoAtValidate(VarAtListMapVO vo, MsgAtRequestVO msgAtRequestVO) {
|
||||
|
||||
|
||||
String subMsgSendYn = msgAtRequestVO.getSubMsgSendYn();
|
||||
Boolean hasTemplateTitle = msgAtRequestVO.getHasTemplateTitle();
|
||||
// 수신번호 검증
|
||||
String callTo = vo.getCallToList();
|
||||
if (MunjaUtil.getCallToChk(callTo)) {
|
||||
@ -123,9 +127,8 @@ public class MunjaUtil {
|
||||
return "STAT_2040"; // 본문 데이터 오류
|
||||
}
|
||||
|
||||
// 타이틀 데이터 검증
|
||||
String templateTitle = vo.getTemplateTitle();
|
||||
if (StringUtils.isEmpty(templateTitle)) {
|
||||
// 템플릿에 타이틀이 있으면 값 확인
|
||||
if (hasTemplateTitle && StringUtils.isEmpty(vo.getTemplateTitle())) {
|
||||
return "STAT_2041"; // 타이틀 데이터 오류
|
||||
}
|
||||
|
||||
@ -145,7 +148,7 @@ public class MunjaUtil {
|
||||
public static String kakaoFtValidate(VarFtListMapVO vo, MsgFtRequestVO msgFtRequestVO) {
|
||||
|
||||
log.info(" vo.toString() [{}]", vo.toString());
|
||||
|
||||
String ok = null;
|
||||
// 수신번호 검증
|
||||
String callTo = vo.getPhone();
|
||||
if (MunjaUtil.getCallToChk(callTo)) {
|
||||
@ -173,7 +176,7 @@ public class MunjaUtil {
|
||||
}
|
||||
|
||||
// 모든 검증 통과
|
||||
return null;
|
||||
return ok;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user