From 09268b5997e147641cba0308c3a3c5dc86626e51 Mon Sep 17 00:00:00 2001 From: limju Date: Fri, 3 Nov 2023 13:44:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=8B=9C=EC=84=A4=EA=B3=B5=EB=8B=A8=20?= =?UTF-8?q?API=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/biz/sisul/mapper/IBizSisulMapper.java | 7 ++ .../biz/sisul/model/SisulSndngResultDTO.java | 112 +++++++++++++++++- .../biz/sisul/service/BizSisulService.java | 23 +++- .../biz/sisul/service/IBizSisulService.java | 9 +- .../xit/biz/sisul/web/BizSisulController.java | 5 +- .../mapper/biz/ens-sisul-mysql-mapper.xml | 43 ++++--- 6 files changed, 172 insertions(+), 27 deletions(-) diff --git a/mens-api/src/main/java/kr/xit/biz/sisul/mapper/IBizSisulMapper.java b/mens-api/src/main/java/kr/xit/biz/sisul/mapper/IBizSisulMapper.java index 6b0e6f7..78b2fd0 100644 --- a/mens-api/src/main/java/kr/xit/biz/sisul/mapper/IBizSisulMapper.java +++ b/mens-api/src/main/java/kr/xit/biz/sisul/mapper/IBizSisulMapper.java @@ -1,9 +1,13 @@ package kr.xit.biz.sisul.mapper; +import java.util.List; import java.util.Optional; import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO; import kr.xit.biz.ens.model.cmm.TmplatManage; import kr.xit.biz.ens.model.cntc.CntcDTO; +import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulRequest; +import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulResDtlData; +import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulResMstData; import org.egovframe.rte.psl.dataaccess.mapper.Mapper; /** @@ -28,4 +32,7 @@ public interface IBizSisulMapper { int insertCntcSndngDtl(CntcDTO.SndngDtl dto); int insertCi(CmmEnsFileInfDTO.FmcInfExcelRslt dto); int insertPostPlusJson(CntcDTO.PostPlusJson dto); + + Optional selectSndngResultMaster(final RsltSisulRequest dto); + List selectSndngResultDetails(final RsltSisulRequest dto); } diff --git a/mens-api/src/main/java/kr/xit/biz/sisul/model/SisulSndngResultDTO.java b/mens-api/src/main/java/kr/xit/biz/sisul/model/SisulSndngResultDTO.java index 1bd02a1..3fdbf57 100644 --- a/mens-api/src/main/java/kr/xit/biz/sisul/model/SisulSndngResultDTO.java +++ b/mens-api/src/main/java/kr/xit/biz/sisul/model/SisulSndngResultDTO.java @@ -1,10 +1,12 @@ package kr.xit.biz.sisul.model; +import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema.RequiredMode; import javax.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; +import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; @@ -25,18 +27,120 @@ import lombok.NoArgsConstructor; */ public class SisulSndngResultDTO { - @Schema(name = "EpostTraceRequest", description = "발송결과정보 조회 request DTO") - @Getter + @Schema(name = "RsltSisulRequest", description = "발송결과정보 조회 request DTO") + @Data @NoArgsConstructor @AllArgsConstructor @Builder public static class RsltSisulRequest { - @Schema(requiredMode = RequiredMode.REQUIRED, title = "파일유일키", example = " ") - @Size(min = 10, max = 20, message = "파일유일키는 필수 입니다(max:20)") + /** + * 통합발송마스터 ID - 파일유일키 + */ + @Schema(requiredMode = RequiredMode.REQUIRED, title = "파일유일키", example = "DPMKK271000000777777") + @Size(min = 1, max = 20, message = "파일유일키는 필수 입니다(max:20)") private String unitySndngMastrId; + /** + * 통합발송상세 ID - 우편물 일련 번호 + */ @Schema(requiredMode = RequiredMode.AUTO, title = "우편물 일련번호", example = " ") @Size(max = 20, message = "우편물 일련번호는 20자를 넘을 수 없습니다.") private String unitySndngDetailId; } + + @Schema(name = "RsltSisulResMstData", description = "발송결과정보 master 조회 response DTO") + @Getter + @NoArgsConstructor + @AllArgsConstructor + @Builder + public static class RsltSisulResMstData { + + /** + * 통합발송마스터 ID - 파일유일키 + */ + private String unitySndngMastrId; + + /** + * 발송구분코드 - KKO-MY-DOC|KT-BC|POST-PLUS + */ + private String sndngSeCode; + + /** + * 템플릿ID + */ + private String tmplatId; + + /** + * 발송건수 + */ + private Integer sndngCo; + + /** + * 발송처리 상태 + */ + private String sndngProcessSttus; + + /** + * 발송일시 : yyyyMMddHHmiss + */ + private String sndngDt; + } + + @Schema(name = "RsltSisulResDtlData", description = "발송결과정보 details 조회 response DTO") + @Getter + @NoArgsConstructor + @AllArgsConstructor + @Builder + public static class RsltSisulResDtlData { + /** + * 통합발송마스터 ID - 파일유일키 + */ + private String unitySndngMastrId; + + /** + * 통합발송상세 ID - 우편물 일련 번호 + */ + private String unitySndngDetailId; + + /** + * 발송구분코드 - KKO-MY-DOC|KT-BC|POST-PLUS + */ + private String sndngSeCode; + + /** + * 템플릿ID + */ + private String tmplatId; + + /** + * 발송일시 : yyyyMMddHHmiss + */ + @JsonProperty("sndngDt") + private String requstDt; + + /** + * 수신일시 : yyyyMMddHHmiss + * recvDt 로 전송 + */ + @JsonProperty("recvDt") + private String inqireDt; + + /** + * 열람일시 : yyyyMMddHHmiss + * readDt 로 전송 + */ + @JsonProperty("readDt") + private String readngDt; + + /** + * 등기번호 + */ + private String rgistno; + + /** + * 발송결과 상태 - resultCode 로 전송 + */ + @JsonProperty("resultCode") + private String sndngResultSttus; + } } diff --git a/mens-api/src/main/java/kr/xit/biz/sisul/service/BizSisulService.java b/mens-api/src/main/java/kr/xit/biz/sisul/service/BizSisulService.java index c7b3a04..bc2aa8b 100644 --- a/mens-api/src/main/java/kr/xit/biz/sisul/service/BizSisulService.java +++ b/mens-api/src/main/java/kr/xit/biz/sisul/service/BizSisulService.java @@ -8,7 +8,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; -import javax.transaction.Transactional; import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.Validator; @@ -23,10 +22,14 @@ import kr.xit.biz.ens.model.nice.NiceCiDTO.IpinCiResDataBody; import kr.xit.biz.ens.model.nice.NiceCiDTO.IpinCiResEncData; import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiRequest; import kr.xit.biz.sisul.mapper.IBizSisulMapper; +import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulRequest; +import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulResDtlData; +import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulResMstData; import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.spring.util.ApiWebClientUtil; import kr.xit.core.support.utils.Checks; import kr.xit.core.support.xlsx.StreamingReader; +import kr.xit.ens.cmm.CmmEnsUtils; import kr.xit.ens.nice.cmm.CmmNiceCiUtils; import kr.xit.ens.nice.service.INiceCiService; import lombok.RequiredArgsConstructor; @@ -39,6 +42,7 @@ import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; /** @@ -98,6 +102,23 @@ public class BizSisulService extends EgovAbstractServiceImpl implements IBizSisu return makeCntc(rslts, fmcExcels, fileReq); } + @Override + @Transactional(readOnly = true) + public RsltSisulResMstData findSndngResultMaster(final RsltSisulRequest reqDTO) { + CmmEnsUtils.validate(reqDTO); + return mapper.selectSndngResultMaster(reqDTO) + .orElseThrow(() -> BizRuntimeException.create(String.format("[%s] 데이타를 찾을 수 없습니다", reqDTO.getUnitySndngMastrId()))); + } + + @Override + @Transactional(readOnly = true) + public List findSndngResultDetails(final RsltSisulRequest reqDTO) { + CmmEnsUtils.validate(reqDTO); + List resList = mapper.selectSndngResultDetails(reqDTO); + if(resList.isEmpty()) throw BizRuntimeException.create(String.format("[%s] 데이타를 찾을 수 없습니다", reqDTO.getUnitySndngMastrId())); + return mapper.selectSndngResultDetails(reqDTO); + } + private List parsingFmcExcel(MultipartFile mf) { final List fmcExcels = new ArrayList<>(); diff --git a/mens-api/src/main/java/kr/xit/biz/sisul/service/IBizSisulService.java b/mens-api/src/main/java/kr/xit/biz/sisul/service/IBizSisulService.java index 01abbdb..fb3c363 100644 --- a/mens-api/src/main/java/kr/xit/biz/sisul/service/IBizSisulService.java +++ b/mens-api/src/main/java/kr/xit/biz/sisul/service/IBizSisulService.java @@ -1,6 +1,10 @@ package kr.xit.biz.sisul.service; +import java.util.List; import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO.FmcExcelUpload; +import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulRequest; +import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulResDtlData; +import kr.xit.biz.sisul.model.SisulSndngResultDTO.RsltSisulResMstData; /** *
@@ -19,5 +23,8 @@ import kr.xit.biz.ens.model.cmm.CmmEnsFileInfDTO.FmcExcelUpload;
  */
 public interface IBizSisulService {
 
-    String fmcExcelUpload(FmcExcelUpload fileReq);
+    String fmcExcelUpload(final FmcExcelUpload fileReq);
+
+    RsltSisulResMstData findSndngResultMaster(final RsltSisulRequest dto);
+    List findSndngResultDetails(final RsltSisulRequest dto);
 }
diff --git a/mens-api/src/main/java/kr/xit/biz/sisul/web/BizSisulController.java b/mens-api/src/main/java/kr/xit/biz/sisul/web/BizSisulController.java
index a86532a..ae057af 100644
--- a/mens-api/src/main/java/kr/xit/biz/sisul/web/BizSisulController.java
+++ b/mens-api/src/main/java/kr/xit/biz/sisul/web/BizSisulController.java
@@ -55,13 +55,12 @@ public class BizSisulController {
     @Operation(summary = "발송결과정보 마스터 조회 - 시설공단 내부시스템에서 호출", description = "발송결과정보 마스터 조회 - 시설공단 내부시스템에서 호출")
     @PostMapping(value = "/sndng/result/master", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
     public IApiResponse findSndngResultMaster(@RequestBody RsltSisulRequest reqDTO) {
-
-        return ApiResponseDTO.success();
+        return ApiResponseDTO.success(service.findSndngResultMaster(reqDTO));
     }
 
     @Operation(summary = "발송결과정보 상세 조회 - 시설공단 내부시스템에서 호출", description = "발송결과정보 상세 조회 - 시설공단 내부시스템에서 호출")
     @PostMapping(value = "/sndng/result/details", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
     public IApiResponse findSndngResultDetails(@RequestBody RsltSisulRequest reqDTO) {
-        return ApiResponseDTO.success();
+        return ApiResponseDTO.success(service.findSndngResultDetails(reqDTO));
     }
 }
diff --git a/mens-api/src/main/resources/egovframework/mapper/biz/ens-sisul-mysql-mapper.xml b/mens-api/src/main/resources/egovframework/mapper/biz/ens-sisul-mysql-mapper.xml
index 233c4b8..6dfbdef 100644
--- a/mens-api/src/main/resources/egovframework/mapper/biz/ens-sisul-mysql-mapper.xml
+++ b/mens-api/src/main/resources/egovframework/mapper/biz/ens-sisul-mysql-mapper.xml
@@ -120,31 +120,38 @@
     
 
 
-  
     /** ens-sysul-mysql-mapper|selectSndngResultMaster-발송결과정보 마스터 조회|julim  */
-    SELECT tesn.unity_sndng_mastr_id
-         , tesn.sndng_se_code
-         , tesn.tmplat_id
-         , tesn.sndng_co
-         , tesn.sndng_process_sttus
-         , tcsr.requst_dt
+    SELECT tesn.unity_sndng_mastr_id    /* 통합발송마스터 ID - 파일유일키 */
+         , tesn.sndng_se_code           /* 발송구분코드 */
+         , tesn.tmplat_id               /* 템플릿 ID */
+         , tesn.sndng_dt                /* 발송일시 */
+         , tesn.sndng_co                /* 발송건수 */
+         , tesn.sndng_process_sttus     /* 발송처리 상태 */
+      FROM tb_ens_sndng_mastr tesn
+     WHERE tesn.unity_sndng_mastr_id = #{unitySndngMastrId}
+  
+
+  
-
-