feat: 카카오톡 추가 반영 - send

- mapper SQL 반영
main
Jonguk. Lim 2 months ago
parent c30f20001d
commit 178d546ee4

@ -32,7 +32,7 @@ public interface IKkoTalkMapper {
List<KkotalkDTO.SendDetailKkoTalkDTO> findAllFetchBySendMastId(Long sendMastId);
Optional<KkotalkDTO.SendDetailKkoTalkDTO> findFetchByExternalIdAndEnvelopeId(String externalId, String envelopeId);
Optional<KkotalkDTO.SendDetailKkoTalkDTO> findFetchByExternalIdAndEnvelopeId(Map<String, String> map);
List<KkotalkDTO.SendDetailKkoTalkDTO> findAllBySendMastAndEnvlopeIdIsNotNull(SendMast sendMast);

@ -434,26 +434,6 @@ public class KkoTalkService {
.errMsg(String.format("%s %s", resp.getErrorCode(), resp.getErrorMessage()))
.build();
}
// ResponseEntity<String> resp = kkoTalkApi.readCompleted(orgMng.getKkoMdAccessToken(), documentBinderUuid);
//
//
// if (resp.getStatusCode().equals(HttpStatus.NO_CONTENT)) {
// responseVO = EnsResponseVO.okBuilder().build();
// } else {
// Map<String, Object> mResponse = null;
// try {
// Gson gson = new GsonBuilder().disableHtmlEscaping().create();
// mResponse = gson.fromJson(resp.getBody(), Map.class);
// } catch (Exception e) {
// throw new EnsException(EnsErrCd.ERR505, String.format("문서상태변경 응답데이터 파싱 실패. %s", resp.getBody()));
// }
// String errorCode = (String) mResponse.get("error_code");
// String errorMessage = (String) mResponse.get("error_message");
// responseVO = EnsResponseVO.errBuilder()
// .errCode(EnsErrCd.ERR600)
// .errMsg(String.format("%s %s", errorCode, errorMessage))
// .build();
// }
} catch (EnsException e) {
responseVO = EnsResponseVO.errBuilder()

@ -166,7 +166,7 @@ public class KkoTalkApiService {
* @param reqDTO KkotalkDTO.BulkSendRequest
* @return KkotalkDTO.BulkSendResponse
*/
public KkotalkDTO.BulkSendResponse requestSendBulk2(final KkotalkDTO.BulkSendRequest reqDTO) {
public KkotalkDTO.BulkSendResponse requestSendBulk(final KkotalkDTO.BulkSendRequest reqDTO) {
if(Checks.isEmpty(reqDTO.getProductCode())){
throw BizRuntimeException.create("상품 코드는 필수 입니다.");
}
@ -229,7 +229,7 @@ public class KkoTalkApiService {
* @param reqDTO KkotalkDTO.BulkSendRequest
* @return KkotalkDTO.BulkSendResponse
*/
public String requestSendBulk(final KkotalkDTO.BulkSendRequest reqDTO) {
public String requestSendBulk2(final KkotalkDTO.BulkSendRequest reqDTO) {
if(Checks.isEmpty(reqDTO.getProductCode())){
throw BizRuntimeException.create("상품 코드는 필수 입니다.");
}

@ -1,28 +1,26 @@
package cokr.xit.ens.modules.kkotalk.service.support;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.stream.Collectors;
import java.time.format.*;
import java.util.*;
import java.util.stream.*;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.*;
import org.springframework.transaction.annotation.*;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.core.utils.CmmnUtil;
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
import cokr.xit.ens.modules.common.code.StatCd;
import cokr.xit.ens.modules.common.domain.SendMast;
import cokr.xit.ens.modules.common.domain.repository.SendMastRepository;
import cokr.xit.ens.modules.kkomydoc.model.KkoMydocRsltRespDTO;
import cokr.xit.ens.modules.kkomydoc.model.config.KkoMydocStat;
import cokr.xit.ens.modules.kkotalk.mapper.IKkoTalkMapper;
import cokr.xit.ens.modules.kkotalk.model.KkoTalkRsltRespDTO;
import cokr.xit.ens.modules.kkotalk.model.KkotalkDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.core.exception.*;
import cokr.xit.ens.core.exception.code.*;
import cokr.xit.ens.core.utils.*;
import cokr.xit.ens.modules.common.biztmplt.*;
import cokr.xit.ens.modules.common.code.*;
import cokr.xit.ens.modules.common.domain.*;
import cokr.xit.ens.modules.common.domain.repository.*;
import cokr.xit.ens.modules.kkomydoc.model.*;
import cokr.xit.ens.modules.kkomydoc.model.config.*;
import cokr.xit.ens.modules.kkotalk.mapper.*;
import cokr.xit.ens.modules.kkotalk.model.*;
import lombok.*;
import lombok.extern.slf4j.*;
// FIXME: 카카오톡 신규 추가
@Slf4j
@ -32,7 +30,6 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport<EnsResponseVO, L
private final SendMastRepository sendMastRepository;
private final IKkoTalkMapper talkMapper;
//private final SendDetailKkoMydocRepository sendDetailKkoMydocRepository;
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)

@ -65,7 +65,6 @@ public class KkoTalkSender extends SendProcTemplate {
sendMast = sendMastRepository.findById(sendMastId).orElseThrow(() -> new EnsException(EnsErrCd.SEND404, String.format("일치하는 발송마스터 자료가 없습니다. [ sendMastId %s ]", sendMastId)));
sendDetails = talkMapper.findAllFetchBySendMastId(sendMast.getSendMastId());
//sendDetails = sendDetailKkoMydocRepository.findAllFetchBySendMastId(sendMast.getSendMastId());
OrgMng orgMng = orgMngService.find(sendMast.getOrgCd()).getResultInfo();
@ -78,7 +77,7 @@ public class KkoTalkSender extends SendProcTemplate {
try {
envelopes = this.makeMessage(list);
resp = kkoTalkApi.requestSendBulk(
resp = kkoTalkApi.requestSendBulk2(
KkotalkDTO.BulkSendRequest.builder()
.envelopes(envelopes)
.signguCode(orgMng.getOrgCd())

@ -1,27 +1,21 @@
package cokr.xit.ens.modules.kkotalk.web;
import java.util.Map;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.EnsException;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.modules.kkotalk.mapper.IKkoTalkMapper;
import cokr.xit.ens.modules.kkotalk.model.KkotalkDTO;
import cokr.xit.ens.modules.kkotalk.service.KkoTalkService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.*;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.core.exception.*;
import cokr.xit.ens.core.exception.code.*;
import cokr.xit.ens.modules.kkotalk.mapper.*;
import cokr.xit.ens.modules.kkotalk.model.*;
import cokr.xit.ens.modules.kkotalk.service.*;
import io.swagger.v3.oas.annotations.*;
import io.swagger.v3.oas.annotations.media.*;
import io.swagger.v3.oas.annotations.tags.*;
import lombok.*;
import lombok.extern.slf4j.*;
/**
* <pre>
@ -149,7 +143,10 @@ public class KkotalkController {
final String externalId = mParam.get("externalId");
KkotalkDTO.SendDetailKkoTalkDTO sendDetail = talkMapper.findFetchByExternalIdAndEnvelopeId(externalId, envelopeId)
Map<String, String> paramMap = new HashMap<>();
paramMap.put("envelopeId", envelopeId);
paramMap.put("externalId", externalId);
KkotalkDTO.SendDetailKkoTalkDTO sendDetail = talkMapper.findFetchByExternalIdAndEnvelopeId(paramMap)
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, "문서를 찾을 수 없습니다."));
EnsResponseVO<?> responseVO = service.tokenVerify("getOrgCd()", envelopeId, token, externalId);
@ -170,7 +167,10 @@ public class KkotalkController {
final String envelopeId = mParam.get("envelopeId");
KkotalkDTO.SendDetailKkoTalkDTO sendDetail = talkMapper.findFetchByExternalIdAndEnvelopeId(null, envelopeId)
Map<String, String> paramMap = new HashMap<>();
paramMap.put("envelopeId", envelopeId);
paramMap.put("externalId", null);
KkotalkDTO.SendDetailKkoTalkDTO sendDetail = talkMapper.findFetchByExternalIdAndEnvelopeId(paramMap)
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, "문서를 찾을 수 없습니다."));
EnsResponseVO<?> responseVO = service.readCmplt("getOrgCd()", envelopeId);

@ -84,33 +84,37 @@
-->
<select id="findAllBySendMastId" parameterType="long" resultType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|findAllBySendMastId-카카오톡발송대상 조회|julim */
SELECT send_detail_id,
title,
link,
hash,
guide,
payload,
read_expires_at,
review_expires_at,
use_non_personalized_noti AS useNonPersonalizedNotification,
ci,
phone_number,
name,
birthday,
external_id,
mk_jid,
mk_tmplt_msg_json_data,
error_code,
error_message,
bill_uid,
send_mast_id,
regist_dt
<include refid="sqlSelectSendDetailKkoTalk"/>
FROM ens_snd_dtl_kko_talk
WHERE send_mast_id = #{sendMastId}
</select>
<select id="findAllBySendMastAndEnvlopeIdIsNotNull" parameterType="cokr.xit.ens.modules.common.domain.SendMast" resultType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|findAllBySendMastAndEnvlopeIdIsNotNull-카카오톡 발송 결과 대상?? 조회|julim */
<include refid="sqlSelectSendDetailKkoTalk"/>
FROM ens_snd_dtl_kko_talk
WHERE send_mast_id = #{sendMastId}
AND envelope_id IS NOT NULL
</select>
<select id="findAllFetchBySendMastId" parameterType="long" resultType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|findAllFetchBySendMastId-카카오톡 발송 결과 대상?? 조회|julim */
<include refid="sqlSelectSendDetailKkoTalk"/>
FROM ens_snd_dtl_kko_talk
WHERE send_mast_id = #{sendMastId}
</select>
<select id="findFetchByExternalIdAndEnvelopeId" parameterType="map" resultType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|findFetchByExternalIdAndEnvelopeId-카카오톡 발송 결과 대상?? 조회|julim */
<include refid="sqlSelectSendDetailKkoTalk"/>
FROM ens_snd_dtl_kko_talk
WHERE envelope_id = #{envelope_id}
<if test="externalId != null and externalId != ''">
AND external_id = #{externalId}
</if>
</select>
<sql id="sqlSelectSendDetailKkoTalk">
SELECT send_detail_id,
title,
link,
@ -132,10 +136,6 @@
bill_uid,
send_mast_id,
regist_dt
FROM ens_snd_dtl_kko_talk
WHERE send_mast_id = #{sendMastId}
AND envelope_id IS NOT NULL
</select>
</sql>
</mapper>

Loading…
Cancel
Save