feat: NICE CI 전문 추가

dev
Jonguk. Lim 2 months ago
parent e1e79afcf9
commit 15d02657ce

@ -15,6 +15,7 @@ import lombok.extern.slf4j.*;
@Slf4j
public class DateUtil {
private static final String DEFAULT_YMD_DT_FMT ="yyyy-MM-dd HH:mm:ss";
/**
* <pre> : (: milliesecond) .</pre>
@ -415,7 +416,7 @@ public class DateUtil {
*/
public static String getTimeOfTimeT(String timeT, String fmt) {
return LocalDateTime.parse(timeT, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"))
.format(DateTimeFormatter.ofPattern(StringUtils.isEmpty(fmt)? "yyyy-MM-dd HH:mm:ss": fmt));
.format(DateTimeFormatter.ofPattern(StringUtils.isEmpty(fmt)? DEFAULT_YMD_DT_FMT: fmt));
}
/**
@ -428,4 +429,34 @@ public class DateUtil {
return LocalDateTime.parse(time, DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"));
}
/**
* : --
*
* @param userFormat
* @return String
*/
public static String getTodayAndNowTime(final String userFormat) {
String pattern = "";
try {
pattern = DEFAULT_YMD_DT_FMT;
if (!org.apache.commons.lang3.StringUtils.isEmpty(userFormat)) {
pattern = userFormat;
}
} catch (Exception e) {
log.error("DateUtils::getTodayAndNowTime", e);
}
return localDateTime().format(DateTimeFormatter.ofPattern(pattern));
}
/**
* LocalDateTime
*
* @return LocalDateTime
*/
public static LocalDateTime localDateTime() {
return LocalDateTime.now();
}
}

@ -0,0 +1,986 @@
package cokr.xit.ens.modules.nice.model;
import java.io.*;
import java.util.*;
import java.util.stream.*;
import javax.validation.*;
import javax.validation.constraints.*;
import org.apache.commons.lang3.*;
import cokr.xit.ens.core.utils.*;
import io.swagger.v3.oas.annotations.media.*;
import lombok.*;
/**
* <pre>
* description :
* packageName : cokr.xit.ens.modules.nice.model
* fileName : NiceDTO
* author : limju
* date : 2024 9 23
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024 9 23 limju
*
* </pre>
*/
public class NiceDTO {
@Schema(name = "NiceRequest", description = "NICE CI 전문 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class NiceRequest implements Serializable {
private static final long serialVersionUID = 1L;
//----------------------------------------------------------------------------------------------
// TR-CODE : 0 ~ 9 자리
//----------------------------------------------------------------------------------------------
/**
* <pre>
* TR-CODE
* - max: 9
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "TR Code", example = " ")
@Size(min = 0, max = 9, message = "트랜잭션 코드는 0~9자리 입니다.")
@Builder.Default
private String trCode = StringUtils.rightPad(StringUtils.EMPTY, 9, StringUtils.SPACE);
public void setTrCode(String trCode) {
this.trCode = StringUtils.rightPad(nvl(trCode), 9, StringUtils.SPACE);
}
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
// 공통부 : 100 자리
//----------------------------------------------------------------------------------------------
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
@Valid
NiceCommon niceCommon;
/**
* <pre>
* - 16
* </pre>
*/
@Schema(title = "공란", example = " ")
@Size(min = 16, max = 16, message = "공란(16자리)")
@Builder.Default
private String commonEmptyField = StringUtils.rightPad(StringUtils.EMPTY, 16, StringUtils.SPACE);
/**
* <pre>
*
* </pre>
*/
@Schema(title = "조회동의사유", example = " ")
@Size(min = 1, max = 1, message = "조회동의사유는 1자리 입니다")
@Builder.Default
private String queryConsentReason = StringUtils.SPACE;
//----------------------------------------------------------------------------------------------
// 공통부 : 100 자리
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
// 개별요청부 : 3000 자리
//----------------------------------------------------------------------------------------------
/**
* <pre>
* : 2
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "조회사유", example = " ")
@Size(min = 2, max = 2, message = "조회사유는 2자리 입니다")
@Builder.Default
private String queryReason = StringUtils.rightPad(StringUtils.EMPTY, 2, StringUtils.SPACE);
public void setQueryReason(String queryReason) {
this.queryReason = StringUtils.rightPad(nvl(queryReason), 1, StringUtils.SPACE);
}
/**
* <pre>
* : 2
* 48
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "조회요청건수", example = " ")
@Max(value = 48, message = "조회요청 최대건수는 48입니다")
@Builder.Default
private String queryReqCnt = StringUtils.rightPad(StringUtils.EMPTY, 2, StringUtils.SPACE);
public void setQueryReqCnt(Integer queryReqCnt) {
this.queryReqCnt = StringUtils.rightPad(nvl(queryReqCnt == null? "": queryReqCnt.toString()), 1, StringUtils.SPACE);
}
/**
* <pre>
* SMS: 1
* 1 ~ 3
* 0 : ,
* 1: 1 ,
* 2: 1 ~ 2 1
* 3: 1 ~ 3 1
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "SMS발송요청구분코드", example = " ", allowableValues = {"0", "1", "2", "3"})
@Pattern(regexp = "[0-3]", message = "SMS발송요청구분코드 0 ~ 3 입니다(1자리)")
@Builder.Default
private String smsSndReqCode = StringUtils.SPACE;;
/**
* <pre>
* : 10 ~ 2000
* (smsSndReqCode) 1, 2, 3
* </pre>
*/
@Schema(title = "SMS 발송메세지", example = " ")
@Pattern(regexp = "^$|[\\s]{10,2000}", message = "SMS발송메세지는 10 ~ 2000자리 입니다")
@Builder.Default
private String sndMessage = StringUtils.rightPad(StringUtils.EMPTY, 2000, StringUtils.SPACE);
public void setSndMessage(String sndMessage) {
this.sndMessage = StringUtils.rightPad(nvl(sndMessage), 2000, StringUtils.SPACE);
}
/**
* <pre>
* : 12
* (smsSndReqCode) 1, 2, 3
* </pre>
*/
@Schema(title = "SMS 발신번호", example = " ")
@Pattern(regexp = "^$|[\\d]{3,12}", message = "SMS 발신번호는 3 ~ 12자리 입니다")
@Builder.Default
private String sndPhoneNo = StringUtils.rightPad(StringUtils.EMPTY, 12, StringUtils.SPACE);
public void setSndPhoneNo(String sndPhoneNo) {
this.sndPhoneNo = StringUtils.rightPad(nvl(sndPhoneNo), 12, StringUtils.SPACE);
}
/**
* <pre>
* : 1
* default: 3
* 1: 1 ,
* 2: 2
* 3: 3
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "연락처조회구분코드", example = " ", allowableValues = {"1", "2", "3"})
@Pattern(regexp = "[1-3]", message = "연락처조회구분 코드는 1 ~ 3 입니다(1자리)")
@Builder.Default
private String contactSearchCode = "3";
/**
* <pre>
* : 1
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "알림톡발송요청구분", example = " ")
@Size(min = 1, max = 1, message = "알림톡발송요청구분 코드는 1자리 입니다")
@Builder.Default
private String alimtalkSndReqDiv = StringUtils.SPACE;
/**
* <pre>
* 릿: 100
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "알림톡발송요청구분", example = " ")
@Size(min = 100, max = 100, message = "알림톡발송요청구분 코드는 1자리 입니다")
@Builder.Default
private String alimtalkTmpltCode = StringUtils.rightPad(StringUtils.EMPTY, 100, StringUtils.SPACE);
public void setAlimtalkTmpltCode(String alimtalkTmpltCode) {
this.alimtalkTmpltCode = StringUtils.rightPad(nvl(alimtalkTmpltCode), 100, StringUtils.SPACE);
}
/**
* <pre>
* : 1
* 5
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "조회요청건수", example = " ")
@Max(value = 5, message = "조회요청 최대건수는 48입니다")
@Builder.Default
private String btnReqCnt = StringUtils.SPACE;
public void setBtnReqCnt(Integer btnReqCnt) {
this.btnReqCnt = StringUtils.rightPad(nvl(btnReqCnt == null ? "" : btnReqCnt.toString()), 1,
StringUtils.SPACE);
}
/**
* <pre>
* - 880
* </pre>
*/
@Schema(title = "공란", example = " ")
@Size(min = 880, max = 880, message = "공란(880자리)")
@Builder.Default
private String privateEmptyField = StringUtils.rightPad(StringUtils.EMPTY, 880, StringUtils.SPACE);
//----------------------------------------------------------------------------------------------
// 개별요청부 : 3000 자리
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
// 조회요청부 반복: 50 자리
//----------------------------------------------------------------------------------------------
List<QueryRequest> queryRequests = new ArrayList<>();
//----------------------------------------------------------------------------------------------
// 조회요청부 반복: 50 자리
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
// 버튼요청부 반복: 3000 자리
//----------------------------------------------------------------------------------------------
List<ButtonRequest> buttonRequests = new ArrayList<>();
//----------------------------------------------------------------------------------------------
// 버튼요청부 반복: 3000 자리
//----------------------------------------------------------------------------------------------
public String getAsString() {
StringBuilder sb = new StringBuilder();
sb.append(trCode);
// 공통부
sb.append(niceCommon.getAsString());
sb.append(commonEmptyField);
sb.append(queryConsentReason);
// 개별요청부
sb.append(queryReason);
sb.append(queryReqCnt);
sb.append(smsSndReqCode);
sb.append(sndMessage);
sb.append(sndPhoneNo);
sb.append(contactSearchCode);
sb.append(alimtalkSndReqDiv);
sb.append(alimtalkTmpltCode);
sb.append(btnReqCnt);
sb.append(privateEmptyField);
sb.append(queryRequests.stream().map(QueryRequest::getAsString).collect(Collectors.joining()));
sb.append(buttonRequests.stream().map(ButtonRequest::getAsString).collect(Collectors.joining()));
return sb.toString();
}
}
@Schema(name = "NiceResponse", description = "NICE CI 전문 응답 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class NiceResponse implements Serializable {
private static final long serialVersionUID = 1L;
//----------------------------------------------------------------------------------------------
// TR-CODE : 0 ~ 9 자리
//----------------------------------------------------------------------------------------------
/**
* <pre>
* TR-CODE
* - max: 9
* </pre>
*/
@Schema(title = "TR Code", example = " ")
@Size(min = 0, max = 9, message = "트랜잭션 코드는 0~9자리 입니다.")
@Builder.Default
private String trCode = StringUtils.rightPad(StringUtils.EMPTY, 9, StringUtils.SPACE);
public void setTrCode(String trCode) {
this.trCode = StringUtils.rightPad(nvl(trCode), 9, StringUtils.SPACE);
}
//----------------------------------------------------------------------------------------------
// 공통부 : 100 자리
//----------------------------------------------------------------------------------------------
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
@Valid
NiceCommon niceCommon;
/**
* <pre>
* - 16
* </pre>
*/
@Schema(title = "공란", example = " ")
@Size(min = 16, max = 17, message = "공란(17자리)")
@Builder.Default
private String commonEmptyField = StringUtils.rightPad(StringUtils.EMPTY, 17, StringUtils.SPACE);
//----------------------------------------------------------------------------------------------
// 공통부 : 100 자리
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
// 개별응답부 : 2100 자리
//----------------------------------------------------------------------------------------------
/**
* <pre>
* : 2
* 48
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "응답 건수", example = " ")
@Max(value = 48, message = "응답 최대건수는 48입니다")
@Builder.Default
private String resCnt = StringUtils.rightPad(StringUtils.EMPTY, 2, StringUtils.SPACE);
public void setResCnt(String resCnt) {
this.resCnt = StringUtils.rightPad(nvl(resCnt), 2, StringUtils.SPACE);
}
/**
* <pre>
* SMS: 1
* 1 ~ 3
* 0 : ,
* 1: 1 ,
* 2: 1 ~ 2 1
* 3: 1 ~ 3 1
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "SMS발송요청구분코드", example = " ", allowableValues = {"0", "1", "2", "3"})
@Pattern(regexp = "[0-3]", message = "SMS발송요청구분코드 0 ~ 3 입니다(1자리)")
@Builder.Default
private String smsSndReqCode = StringUtils.SPACE;;
/**
* <pre>
* : 10 ~ 2000
* (smsSndReqCode) 1, 2, 3
* </pre>
*/
@Schema(title = "SMS 발송메세지", example = " ")
@Pattern(regexp = "^$|[\\s]{10,2000}", message = "SMS발송메세지는 10 ~ 2000자리 입니다")
@Builder.Default
private String sndMessage = StringUtils.rightPad(StringUtils.EMPTY, 2000, StringUtils.SPACE);
public void setSndMessage(String sndMessage) {
this.sndMessage = StringUtils.rightPad(nvl(sndMessage), 2000, StringUtils.SPACE);
}
/**
* <pre>
* : 12
* (smsSndReqCode) 1, 2, 3
* </pre>
*/
@Schema(title = "SMS 발신번호", example = " ")
@Pattern(regexp = "^$|[\\d]{3,12}", message = "SMS 발신번호는 3 ~ 12자리 입니다")
@Builder.Default
private String sndPhoneNo = StringUtils.rightPad(StringUtils.EMPTY, 12, StringUtils.SPACE);
public void setSndPhoneNo(String sndPhoneNo) {
this.sndPhoneNo = StringUtils.rightPad(nvl(sndPhoneNo), 12, StringUtils.SPACE);
}
/**
* <pre>
* : 1
* default: 3
* 1: 1 ,
* 2: 2
* 3: 3
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "연락처조회구분코드", example = " ", allowableValues = {"1", "2", "3"})
@Pattern(regexp = "[1-3]", message = "연락처조회구분 코드는 1 ~ 3 입니다(1자리)")
@Builder.Default
private String contactSearchCode = "3";
/**
* <pre>
* - 84
* </pre>
*/
@Schema(title = "공란", example = " ")
@Size(min = 84, max = 84, message = "공란(84자리)")
@Builder.Default
private String privateEmptyField = StringUtils.rightPad(StringUtils.EMPTY, 84, StringUtils.SPACE);
//----------------------------------------------------------------------------------------------
// 개별응답부 : 2100 자리
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
// 응답반복부 : 110 자리
//----------------------------------------------------------------------------------------------
List<ResResult> resResults = new ArrayList<>();
//----------------------------------------------------------------------------------------------
// 응답반복부 : 110 자리
//----------------------------------------------------------------------------------------------
public String getAsString() {
StringBuilder sb = new StringBuilder();
sb.append(trCode);
sb.append(niceCommon.getAsString());
sb.append(commonEmptyField);
sb.append(resCnt);
sb.append(smsSndReqCode);
sb.append(sndMessage);
sb.append(sndPhoneNo);
sb.append(contactSearchCode);
sb.append(privateEmptyField);
sb.append(resResults.stream().map(ResResult::getAsString).collect(Collectors.joining()));
return sb.toString();
}
}
@Schema(name = "QueryRequest", description = "NICE CI 조회 요청 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class QueryRequest {
/**
* <pre>
* // - 1
* 1()
* </pre>
*/
@Schema(title = "개인/사업자/법인구분", example = "1")
@Size(min = 1, max = 1, message = "개인/사업자/법인구분은 1자리 입니다.")
@Builder.Default
private String idDiv = "1";
/**
* <pre>
* - 13
* </pre>
*/
@Schema(title = "주민번호", example = " ")
@Size(min = 13, max = 13, message = "주민번호는 13자리 입니다.")
@Builder.Default
private String jumin = StringUtils.rightPad(StringUtils.EMPTY, 13, StringUtils.SPACE);
public void setJumin(String jumin) {
this.jumin = StringUtils.rightPad(nvl(jumin), 13, StringUtils.SPACE);
}
/**
* <pre>
* - 880
* </pre>
*/
@Schema(title = "공란", example = " ")
@Size(min = 36, max = 36, message = "공란(36자리)")
@Builder.Default
private String emptyField = StringUtils.rightPad(StringUtils.EMPTY, 36, StringUtils.SPACE);
public String getAsString() {
StringBuilder sb = new StringBuilder();
sb.append(idDiv);
sb.append(jumin);
sb.append(emptyField);
return sb.toString();
}
}
@Schema(name = "ButtonRequest", description = "NICE CI 버튼 요청 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class ButtonRequest {
/**
* <pre>
* - 2
* WL|AL
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "버튼타입", example = " ", allowableValues = {"WL", "AL"})
@Pattern(regexp = "[WL|AL]", message = "버튼 타입은 2자리 입니다.")
@Builder.Default
private String btnType = "WL";
public void setBtnType(String btnType) {
this.btnType = StringUtils.rightPad(nvl(btnType), 2, StringUtils.SPACE);
}
/**
* <pre>
* - 56
* </pre>
*/
@Schema(title = "버튼이름", example = "1")
@Size(min = 56, max = 56, message = "버튼이름은 56자리 입니다.")
@Builder.Default
private String btnName = StringUtils.rightPad(StringUtils.EMPTY, 56, StringUtils.SPACE);
public void setBtnName(String jumin) {
this.btnName = StringUtils.rightPad(nvl(btnName), 56, StringUtils.SPACE);
}
/**
* <pre>
* URL1 - 1000
* (btnType) WL URL, AL Android scheme
* </pre>
*/
@Schema(title = "버튼URL웹링크1", example = " ")
@Size(min = 1000, max = 1000, message = "버튼URL웹링크1 은 1000자리 입니다.")
@Builder.Default
private String btnUrlWebLink1 = StringUtils.rightPad(StringUtils.EMPTY, 1000, StringUtils.SPACE);
public void setBtnUrlWebLink1(String btnUrlWebLink1) {
this.btnUrlWebLink1 = StringUtils.rightPad(nvl(btnUrlWebLink1), 1000, StringUtils.SPACE);
}
/**
* <pre>
* URL2 - 1000
* (btnType) WL PC URL, AL IOS scheme
* </pre>
*/
@Schema(title = "버튼URL웹링크2", example = " ")
@Size(min = 1000, max = 1000, message = "버튼URL웹링크2 은 1000자리 입니다.")
@Builder.Default
private String btnUrlWebLink2 = StringUtils.rightPad(StringUtils.EMPTY, 1000, StringUtils.SPACE);
public void setBtnUrlWebLink2(String btnUrlWebLink2) {
this.btnUrlWebLink2 = StringUtils.rightPad(nvl(btnUrlWebLink2), 1000, StringUtils.SPACE);
}
/**
* <pre>
* - 942
* </pre>
*/
@Schema(title = "공란", example = " ")
@Size(min = 942, max = 942, message = "공란(36자리)")
@Builder.Default
private String emptyField = StringUtils.rightPad(StringUtils.EMPTY, 942, StringUtils.SPACE);
public String getAsString() {
StringBuilder sb = new StringBuilder();
sb.append(btnType);
sb.append(btnName);
sb.append(btnUrlWebLink1);
sb.append(btnUrlWebLink2);
sb.append(emptyField);
return sb.toString();
}
}
@Schema(name = "ResResult", description = "NICE CI 조회 응답 결과 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class ResResult {
/**
* <pre>
* // - 1
* 1()
* </pre>
*/
@Schema(title = "개인/사업자/법인구분", example = "1")
@Size(min = 1, max = 1, message = "개인/사업자/법인구분은 1자리 입니다.")
@Builder.Default
private String idDiv = "1";
/**
* <pre>
* - 13
* </pre>
*/
@Schema(title = "주민번호", example = " ")
@Size(min = 13, max = 13, message = "주민번호는 13자리 입니다.")
@Builder.Default
private String jumin = StringUtils.rightPad(StringUtils.EMPTY, 13, StringUtils.SPACE);
public void setJumin(String jumin) {
this.jumin = StringUtils.rightPad(nvl(jumin), 13, StringUtils.SPACE);
}
/**
* <pre>
* - 20
* </pre>
*/
@Schema(title = "이름", example = " ")
@Size(min = 20, max = 20, message = "이름은 20자리 입니다.")
@Builder.Default
private String name = StringUtils.rightPad(StringUtils.EMPTY, 20, StringUtils.SPACE);
public void setName(String name) {
this.name = StringUtils.rightPad(nvl(name), 20, StringUtils.SPACE);
}
/**
* <pre>
* 1 - 11
* </pre>
*/
@Schema(title = "1순위연락처", example = " ")
@Size(min = 11, max = 11, message = "1순위연락처는 11자리 입니다.")
@Builder.Default
private String contractOf1st = StringUtils.rightPad(StringUtils.EMPTY, 11, StringUtils.SPACE);
public void setContractOf1st(String contractOf1st) {
this.contractOf1st = StringUtils.rightPad(nvl(contractOf1st), 11, StringUtils.SPACE);
}
/**
* <pre>
* 2 - 11
* </pre>
*/
@Schema(title = "2순위연락처", example = " ")
@Size(min = 11, max = 11, message = "2순위연락처는 11자리 입니다.")
@Builder.Default
private String contractOf2nd = StringUtils.rightPad(StringUtils.EMPTY, 11, StringUtils.SPACE);
public void setContractOf2nd(String contractOf2nd) {
this.contractOf2nd = StringUtils.rightPad(nvl(contractOf2nd), 11, StringUtils.SPACE);
}
/**
* <pre>
* 3 - 11
* </pre>
*/
@Schema(title = "3순위연락처", example = " ")
@Size(min = 11, max = 11, message = "3순위연락처는 11자리 입니다.")
@Builder.Default
private String contractOf3rd = StringUtils.rightPad(StringUtils.EMPTY, 11, StringUtils.SPACE);
public void setContractOf3rd(String contractOf3rd) {
this.contractOf3rd = StringUtils.rightPad(nvl(contractOf3rd), 11, StringUtils.SPACE);
}
/**
* <pre>
* - 2
* 00 (SMS , SMS )
* 01
* 02
* 10 ( SMS )
* 99
* </pre>
*/
@Schema(title = "결과구분코드", example = " ", allowableValues = {"00", "01", "02", "10", "99"})
@Size(min = 11, max = 11, message = "결과구분코드는 2자리 입니다.")
@Builder.Default
private String rsltDivCode = StringUtils.rightPad(StringUtils.EMPTY, 2, StringUtils.SPACE);
public void setRsltDivCode(String rsltDivCode) {
this.rsltDivCode = StringUtils.rightPad(nvl(rsltDivCode), 2, StringUtils.SPACE);
}
/**
* <pre>
* SMS - 1
* 0 : ,
* 1: 1 ,
* 2: 2
* 3: 3
* </pre>
*/
@Schema(title = "SMS발송연락처순위", example = " ", allowableValues = {"0", "1", "2", "3"})
@Size(min = 1, max = 1, message = "SMS발송연락처순위는 1자리 입니다.")
@Builder.Default
private String smsSndContractOrder = "1";
/**
* <pre>
* SMS - 11
* </pre>
*/
@Schema(title = "SMS발송연락처번호", example = " ")
@Size(min = 11, max = 11, message = "SMS발송연락처번호는 11자리 입니다.")
@Builder.Default
private String smsSndContractNo = StringUtils.rightPad(StringUtils.EMPTY, 11, StringUtils.SPACE);
public void setSmsSndContractNo(String smsSndContractNo) {
this.smsSndContractNo = StringUtils.rightPad(nvl(smsSndContractNo), 11, StringUtils.SPACE);
}
/**
* <pre>
* SMS - 14
* </pre>
*/
@Schema(title = "SMS발송예정일시", example = " ")
@Size(min = 14, max = 14, message = "SMS발송예정일시는 14자리 입니다.")
@Builder.Default
private String smsSndWillDt = StringUtils.rightPad(StringUtils.EMPTY, 14, StringUtils.SPACE);
public void setSmsSndWillDt(String smsSndWillDt) {
this.smsSndWillDt = StringUtils.rightPad(nvl(smsSndWillDt), 14, StringUtils.SPACE);
}
/**
* <pre>
* - 15
* </pre>
*/
@Schema(title = "공란", example = " ")
@Size(min = 15, max = 15, message = "공란(36자리)")
@Builder.Default
private String emptyField = StringUtils.rightPad(StringUtils.EMPTY, 15, StringUtils.SPACE);
public String getAsString() {
StringBuilder sb = new StringBuilder();
sb.append(idDiv);
sb.append(jumin);
sb.append(name);
sb.append(contractOf1st);
sb.append(contractOf2nd);
sb.append(contractOf3rd);
sb.append(rsltDivCode);
sb.append(smsSndContractOrder);
sb.append(smsSndContractNo);
sb.append(smsSndWillDt);
sb.append(emptyField);
return sb.toString();
}
}
@Schema(name = "NiceCommon", description = "NICE CI 전문 공통 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class NiceCommon {
/**
* <pre>
* - 9
* "NICEIF "
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "전문그룹코드(9자리)", example = "NICEIF ")
@Size(min = 9, max = 9, message = "전문그룹코드는 9자리 입니다.")
@Builder.Default
private String grpCode = "NICEIF ";
public void setGrpCode(String grpCode) {
this.grpCode = StringUtils.rightPad(nvl(grpCode), 9, StringUtils.SPACE);
}
/**
* <pre>
* - / 4
* "0200" set
* NICE "0210" set
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "거래종별코드(4자리)", example = "0200")
@Size(min = 4, max = 4, message = "거래 종별 코드는 4자리 입니다.")
@Builder.Default
private String trType = "0200";
public void setTrType(String trType) {
this.trType = StringUtils.rightPad(nvl(trType), 4, StringUtils.SPACE);
}
/**
* <pre>
* - 5
* "31895" set
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "거래구분코드(5자리)", example = "31895")
@Size(min = 5, max = 5, message = "거래 구분 코드는 5자리 입니다.")
@Builder.Default
private String trClassification = "31895";
public void setTrClassification(String trClassification) {
this.trClassification = StringUtils.rightPad(nvl(trClassification), 5, StringUtils.SPACE);
}
/**
* <pre>
* - / 1
* : "B" set
* NICE "N" set
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "송수신플래그(1자리)", example = "B")
@Size(min = 1, max = 1, message = "송수신 플래그는 1자리 입니다.")
@Builder.Default
private String sndAndRcvFlag = "B";
/**
* <pre>
* - 3
* "503" set
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "단말기구분(3자리)", example = "503")
@Size(min = 1, max = 1, message = "단말기 구분은 3자리 입니다.")
@Builder.Default
private String deviceClassification = "503";
public void setDeviceClassification(String deviceClassification) {
this.deviceClassification = StringUtils.rightPad(nvl(deviceClassification), 3, StringUtils.SPACE);
}
/**
* <pre>
* - 4 NICE 4
* P000
* P001
* P005 ID
* E998 TimeOut
* E999
* S602
* S702
* S722 Server System
* S316 ( )
* S317 10
* </pre>
*/
@Schema(title = "응답코드(4자리)", example = " ")
@Pattern(regexp = "^$|^[P|E|S][\\d]{3}$", message = "응답코드(4자리)는 4자리 입니다")
@Builder.Default
private String rsltCode = StringUtils.rightPad(StringUtils.EMPTY, 4, StringUtils.SPACE);
public void setRsltCode(String rsltCode) {
this.rsltCode = StringUtils.rightPad(nvl(rsltCode), 4, StringUtils.SPACE);
}
/**
* <pre>
* ID - 9
* CB H/I NICE USER ID
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "참가기관ID(9자리)", example = "503")
@Size(min = 9, max = 9, message = "참가기관ID는 3자리 입니다.")
@Builder.Default
private String orgId = StringUtils.rightPad(StringUtils.EMPTY, 9, StringUtils.SPACE);
public void setOrgId(String orgId) {
this.orgId = StringUtils.rightPad(nvl(orgId), 9, StringUtils.SPACE);
}
/**
* <pre>
* - 10
* set
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "기관전문관리번호(10자리)", example = " ")
@Size(min = 10, max = 10, message = "기관전문관리번호는 10자리 입니다.")
@Builder.Default
private String orgMngNo = StringUtils.rightPad(StringUtils.EMPTY, 10, StringUtils.SPACE);
public void setOrgMngNo(String orgMngNo) {
this.orgMngNo = StringUtils.rightPad(nvl(orgMngNo), 10, StringUtils.SPACE);
}
/**
* <pre>
* - 14
* set
* </pre>
*/
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "기관전문전송시간(14자리)", example = " ")
@Size(min = 14, max = 14, message = "기관전문전송시간은 14자리 입니다.")
@Builder.Default
private String orgSndDt = DateUtil.getTodayAndNowTime("yyyyMMddHHmmss");
public void setOrgSndDt(String orgSndDt) {
this.orgSndDt = StringUtils.rightPad(nvl(orgSndDt), 14, StringUtils.SPACE);
}
/**
* <pre>
* NICE - 10
* NICE set
* </pre>
*/
@Schema(title = "NICE전문관리번호(10자리)", example = " ")
@Size(min = 10, max = 10, message = "NICE전문관리번호 10자리 입니다.")
@Builder.Default
private String niceMngNo = StringUtils.rightPad(StringUtils.EMPTY, 10, StringUtils.SPACE);
public void setNiceMngNo(String niceMngNo) {
this.niceMngNo = StringUtils.rightPad(nvl(niceMngNo), 10, StringUtils.SPACE);
}
/**
* <pre>
* NICE - 14
* NICE set
* </pre>
*/
@Schema(title = "NICE전문전송시간(14자리)", example = " ")
@Size(min = 14, max = 14, message = "NICE전문전송시간은 14자리 입니다.")
@Builder.Default
private String niceSndDt = StringUtils.rightPad(StringUtils.EMPTY, 14, StringUtils.SPACE);
public void setNiceSndDt(String niceSndDt) {
this.niceSndDt = StringUtils.rightPad(nvl(niceSndDt), 14, StringUtils.SPACE);
}
public String getAsString() {
StringBuilder sb = new StringBuilder();
sb.append(grpCode);
sb.append(trType);
sb.append(trClassification);
sb.append(sndAndRcvFlag);
sb.append(deviceClassification);
sb.append(rsltCode);
sb.append(orgId);
sb.append(orgMngNo);
sb.append(orgSndDt);
sb.append(niceMngNo);
sb.append(niceSndDt);
return sb.toString();
}
}
private static String nvl(String src){
return StringUtils.defaultIfEmpty(src, StringUtils.EMPTY);
}
public static void main(String[] args) {
NiceRequest nr = new NiceRequest();
nr.setTrCode("aa");
// // 공통부
//
// // 개별요청부
// nr.setQueryReason(StringUtils.EMPTY);
// nr.setQueryReqCnt(46);
// nr.setSmsSndReqCode("1");
// nr.setSndMessage("~~~");
// nr.setSndPhoneNo("010");
// nr.setContactSearchCode("1");
// 공통부
NiceCommon nc = new NiceCommon();
// nc.setRsltCode(StringUtils.EMPTY);
// nc.setOrgId("orgId");
// nc.setOrgMngNo("orgMngNo");
QueryRequest qr = new QueryRequest();
ButtonRequest br = new ButtonRequest();
nr.setNiceCommon(nc);
nr.getQueryRequests().add(qr);
nr.getButtonRequests().add(br);
// nc.setNiceMngNo(StringUtils.EMPTY);
// nc.setNiceSndDt(StringUtils.EMPTY);
String fullText = nr.getAsString();
System.out.println(String.format("[%s] %d", fullText, fullText.length()));
NiceCommon nc2 = NiceCommon.builder()
.build();
QueryRequest qr2 = QueryRequest.builder()
.idDiv("1")
.jumin("1234567890123")
.build();
ButtonRequest br2 = ButtonRequest.builder()
.btnType("12")
.build();
NiceRequest nr2 = NiceRequest.builder()
.trCode("trCode")
.niceCommon(nc2)
.queryRequests(Collections.singletonList(qr2))
.buttonRequests(Collections.singletonList(br2))
.build();
String fullText2 = nr2.getAsString();
System.out.println(String.format("[%s] %d", fullText2, fullText2.length()));
ResResult resResult = new ResResult();
ResResult resResult2 = ResResult.builder().build();
NiceResponse res = new NiceResponse();
res.setNiceCommon(nc);
res.resResults.add(resResult);
NiceResponse res2 = NiceResponse.builder()
.niceCommon(nc2)
.resResults(Collections.singletonList(resResult2))
.build();
String fullText3 = res.getAsString();
String fullText4 = res2.getAsString();
System.out.println(String.format("[%s] %d", fullText3, fullText3.length()));
System.out.println(String.format("[%s] %d", fullText4, fullText4.length()));
}
}
Loading…
Cancel
Save