From 178d546ee41de0ec07c1e1a2ed730b763d02dd51 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Mon, 9 Sep 2024 13:41:43 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=ED=86=A1=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=B0=98=EC=98=81=20-=20send=20=20=20=20?= =?UTF-8?q?=20=20=20-=20mapper=20SQL=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kkotalk/mapper/IKkoTalkMapper.java | 2 +- .../kkotalk/service/KkoTalkService.java | 20 ------- .../service/support/KkoTalkApiService.java | 4 +- .../service/support/KkoTalkRsltProvider.java | 41 +++++++-------- .../service/support/KkoTalkSender.java | 3 +- .../kkotalk/web/KkotalkController.java | 48 ++++++++--------- .../modules/iup-kkotalk-mapper.xml | 52 +++++++++---------- 7 files changed, 73 insertions(+), 97 deletions(-) diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/mapper/IKkoTalkMapper.java b/src/main/java/cokr/xit/ens/modules/kkotalk/mapper/IKkoTalkMapper.java index d7cf03b..40e5d53 100644 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/mapper/IKkoTalkMapper.java +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/mapper/IKkoTalkMapper.java @@ -32,7 +32,7 @@ public interface IKkoTalkMapper { List findAllFetchBySendMastId(Long sendMastId); - Optional findFetchByExternalIdAndEnvelopeId(String externalId, String envelopeId); + Optional findFetchByExternalIdAndEnvelopeId(Map map); List findAllBySendMastAndEnvlopeIdIsNotNull(SendMast sendMast); diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/service/KkoTalkService.java b/src/main/java/cokr/xit/ens/modules/kkotalk/service/KkoTalkService.java index 72ff823..5e71add 100644 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/service/KkoTalkService.java +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/service/KkoTalkService.java @@ -434,26 +434,6 @@ public class KkoTalkService { .errMsg(String.format("%s %s", resp.getErrorCode(), resp.getErrorMessage())) .build(); } - // ResponseEntity resp = kkoTalkApi.readCompleted(orgMng.getKkoMdAccessToken(), documentBinderUuid); - // - // - // if (resp.getStatusCode().equals(HttpStatus.NO_CONTENT)) { - // responseVO = EnsResponseVO.okBuilder().build(); - // } else { - // Map 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() diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkApiService.java b/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkApiService.java index 98e4096..567963a 100644 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkApiService.java +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkApiService.java @@ -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("상품 코드는 필수 입니다."); } diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltProvider.java b/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltProvider.java index d2cac7d..80e2192 100644 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltProvider.java +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltProvider.java @@ -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 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()) diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/web/KkotalkController.java b/src/main/java/cokr/xit/ens/modules/kkotalk/web/KkotalkController.java index e369f16..10ac30d 100644 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/web/KkotalkController.java +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/web/KkotalkController.java @@ -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.*; /** *
@@ -149,7 +143,10 @@ public class KkotalkController {
         final String externalId = mParam.get("externalId");
 
 
-        KkotalkDTO.SendDetailKkoTalkDTO sendDetail = talkMapper.findFetchByExternalIdAndEnvelopeId(externalId, envelopeId)
+        Map 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 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);
diff --git a/src/main/resources/mybatis-mapper/modules/iup-kkotalk-mapper.xml b/src/main/resources/mybatis-mapper/modules/iup-kkotalk-mapper.xml
index 2b49bee..e9d6cf9 100644
--- a/src/main/resources/mybatis-mapper/modules/iup-kkotalk-mapper.xml
+++ b/src/main/resources/mybatis-mapper/modules/iup-kkotalk-mapper.xml
@@ -84,33 +84,37 @@
 -->
     
 
     
+
+    
+
+    
+
+    
         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
-    
-
+