알림톡발송전 채널ID, 템플릿 코드 확인로직 추가
This commit is contained in:
parent
d87651a558
commit
2db3d41020
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
HELP.md
|
||||
target/
|
||||
log/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
@ -198,3 +199,4 @@ fabric.properties
|
||||
rebel.xml
|
||||
/mvnw
|
||||
/mvnw.cmd
|
||||
/log.config.path_IS_UNDEFINED/
|
||||
|
||||
@ -195,18 +195,18 @@ public class LogAspect {
|
||||
* @description 메세지 그룹 테이블에 발송 구분 업데이트
|
||||
* @param apiSendMsgLogVO
|
||||
*/
|
||||
private void updateMsgGroupTbSendKind(LettnApiSendMsgLogVO apiSendMsgLogVO) {
|
||||
if(StringUtils.isNotEmpty(apiSendMsgLogVO.getMsgGroupId()))
|
||||
{
|
||||
String[] msgGroupIds = null;
|
||||
if(apiSendMsgLogVO.getMsgGroupId().indexOf(",") > -1){
|
||||
msgGroupIds = apiSendMsgLogVO.getMsgGroupId().split(",");
|
||||
}else{
|
||||
msgGroupIds = new String[]{apiSendMsgLogVO.getMsgGroupId()};
|
||||
}
|
||||
mjMsgGroupDataMapper.update(msgGroupIds);
|
||||
}
|
||||
}
|
||||
// private void updateMsgGroupTbSendKind(LettnApiSendMsgLogVO apiSendMsgLogVO) {
|
||||
// if(StringUtils.isNotEmpty(apiSendMsgLogVO.getMsgGroupId()))
|
||||
// {
|
||||
// String[] msgGroupIds = null;
|
||||
// if(apiSendMsgLogVO.getMsgGroupId().indexOf(",") > -1){
|
||||
// msgGroupIds = apiSendMsgLogVO.getMsgGroupId().split(",");
|
||||
// }else{
|
||||
// msgGroupIds = new String[]{apiSendMsgLogVO.getMsgGroupId()};
|
||||
// }
|
||||
// mjMsgGroupDataMapper.update(msgGroupIds);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @description lettngnrlmber_api_send_msg_log 테이블에 저장할 데이터 만들기
|
||||
@ -350,6 +350,7 @@ public class LogAspect {
|
||||
case "MsgRequestVO":
|
||||
case "MjKakaoProfileInfoVO":
|
||||
case "BizTemplateRequest":
|
||||
case "MsgAtRequestVO":
|
||||
return ApiObjectUtil.toJson(returnValue);
|
||||
default:
|
||||
log.info("데이터를 추가해 주세요");
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
package com.itn.mjonApi.cmn.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class CmnVO {
|
||||
|
||||
private String mberId; // 사용자 ID
|
||||
|
||||
@ -1,25 +1,19 @@
|
||||
package com.itn.mjonApi.cmn.domain.biz.template;
|
||||
|
||||
import com.itn.mjonApi.cmn.domain.CmnVO;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
//@Getter
|
||||
//@Setter
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class BizTemplateRequest {
|
||||
@SuperBuilder
|
||||
public class BizTemplateRequest extends CmnVO {
|
||||
private String bizId;
|
||||
private String apiKey;
|
||||
private String senderKey;
|
||||
private String templateCode;
|
||||
|
||||
public String getBizId() { return bizId; }
|
||||
public void setBizId(String bizId) { this.bizId = bizId; }
|
||||
public String getApiKey() { return apiKey; }
|
||||
public void setApiKey(String apiKey) { this.apiKey = apiKey; }
|
||||
public String getSenderKey() { return senderKey; }
|
||||
public void setSenderKey(String senderKey) { this.senderKey = senderKey; }
|
||||
public String getTemplateCode() { return templateCode; }
|
||||
public void setTemplateCode(String templateCode) { this.templateCode = templateCode; }
|
||||
}
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
package com.itn.mjonApi.cmn.msg;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@ -11,6 +8,7 @@ import java.time.LocalDateTime;
|
||||
@Getter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class RestResponse{
|
||||
|
||||
private String resultCode = "0";
|
||||
|
||||
@ -45,10 +45,14 @@ public enum StatMsg {
|
||||
, STAT_1099("1099","기타 시스템 오류")
|
||||
|
||||
//카톡발송======================================================================
|
||||
, STAT_2010("2010","발신프로필 KEY 오류")
|
||||
, STAT_2030("2030","템플릿 코드 오류")
|
||||
, STAT_2040("2040","본문 데이터 오류")
|
||||
, STAT_2041("2041","타이틀 데이터 오류")
|
||||
, STAT_2042("2042","대체문자 데이터 오류")
|
||||
|
||||
, STAT_2099("2099","기타 시스템 오류")
|
||||
|
||||
|
||||
//전체발송======================================================================
|
||||
, STAT_3099("3099","기타 시스템 오류")
|
||||
|
||||
@ -4,6 +4,7 @@ import com.itn.mjonApi.mjon.api.kakao.at.inqry.mapper.domain.MjKakaoProfileInfoV
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
@ -20,12 +21,9 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface InqryMapper {
|
||||
|
||||
List<MjKakaoProfileInfoVO> getChnlIds(MjKakaoProfileInfoVO mjKakaoProfileInfoVO);
|
||||
List<MjKakaoProfileInfoVO> getChnlIds(String mberId);
|
||||
|
||||
int isTemplateExist(Map<String, Object> params);
|
||||
|
||||
|
||||
//double selectUserMoney(String mberId);
|
||||
|
||||
// List<MjonResponseVO> selectApiInqryHstry(HstryVO hstryVO);
|
||||
//
|
||||
// List<MjonResponseVO> selectApiInqryHstryDetail(HstryDetailVO hstryDetailVO);
|
||||
//
|
||||
}
|
||||
|
||||
@ -14,11 +14,14 @@ import com.itn.mjonApi.mjon.api.kakao.at.inqry.mapper.domain.MjKakaoProfileInfoV
|
||||
import com.itn.mjonApi.mjon.api.kakao.at.inqry.service.InqryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.connector.Response;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* packageName : com.itn.mjonApi.mjon.api.kakao.inqry.service.Impl
|
||||
@ -55,18 +58,21 @@ public class InqryServiceImpl implements InqryService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResponse getChnlId(MjKakaoProfileInfoVO mjKakaoProfileInfoVO) {
|
||||
public List<MjKakaoProfileInfoVO> getChnlId(String mberId) {
|
||||
|
||||
List<MjKakaoProfileInfoVO> voList = inqryMapper.getChnlIds(mjKakaoProfileInfoVO);
|
||||
List<MjKakaoProfileInfoVO> voList = inqryMapper.getChnlIds(mberId);
|
||||
|
||||
log.info(" mjKakaoProfileInfoVO toString [{}]", mjKakaoProfileInfoVO.toString());
|
||||
return new RestResponse(voList);
|
||||
return voList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResponse getTemplates(BizTemplateRequest bizTemplateRequest) throws JsonProcessingException {
|
||||
|
||||
|
||||
// SenderKey 검증
|
||||
RestResponse STAT_2010 = isSenderKeyChk(bizTemplateRequest);
|
||||
if (STAT_2010 != null) return STAT_2010;
|
||||
|
||||
// 1. 템플릿 목록 조회 요청 DTO 생성 (BIZ ID, API Key, senderKey 포함)
|
||||
BizTemplateRequest requestDto= BizTemplateRequest.builder()
|
||||
.bizId(BIZ_ID)
|
||||
@ -110,6 +116,11 @@ public class InqryServiceImpl implements InqryService {
|
||||
@Override
|
||||
public RestResponse getTemplateDetail(BizTemplateRequest bizTemplateRequest) throws JsonProcessingException {
|
||||
|
||||
|
||||
// SenderKey 검증
|
||||
RestResponse STAT_2010 = isSenderKeyChk(bizTemplateRequest);
|
||||
if (STAT_2010 != null) return STAT_2010;
|
||||
|
||||
// 1. 템플릿 목록 조회 요청 DTO 생성 (BIZ ID, API Key, senderKey 포함)
|
||||
BizTemplateRequest requestDto= BizTemplateRequest.builder()
|
||||
.bizId(BIZ_ID)
|
||||
@ -130,5 +141,24 @@ public class InqryServiceImpl implements InqryService {
|
||||
return new RestResponse(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTemplateExist(String senderKey, String templateCode) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("senderKey", senderKey);
|
||||
params.put("templateCode", templateCode);
|
||||
return inqryMapper.isTemplateExist(params) > 0;
|
||||
}
|
||||
|
||||
private @Nullable RestResponse isSenderKeyChk(BizTemplateRequest bizTemplateRequest) {
|
||||
List<MjKakaoProfileInfoVO> chnlIdList = this.getChnlId(bizTemplateRequest.getMberId());
|
||||
|
||||
boolean skErr = chnlIdList.stream()
|
||||
.anyMatch(p -> bizTemplateRequest.getSenderKey().equals(p.getSenderKey()));
|
||||
if(!skErr){
|
||||
return new RestResponse(new FailRestResponse("STAT_2010", ""));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -5,10 +5,14 @@ import com.itn.mjonApi.cmn.domain.biz.template.BizTemplateRequest;
|
||||
import com.itn.mjonApi.cmn.msg.RestResponse;
|
||||
import com.itn.mjonApi.mjon.api.kakao.at.inqry.mapper.domain.MjKakaoProfileInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface InqryService {
|
||||
RestResponse getChnlId(MjKakaoProfileInfoVO mjKakaoProfileInfoVO);
|
||||
List<MjKakaoProfileInfoVO> getChnlId(String mberId);
|
||||
|
||||
RestResponse getTemplates(BizTemplateRequest bizTemplateRequest) throws JsonProcessingException;
|
||||
|
||||
RestResponse getTemplateDetail(BizTemplateRequest bizTemplateRequest) throws JsonProcessingException;
|
||||
|
||||
boolean isTemplateExist(String senderKey, String templateCode);
|
||||
}
|
||||
|
||||
@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* fileName : InqryRestContoller.java
|
||||
@ -40,7 +42,9 @@ public class InqryRestContoller {
|
||||
@PostMapping("/api/kakao/inqry/chnlId")
|
||||
public ResponseEntity<RestResponse> getChnlId(MjKakaoProfileInfoVO mjKakaoProfileInfoVO) throws Exception {
|
||||
|
||||
return ResponseEntity.ok().body(inqryService.getChnlId(mjKakaoProfileInfoVO));
|
||||
List<MjKakaoProfileInfoVO> resultList = inqryService.getChnlId(mjKakaoProfileInfoVO.getMberId());
|
||||
|
||||
return ResponseEntity.ok().body(new RestResponse(resultList));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ import java.util.*;
|
||||
@ToString
|
||||
@Getter
|
||||
@Setter
|
||||
public class MsgAtRequestVO extends SendRequestCmnVO implements Serializable {
|
||||
public class MsgAtRequestVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<mapper namespace="com.itn.mjonApi.mjon.api.kakao.at.inqry.mapper.InqryMapper">
|
||||
|
||||
<select id="getChnlIds" resultType="com.itn.mjonApi.mjon.api.kakao.at.inqry.mapper.domain.MjKakaoProfileInfoVO">
|
||||
|
||||
/* kakao at getChnlIds */
|
||||
SELECT
|
||||
-- USER_ID
|
||||
-- , PROFILE_ID
|
||||
@ -26,4 +26,18 @@
|
||||
AND USER_ID = #{mberId}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="isTemplateExist" parameterType="map" resultType="int">
|
||||
/* kakao at isTemplateExist */
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
mj_kakao_profile_info
|
||||
WHERE
|
||||
SENDER_KEY = #{senderKey}
|
||||
AND TEMPLATE_CODE = #{templateCode}
|
||||
AND DELETE_YN = 'N'
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user