카카오 알림톡 채널ID 중복 등록 오류 처리

- 중복 등록 방지 및 사용자 화면 등록버튼 클릭시 로딩바 나오도록  추가
This commit is contained in:
rosewiper 2023-10-06 16:29:27 +09:00
parent 5ca4268fd9
commit 99a16a8707
6 changed files with 57 additions and 6 deletions

View File

@ -149,11 +149,26 @@ public class KakaoApiProfile {
JSONObject tempCate = (JSONObject) object.get("data"); JSONObject tempCate = (JSONObject) object.get("data");
String senderKey = tempCate.get("senderKey").toString(); String senderKey = tempCate.get("senderKey").toString();
kakaoVO.setSenderKey(senderKey); kakaoVO.setSenderKey(senderKey);
kakaoApiService.insertKakaoProfileInfo(kakaoVO); int profileCnt = kakaoApiService.selectKakaoProfileCnt(kakaoVO);
//중복된 발신프로필이 없으면 추가 입력
if(profileCnt == 0) {
kakaoApiService.insertKakaoProfileInfo(kakaoVO);
}else {//중복이 있는 경우 처리
kakaoReturnVO.setBizReturnCode("310");
kakaoReturnVO.setBizReturnMsg("이미 등록되어 있는 발신프로필 입니다");
return kakaoReturnVO;
}
} }
}else { }else {
kakaoReturnVO.setBizReturnMsg("400 : 명령을 실행 오류");
kakaoReturnVO.setBizReturnCode(statusCode);
kakaoReturnVO.setBizReturnMsg("채널ID 등록에 오류가 발생하였습니다.");
return kakaoReturnVO;
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -28,4 +28,7 @@ public interface KakaoApiService {
KakaoVO selectFileInfo (KakaoVO kakaoVO) throws Exception; KakaoVO selectFileInfo (KakaoVO kakaoVO) throws Exception;
double selectKakaoCost(); double selectKakaoCost();
//sender key를 이용하여 등록된 발신 프로필이 있는지 조회
int selectKakaoProfileCnt(KakaoVO kakaoVO) throws Exception;
} }

View File

@ -49,4 +49,8 @@ public class KakaoApiDAO extends EgovAbstractDAO {
public double selectKakaoCost() { public double selectKakaoCost() {
return (double) select("KakaoApiDAO.selectKakaoCost"); return (double) select("KakaoApiDAO.selectKakaoCost");
} }
public int selectKakaoProfileCnt(KakaoVO kakaoVO) throws Exception{
return (int) select("kakaoApiDAO.selectKakaoProfileCnt", kakaoVO);
}
} }

View File

@ -7,7 +7,6 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl; import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
import egovframework.rte.fdl.cmmn.exception.FdlException;
import egovframework.rte.fdl.idgnr.EgovIdGnrService; import egovframework.rte.fdl.idgnr.EgovIdGnrService;
import itn.let.kakao.kakaoComm.KakaoVO; import itn.let.kakao.kakaoComm.KakaoVO;
import itn.let.kakao.kakaoComm.kakaoApi.service.KakaoApiService; import itn.let.kakao.kakaoComm.kakaoApi.service.KakaoApiService;
@ -68,4 +67,10 @@ public class KakaoApiServiceImpl extends EgovAbstractServiceImpl implements Kaka
public double selectKakaoCost() { public double selectKakaoCost() {
return kakaoApiDAO.selectKakaoCost(); return kakaoApiDAO.selectKakaoCost();
} }
//sender key를 이용하여 등록된 발신 프로필이 있는지 조회
@Override
public int selectKakaoProfileCnt(KakaoVO kakaoVO) throws Exception{
return kakaoApiDAO.selectKakaoProfileCnt(kakaoVO);
}
} }

View File

@ -231,4 +231,14 @@
ORDER BY COST_ID DESC ORDER BY COST_ID DESC
LIMIT 1 LIMIT 1
</select> </select>
<select id="kakaoApiDAO.selectKakaoProfileCnt" parameterClass="kakaoVO" resultClass="Integer">
SELECT COUNT(PROFILE_ID)
FROM MJ_KAKAO_PROFILE_INFO
WHERE SENDER_KEY = #senderKey#
AND DELETE_YN = 'N'
</select>
</sqlMap> </sqlMap>

View File

@ -251,7 +251,7 @@ function sendProfile(){
, type : 'POST' , type : 'POST'
, data : data , data : data
, dataType:'json' , dataType:'json'
, async: false , async: true
, processData: false , processData: false
, contentType: false , contentType: false
, cache: false , cache: false
@ -277,8 +277,16 @@ function sendProfile(){
alert(returnData.kakaoInfo.bizReturnMsg); alert(returnData.kakaoInfo.bizReturnMsg);
return false; return false;
} }
} },
,error : function(request , status, error){ beforeSend : function(xmlHttpRequest) {
//로딩창 show
$('.loading_layer').addClass('active');
},
complete : function(xhr, textStatus) {
//로딩창 hide
$('.loading_layer').removeClass('active');
},
error : function(request , status, error){
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error); alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
} }
}); });
@ -386,6 +394,12 @@ function linkPage(pageNo){
} }
</script> </script>
<div class="loading_layer">
<div class="loading_container">
<div class="bar"></div>
<div class="text">Loading</div>
</div>
</div>
<!-- 기업회원 이동 팝업 --> <!-- 기업회원 이동 팝업 -->
<div class="tooltip-wrap cvt_member_popup_wrap"> <div class="tooltip-wrap cvt_member_popup_wrap">