From c7f524213bf5c3db48fc3f92f8fd05f68211a176 Mon Sep 17 00:00:00 2001 From: limju Date: Tue, 17 Oct 2023 17:32:06 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20KT=20API=20=EB=B0=9C=EC=86=A1=EC=88=98?= =?UTF-8?q?=EC=8B=A0=EA=B2=B0=EA=B3=BC=20add?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/biz/kt/service/BizKtMmsService.java | 78 ++++++++++++++----- .../xit/biz/kt/service/IBizKtMmsService.java | 1 + .../kr/xit/biz/kt/web/BizKtMmsController.java | 23 ++++++ .../kr/xit/biz/ens/model/kt/KtMmsSendDTO.java | 9 +-- 4 files changed, 86 insertions(+), 25 deletions(-) diff --git a/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java b/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java index 953af06..946c79d 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/service/BizKtMmsService.java @@ -9,9 +9,12 @@ import kr.xit.biz.ens.model.kt.KtCommonDTO.KtCommonResponse; import kr.xit.biz.ens.model.kt.KtCommonDTO.KtMnsRequest; import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendReqData; import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendRequest; +import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMsgRsltReqData; +import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMsgRsltRequest; import kr.xit.biz.ens.model.kt.KtTokenDTO.KtTokenResponse; import kr.xit.biz.kt.mapper.IBizKtMmsMapper; import kr.xit.core.exception.BizRuntimeException; +import kr.xit.core.support.utils.DateUtils; import kr.xit.ens.kt.service.IKtMmsService; import lombok.RequiredArgsConstructor; import org.apache.commons.collections4.ListUtils; @@ -105,30 +108,65 @@ public class BizKtMmsService extends EgovAbstractServiceImpl implements IBizKtMm KtCommonResponse ktTokenResponse = null; for(List reqs : parts) { - KtMainSendRequest ktReqDTO = KtMainSendRequest.builder() - .signguCode(reqDTO.getSignguCode()) - .ffnlgCode(reqDTO.getFfnlgCode()) - .profile(profile) - //.serviceCd("cache") - //.serviceKey("cache") - .msgCd("db") - //.msgType("2") - .makeDt("123456789012db") - .sndnExTime("123456789012db") - .exTime("123456789012db") - //.mType("4") - .sndnTotCnt(reqs.size()) //-> 요청건수 count - .mmsBinary("db") - .fileFmat("db") - .testSndnYn("N") - .reqs(reqs) - .build(); - - ktTokenResponse = ktMmsService.mainSend(ktReqDTO); + ktTokenResponse = ktMmsService.mainSend( + KtMainSendRequest.builder() + .signguCode(reqDTO.getSignguCode()) + .ffnlgCode(reqDTO.getFfnlgCode()) + .profile(profile) + //.serviceCd("cache") + //.serviceKey("cache") + .msgCd("db") + //.msgType("2") + .makeDt("123456789012db") + .sndnExTime("123456789012db") + .exTime("123456789012db") + //.mType("4") + .sndnTotCnt(reqs.size()) //-> 요청건수 count + .mmsBinary("db") + .fileFmat("db") + .testSndnYn("N") + .reqs(reqs) + .build() + ); } return ktTokenResponse; } + @Override + public KtCommonResponse messageResult(final KtMnsRequest reqDTO) { + + + List rsltReqs = new ArrayList<>(); + + KtMsgRsltReqData reqData = KtMsgRsltReqData.builder() + .srcKey("db") + .mmsSndgRsltSqno(1) // ++ + .prcsDt("YYYYMMDD") + .mmsBsnsDvcd("12345") + //.mblBzowrDvcd("01") + .mmsSndgRsltDvcd("40") + .mmsRdgTmst(DateUtils.getTodayAndNowTime("yyyyMMddHHmmss")) + //.msgType("2") + .build(); + rsltReqs.add(reqData); + + + List> parts = ListUtils.partition(rsltReqs, MAX_KT_SEND_CNT); + KtCommonResponse ktTokenResponse = null; + + for(List reqs : parts) { + ktTokenResponse = ktMmsService.messageResult( + KtMsgRsltRequest.builder() + .signguCode(reqDTO.getSignguCode()) + .ffnlgCode(reqDTO.getFfnlgCode()) + .profile(profile) + .reqs(reqs) + .build() + ); + + } + return ktTokenResponse; + } // /** // * 사전 문자 수신 등록 요청(BC-AG-SN-001) diff --git a/mens-api/src/main/java/kr/xit/biz/kt/service/IBizKtMmsService.java b/mens-api/src/main/java/kr/xit/biz/kt/service/IBizKtMmsService.java index 220331a..57c3ca0 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/service/IBizKtMmsService.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/service/IBizKtMmsService.java @@ -25,6 +25,7 @@ public interface IBizKtMmsService { KtTokenResponse requestToken(final KtMnsRequest paramDTO); KtCommonResponse mainSend(final KtMnsRequest reqDTO); + KtCommonResponse messageResult(final KtMnsRequest reqDTO); // KtCommonResponse beforeSend(final KtBefSendRequest reqDTO); // KtCommonResponse mainSend(final KtMainSendRequest reqDTO); diff --git a/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtMmsController.java b/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtMmsController.java index 2dfda87..989ee8f 100644 --- a/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtMmsController.java +++ b/mens-api/src/main/java/kr/xit/biz/kt/web/BizKtMmsController.java @@ -7,6 +7,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import java.util.Map; import kr.xit.biz.ens.model.kt.KtCommonDTO.KtCommonResponse; import kr.xit.biz.ens.model.kt.KtCommonDTO.KtMnsRequest; +import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMsgRsltRequest; import kr.xit.biz.kt.service.IBizKtMmsService; import kr.xit.core.model.ApiResponseDTO; import lombok.RequiredArgsConstructor; @@ -92,12 +93,34 @@ public class BizKtMmsController { return ApiResponseDTO.success(dto); } + @io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = { + @Content( + mediaType = "application/json", + examples = { + @ExampleObject( + name = "교통시설운영처", + value = PARAM1), + @ExampleObject( + name = "승화원", + value = PARAM2) + }) + }) + @Operation(summary = "사전/본 문자 발송/수신 결과 전송 요청", description = "사전/본 문자 발송/수신 결과 전송 요청(BC-AG-SN-010)") + @PostMapping(value = "/messageResult", produces = MediaType.APPLICATION_JSON_VALUE) + public ApiResponseDTO messageResult(@RequestBody final KtMnsRequest reqDTO) { + KtCommonResponse dto = service.messageResult(reqDTO); + return ApiResponseDTO.success(dto); + } + + @Operation(summary = "본문자 수신", description = "본문자 수신") @PostMapping(value = "/receiveMain", produces = MediaType.APPLICATION_JSON_VALUE) public void requestToken(@RequestBody final Map paramMap) { log.debug("{}", paramMap); } + + // // /* // @io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = { diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtMmsSendDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtMmsSendDTO.java index 8fa7175..4e78c09 100644 --- a/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtMmsSendDTO.java +++ b/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtMmsSendDTO.java @@ -862,8 +862,7 @@ public class KtMmsSendDTO { * 관리키 : 고객메시지 건별 Unique key */ @Schema(requiredMode = RequiredMode.REQUIRED, title = "관리키", example = "S20211229102000001") - @NotEmpty(message = "관리키는 필수 입니다(max:50)") - @Size(max = 50) + @Size(min = 1, max = 50, message = "관리키는 필수 입니다(max:50)") private String srcKey; /** @@ -901,7 +900,7 @@ public class KtMmsSendDTO { */ @Schema(requiredMode = RequiredMode.REQUIRED, title = "모바일사업자구분", example = "01") @Size(min = 2, max = 2, message = "모바일 사업자 구분은 필수 입니다(01|02|03)") - private String mblBzowrDvcd; + private final String mblBzowrDvcd = "01"; /** *
@@ -950,7 +949,7 @@ public class KtMmsSendDTO {
          */
         @Schema(requiredMode = RequiredMode.REQUIRED, title = "발송 메시지 타입", example = "2")
         @Size(min = 1, max = 1, message = "발송 메시지 타입은 필수 입니다")
-        private String msgType;
+        private final String msgType = "2";
         //-------------------------------------------------------------------
 
         /**
@@ -961,7 +960,7 @@ public class KtMmsSendDTO {
          */
         @Schema(requiredMode = RequiredMode.AUTO, title = "실제발송번호(일부)", example = " ")
         @Size(max = 20, message = "실제발송번호(일부)는 20자를 넘을 수 없습니다.")
-        private String rl_mms_sndg_telno;
+        private String rlMmsSndgTelno;
 
         /**
          *