From 627e4d70bbfc49fb5d9cbca93721892df11c161f Mon Sep 17 00:00:00 2001 From: limju Date: Wed, 25 Oct 2023 16:20:53 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20date=20format=20ApiConstants=20=EC=83=81?= =?UTF-8?q?=EC=88=98=EB=A1=9C=20=EC=B2=98=EB=A6=AC=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/service/EnsBatchService.java | 2 +- .../com/cmm/util/EgovDateUtil.java | 11 +++---- .../java/kr/xit/biz/common/ApiConstants.java | 10 ++++++ .../kr/xit/biz/ens/model/kt/KtMmsSendDTO.java | 15 ++++++--- .../config/custom/bouncy/BouncyUtils.java | 33 +++++++++++-------- 5 files changed, 47 insertions(+), 24 deletions(-) diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java index 1b517a0..578ecc4 100644 --- a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java +++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java @@ -92,7 +92,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc private static final String SNDNG_PROCESS_STTUS = "sndngProcessSttus"; private static final String UNITY_SNDNG_MST_ID = "unitySndngMastrId"; - private static final String YMDHMS = "yyyyMMddHHmmss"; + private static final String YMDHMS = ApiConstants.FMT_DT_EMPTY_DLT; /** *
diff --git a/mens-core/src/main/java/egovframework/com/cmm/util/EgovDateUtil.java b/mens-core/src/main/java/egovframework/com/cmm/util/EgovDateUtil.java
index f87fbe3..60edb39 100644
--- a/mens-core/src/main/java/egovframework/com/cmm/util/EgovDateUtil.java
+++ b/mens-core/src/main/java/egovframework/com/cmm/util/EgovDateUtil.java
@@ -1,5 +1,6 @@
 package egovframework.com.cmm.util;
 
+import com.ibm.icu.util.ChineseCalendar;
 import java.security.SecureRandom;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -10,15 +11,13 @@ import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
-
+import kr.xit.biz.common.ApiConstants;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.ibm.icu.util.ChineseCalendar;
-
 /**
  *
  * Date 에 대한 Util 클래스
@@ -96,7 +95,7 @@ public class EgovDateUtil {
 		String dateStr = validChkDateHMS(sDate);
 
 		Calendar cal = Calendar.getInstance();
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault());
+		SimpleDateFormat sdf = new SimpleDateFormat(ApiConstants.FMT_DT_EMPTY_DLT, Locale.getDefault());
 		try {
 			cal.setTime(sdf.parse(dateStr));
 		} catch (ParseException e) {
@@ -316,9 +315,9 @@ public class EgovDateUtil {
 			return "";
 		}
 		if (EgovStringUtil.isNullToString(fromDateFormat).trim().equals(""))
-			_fromDateFormat = "yyyyMMddHHmmss"; // default값
+			_fromDateFormat = ApiConstants.FMT_DT_EMPTY_DLT; // default값
 		if (EgovStringUtil.isNullToString(toDateFormat).trim().equals(""))
-			_toDateFormat = "yyyy-MM-dd HH:mm:ss"; // default값
+			_toDateFormat = ApiConstants.FMT_DT_STD; // default값
 
 		try {
 			simpledateformat = new SimpleDateFormat(_fromDateFormat, Locale.getDefault());
diff --git a/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java b/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java
index 3476e66..2e89f6f 100644
--- a/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java
+++ b/mens-core/src/main/java/kr/xit/biz/common/ApiConstants.java
@@ -24,6 +24,16 @@ public class ApiConstants {
     public static final String PROFILE = System.getProperty("spring.profiles.active");
     public static final String FFNLN_CODE = "11";
 
+    /**
+     * 구분자 없는 date-time 포맷
+     */
+    public static final String FMT_DT_EMPTY_DLT = ApiConstants.FMT_DT_EMPTY_DLT;
+
+    /**
+     * date-time 표준 포맷
+     */
+    public static final String FMT_DT_STD = ApiConstants.FMT_DT_STD;
+
     /**
      * 
      * 문서 조회 버튼의 명칭을 구분하기 위한 값
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 1494ae7..bedbbbe 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
@@ -11,7 +11,6 @@ import javax.validation.Valid;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.Size;
 import kr.xit.biz.ens.model.kt.KtCommonDTO.KtCommonResponse;
-import kr.xit.core.support.utils.DateUtils;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -912,10 +911,11 @@ public class KtMmsSendDTO {
          */
         @Schema(requiredMode = RequiredMode.REQUIRED, title = "모바일사업자구분", example = "01")
         @Size(min = 2, max = 2, message = "모바일 사업자 구분은 필수 입니다(01|02|03)")
-        private final String mblBzowrDvcd = "01";
+        private String mblBzowrDvcd;
 
         /**
          * 
+         * TODO::결과코드에 따른 메세지 처리 필요
          * 발송결과코드 : 필수 - 2자리
          * 40	MMS/RCS 발송	수신성공
          * 41	MMS발송	메시지 내용 스팸
@@ -951,7 +951,7 @@ public class KtMmsSendDTO {
          */
         @Schema(requiredMode = RequiredMode.REQUIRED, title = "발송타임스탬프", example = "20241030121000")
         @Size(min = 14, max = 14, message = "발송타임스탬프는 필수 입니다(YYYYMMDDHHMISS)")
-        private final String mmsSndgTmst = DateUtils.getTodayAndNowTime("yyyyMMddHHmmss");
+        private String mmsSndgTmst;
 
         /**
          * 
@@ -961,7 +961,7 @@ public class KtMmsSendDTO {
          */
         @Schema(requiredMode = RequiredMode.REQUIRED, title = "발송 메시지 타입", example = "2")
         @Size(min = 1, max = 1, message = "발송 메시지 타입은 필수 입니다")
-        private final String msgType = "2";
+        private String msgType;
         //-------------------------------------------------------------------
 
         /**
@@ -1057,6 +1057,13 @@ public class KtMmsSendDTO {
         @Schema(requiredMode = RequiredMode.AUTO, title = "RCS 발송 여부", example = "N")
         @Size(max = 1, message = "RCS 발송 여부는 1자리 입니다(Y|N)")
         private String rcyYn;
+
+        /**
+         * API 정의서에 없는 필드 : 업무 편의를 위해 추가
+         */
+        @Schema(requiredMode = RequiredMode.AUTO, title = "발송결과코드메세지", example = "MMS/RCS 발송 수신성공")
+        @Size(max = 100, message = "발송결과코드메세지는 100자를 넘을 수 없습니다")
+        private String mmsSndgRsltDvcdMsg;
     }
     //-------------------------------------------------------------------
 }
diff --git a/mens-core/src/main/java/kr/xit/core/spring/config/custom/bouncy/BouncyUtils.java b/mens-core/src/main/java/kr/xit/core/spring/config/custom/bouncy/BouncyUtils.java
index 8813bf3..e3c1a48 100644
--- a/mens-core/src/main/java/kr/xit/core/spring/config/custom/bouncy/BouncyUtils.java
+++ b/mens-core/src/main/java/kr/xit/core/spring/config/custom/bouncy/BouncyUtils.java
@@ -1,5 +1,24 @@
 package kr.xit.core.spring.config.custom.bouncy;
 
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.InvalidParameterException;
+import java.security.Key;
+import java.security.KeyFactory;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Base64;
+import javax.crypto.Cipher;
+import kr.xit.biz.common.ApiConstants;
 import kr.xit.core.exception.BizRuntimeException;
 import kr.xit.core.support.utils.DateUtils;
 import kr.xit.core.support.utils.FileUtil;
@@ -12,18 +31,6 @@ import org.bouncycastle.util.io.pem.PemObject;
 import org.bouncycastle.util.io.pem.PemReader;
 import xit.core.init.custom.bouncy.BouncyDecUtils;
 
-import javax.crypto.Cipher;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.security.*;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.Base64;
-
 /**
  * 
  * description : DSA 파일 생성 / 암/복호화 Utils
@@ -288,7 +295,7 @@ public class BouncyUtils {
         //BouncyFileHelper.decryptionFile(key, path);
 
 
-        long expiredDate = DateUtils.parseStringToLong("20991231135959", "yyyyMMddHHmmss");
+        long expiredDate = DateUtils.parseStringToLong("20991231135959", ApiConstants.FMT_DT_EMPTY_DLT);
         String ip = "211.119.124.9";// IpMacUtils.getIpAddress();
         //String ip = "211.119.124.73";// local ip
         long curDate = DateUtils.getLongTodayAndNowTime();