From 861e49e7b80e92b84f5beaebad771d119b726ce7 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Fri, 9 Aug 2024 19:52:06 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A7=88=EC=8A=A4=ED=84=B0=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EC=83=81=ED=83=9C=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EB=B0=98=EC=98=81=20=20=20=20=20=20-=20=EC=B6=98=EC=B2=9C=20?= =?UTF-8?q?=EC=A0=84=EC=9E=90=EA=B3=A0=EC=A7=80=EC=9D=B8=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EC=B6=98=EC=B2=9C=20=EC=83=81=ED=83=9C=EA=B0=92?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/ens/service/EnsBatchCloseService.java | 16 ++++++++++++--- .../ens/service/EnsBatchExtractService.java | 20 +++++++++++++++++++ .../biz/ens/service/EnsBatchMakeService.java | 12 +++++++++-- .../xit/biz/ens/web/EnsBatchController.java | 4 ++-- 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchCloseService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchCloseService.java index 3bc598e..4b599f0 100644 --- a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchCloseService.java +++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchCloseService.java @@ -1,6 +1,11 @@ package kr.xit.biz.ens.service; import java.util.List; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + import kr.xit.biz.common.ApiConstants; import kr.xit.biz.ens.mapper.IEnsBatchMapper; import kr.xit.biz.ens.model.EnsDTO; @@ -8,9 +13,6 @@ import kr.xit.biz.ens.model.cmm.SndngMssageParam; import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.service.AbstractService; import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; /** *
@@ -33,6 +35,11 @@ import org.springframework.transaction.annotation.Transactional;
 public class EnsBatchCloseService extends AbstractService implements IEnsBatchCloseService {
     private final IEnsBatchMapper mapper;
 
+    /**
+     * 춘천 시스템 여부
+     */
+    private static final boolean IS_CCN = ApiConstants.PROFILE.matches(".*-ccn");
+
     /**
      * send-ok 값에 따라 close
      *
@@ -51,9 +58,12 @@ public class EnsBatchCloseService extends AbstractService implements IEnsBatchCl
                 .newSndngProcessSttus(ApiConstants.SndngProcessStatus.CLOSE.getCode())
                 .build();
 
+            if(IS_CCN)  paramDTO.setNewSndngProcessSttus(ApiConstants.MappingSndngProcessStatus.fromEns(paramDTO.getNewSndngProcessSttus()));
             if (mapper.updateProcessSttusCntcSndngMst(paramDTO) != 1) {
                 throw BizRuntimeException.create("[close]연계 발송 마스터 상태변경 실패");
             }
+
+            paramDTO.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.CLOSE.getCode());
             if (mapper.updateProcessSttusUnitySndngMst(paramDTO) != 1) {
                 throw BizRuntimeException.create("[close]통합 발송 마스터 상태변경 실패");
             }
diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchExtractService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchExtractService.java
index b00462d..c9f4c26 100644
--- a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchExtractService.java
+++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchExtractService.java
@@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
 import kr.xit.biz.common.ApiConstants;
+import kr.xit.biz.common.ApiConstants.MappingSndngProcessStatus;
 import kr.xit.biz.common.ApiConstants.SndngSeCode;
 import kr.xit.biz.ens.mapper.IEnsBatchMapper;
 import kr.xit.biz.ens.model.EnsDTO;
@@ -53,6 +54,11 @@ public class EnsBatchExtractService extends AbstractService implements
 
     private final IEnsBatchMapper mapper;
 
+    /**
+     * 춘천 시스템 여부
+     */
+    private static final boolean IS_CCN = ApiConstants.PROFILE.matches(".*-ccn");
+
     //-----------------------------------------------------------------------------------------------------------------
     // REQUIRES_NEW service method
     //-----------------------------------------------------------------------------------------------------------------
@@ -174,13 +180,22 @@ public class EnsBatchExtractService extends AbstractService implements
      */
     @Transactional
     public void updateErrorLog(final SndngMssageParam dto) {
+        final String status = dto.getNewSndngProcessSttus();
+
         if ("SndngAcceptJob".equals(dto.getErrorCode())) {
+            if(IS_CCN)  dto.setNewSndngProcessSttus(MappingSndngProcessStatus.fromEns(status));
             mapper.updateProcessSttusCntcSndngMst(dto);
+
         } else if ("SndngMakeJob".equals(dto.getErrorCode())) {
+            if(IS_CCN)  dto.setNewSndngProcessSttus(MappingSndngProcessStatus.fromEns(status));
             mapper.updateProcessSttusCntcSndngMst(dto);
+            dto.setNewSndngProcessSttus(status);
             mapper.updateProcessSttusUnitySndngMst(dto);
+
         } else if ("SndngSendBulksJob".equals(dto.getErrorCode())) {
+            if(IS_CCN)  dto.setNewSndngProcessSttus(MappingSndngProcessStatus.fromEns(status));
             mapper.updateProcessSttusCntcSndngMst(dto);
+            dto.setNewSndngProcessSttus(status);
             mapper.updateProcessSttusUnitySndngMst(dto);
             mapper.updateProcessSttusSndngMst(dto);
         }
@@ -210,9 +225,14 @@ public class EnsBatchExtractService extends AbstractService implements
     }
 
     private void updateMstTable(SndngMssageParam paramDTO, SndngSeCode seCode) {
+        final String status = paramDTO.getNewSndngProcessSttus();
+
+        if(IS_CCN)  paramDTO.setNewSndngProcessSttus(MappingSndngProcessStatus.fromEns(status));
         if(mapper.updateProcessSttusCntcSndngMst(paramDTO) != 1) {
             throw BizRuntimeException.create(String.format("[send-%s]연계 발송 마스터 상태변경 실패", seCode.getCode()));
         }
+
+        paramDTO.setNewSndngProcessSttus(status);
         if(mapper.updateProcessSttusUnitySndngMst(paramDTO) != 1) {
             throw BizRuntimeException.create(String.format("[send-%s]통합 발송 마스터 상태변경 실패", seCode.getCode()));
         }
diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchMakeService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchMakeService.java
index 32b66b9..284ec5d 100644
--- a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchMakeService.java
+++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchMakeService.java
@@ -48,6 +48,11 @@ public class EnsBatchMakeService extends AbstractService implements IEnsBatchMak
     private static final String SNDNG_PROCESS_STTUS = "sndngProcessSttus";
     private static final String UNITY_SNDNG_MST_ID = "unitySndngMastrId";
 
+    /**
+     * 춘천 시스템 여부
+     */
+    private static final boolean IS_CCN = ApiConstants.PROFILE.matches(".*-ccn");
+
     private final IEnsBatchMapper mapper;
 
     /**
@@ -100,11 +105,12 @@ public class EnsBatchMakeService extends AbstractService implements IEnsBatchMak
 
         //없으면 연계 발송 마스터, 통합 발송 마스터 send-ok
         if (sendCnt == 0) {
-            dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.SEND_OK.getCode());
-
+            if(IS_CCN)  dto.setNewSndngProcessSttus(ApiConstants.MappingSndngProcessStatus.fromEns(dto.getNewSndngProcessSttus()));
             if (mapper.updateProcessSttusCntcSndngMst(dto) != 1) {
                 throw BizRuntimeException.create("[make]연계 발송 마스터 상태변경 실패");
             }
+
+            dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.SEND_OK.getCode());
             if (mapper.updateProcessSttusUnitySndngMst(dto) != 1) {
                 throw BizRuntimeException.create("[make]통합 발송 마스터 상태변경 실패");
             }
@@ -153,9 +159,11 @@ public class EnsBatchMakeService extends AbstractService implements IEnsBatchMak
         }
 
         // 3. status
+        if(IS_CCN)  dto.setNewSndngProcessSttus(ApiConstants.MappingSndngProcessStatus.fromEns(dto.getNewSndngProcessSttus()));
         if (mapper.updateProcessSttusCntcSndngMst(dto) != 1) {
             throw BizRuntimeException.create("[make]데이타 생성(발송마스터 상태변경) 실패");
         }
+        dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.MAKE_OK.getCode());
         if (mapper.updateProcessSttusUnitySndngMst(dto) != 1) {
             throw BizRuntimeException.create("[make]데이타 생성(통합발송마스터 상태변경) 실패");
         }
diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/web/EnsBatchController.java b/mens-batch/src/main/java/kr/xit/biz/ens/web/EnsBatchController.java
index d17262e..108d95b 100644
--- a/mens-batch/src/main/java/kr/xit/biz/ens/web/EnsBatchController.java
+++ b/mens-batch/src/main/java/kr/xit/biz/ens/web/EnsBatchController.java
@@ -66,7 +66,7 @@ public class EnsBatchController {
             @Content(mediaType = "application/json", examples = {
                     @ExampleObject(value = """
                         {
-                            "signguCode": "88328",
+                            "signguCode": "51110",
                             "ffnlgCode": "11",
                             "sndngProcessSttus": "send-ok"
                         }
@@ -85,7 +85,7 @@ public class EnsBatchController {
         @Content(mediaType = "application/json", examples = {
             @ExampleObject(value = """
                 {
-                    "signguCode": "88328",
+                    "signguCode": "51110",
                     "ffnlgCode": "11",
                     "sndngProcessSttus": "send-ok"
                 }