From 4222759c51d42c090da823494bf8e7a80393e6b8 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Sun, 5 Nov 2023 16:24:47 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Post=20plus=20=EC=A2=85=EC=A0=81=20?= =?UTF-8?q?=EC=B6=94=EC=A0=81=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/biz/ens/mapper/IEnsBatchMapper.java | 2 ++ .../ens/service/EnsBatchStatusService.java | 21 +++++++++++++++---- .../mapper/biz/ens-mysql-mapper.xml | 11 ++++++++++ .../kr/xit/biz/ens/model/epost/EPostDTO.java | 12 +++++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/mapper/IEnsBatchMapper.java b/mens-batch/src/main/java/kr/xit/biz/ens/mapper/IEnsBatchMapper.java index bca0d49..f34040b 100644 --- a/mens-batch/src/main/java/kr/xit/biz/ens/mapper/IEnsBatchMapper.java +++ b/mens-batch/src/main/java/kr/xit/biz/ens/mapper/IEnsBatchMapper.java @@ -7,6 +7,7 @@ import kr.xit.biz.ens.model.EnsKtBcDTO; import kr.xit.biz.ens.model.cmm.SndngMssageParam; import kr.xit.biz.ens.model.cmm.TmplatManage; import kr.xit.biz.ens.model.cntc.CntcDTO; +import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceResTrackInfo; import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkStatus; import kr.xit.biz.ens.model.kakao.KkopayDocDTO.OneTimeToken; import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendReqData; @@ -364,6 +365,7 @@ public interface IEnsBatchMapper { int selectCountRgistNo(final String rgistNo); int updatePplusRgistNo(final PpStatusResMapping dto); List selectPplusRgistNos(final String unitySndngMastrId); + int updatePplusDlvrStatusFromEPostByRgistNo(final EpostTraceResTrackInfo dto); //---------------------------------------------------------------------- // status //---------------------------------------------------------------------- diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchStatusService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchStatusService.java index bc71347..7f37fce 100644 --- a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchStatusService.java +++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchStatusService.java @@ -13,6 +13,7 @@ import kr.xit.biz.ens.model.EnsDTO; import kr.xit.biz.ens.model.cmm.SndngMssageParam; import kr.xit.biz.ens.model.cntc.CntcDTO; import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceRequest; +import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceResTrackInfo; import kr.xit.biz.ens.model.epost.EPostDTO.EpostTraceResponse; import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkStatusRequests; import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkStatusResponses; @@ -247,10 +248,6 @@ public class EnsBatchStatusService extends EgovAbstractServiceImpl implements IE } } - - - - }else{ extractService.updatePplusSndngMstFailStatus(unitySndngMstId, "send-fail", resDTO.get결과(), resDTO.get비고(), "[send] Post Plus 발송(Accept)요청 실패"); } @@ -312,6 +309,22 @@ public class EnsBatchStatusService extends EgovAbstractServiceImpl implements IE EpostTraceResponse.class); //final String unitySndngMstId = resDTO.get연계식별키(); System.out.println(""+resDTO); + + try{ + assert resDTO != null; + EpostTraceResTrackInfo traceDTO = resDTO.result(); + mapper.updatePplusDlvrStatusFromEPostByRgistNo(traceDTO); + + }catch (BizRuntimeException e){ + //TODO :: error 처리 확인 필요 + mapper.updatePplusDlvrStatusFromEPostByRgistNo( + EpostTraceResTrackInfo.builder() + .regiNo(rgistNo) + .trackState(e.getMessage()) + .build() + ); + } + } }); } diff --git a/mens-batch/src/main/resources/egovframework/mapper/biz/ens-mysql-mapper.xml b/mens-batch/src/main/resources/egovframework/mapper/biz/ens-mysql-mapper.xml index c232753..e0507cd 100644 --- a/mens-batch/src/main/resources/egovframework/mapper/biz/ens-mysql-mapper.xml +++ b/mens-batch/src/main/resources/egovframework/mapper/biz/ens-mysql-mapper.xml @@ -954,6 +954,17 @@ ON tesm.sndng_mastr_id = tepp.sndng_mastr_id WHERE tesm.unity_sndng_mastr_id = #{unitySndngMastrId} + + + /** ens-mysql-mapper|updatePplusDlvrStatusFromEPostByRgistNo-Post plus 우체국 종적 추적을 통한 배송상태 변경|julim */ + UPDATE tb_ens_post_plus + SET dlvr_sttus = SUBSTR(#{trackStatus}, 1, 20) + , dlvr_de = REPLACE(#{receiveDate}, "-", "") + , receive_name = #{receiveName} + , updt_dt = now() + , updusr = 'batch' + WHERE rgist_no = #{regiNo} + diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/epost/EPostDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/epost/EPostDTO.java index b61d1e3..6596fad 100644 --- a/mens-core/src/main/java/kr/xit/biz/ens/model/epost/EPostDTO.java +++ b/mens-core/src/main/java/kr/xit/biz/ens/model/epost/EPostDTO.java @@ -10,14 +10,17 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO; +import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.model.IApiResponse; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.experimental.SuperBuilder; +import org.apache.commons.lang3.ObjectUtils; /** *
@@ -82,6 +85,7 @@ public class EPostDTO {
     @Setter
     @XmlAccessorType(XmlAccessType.FIELD)
     @XmlRootElement(name = "response")
+    @Builder
     public static class EpostTraceResponse implements IApiResponse {
 
         @Schema(requiredMode = RequiredMode.REQUIRED)
@@ -91,6 +95,13 @@ public class EPostDTO {
         @Schema(requiredMode = RequiredMode.REQUIRED)
         @XmlElement(name = "trackInfo")
         private EpostTraceResTrackInfo trackInfo;
+
+        public EpostTraceResTrackInfo result(){
+            if("N".equals(this.header.successYN)){
+                throw BizRuntimeException.create(this.header.errorMessage);
+            }
+            return this.trackInfo;
+        }
     }
 
     /**
@@ -149,6 +160,7 @@ public class EPostDTO {
     @Setter
     @XmlAccessorType(XmlAccessType.FIELD)
     @XmlRootElement(name = "trackInfo")
+    @Builder
     public static class EpostTraceResTrackInfo {
 
         /**