feat: NICE CI 연락처 이력 조회 전문 및 parser 추가

dev
Jonguk. Lim 2 months ago
parent 82e595f725
commit 056c43a7a4

@ -32,11 +32,11 @@ import lombok.*;
*/ */
public class NiceDTO { public class NiceDTO {
@Schema(name = "NiceRequest", description = "NICE CI 전문 DTO") @Schema(name = "NiceContractQueryRequest", description = "NICE CI 연락처조회 전문 DTO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public static class NiceRequest implements Serializable { public static class NiceContractQueryRequest implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
@ -255,11 +255,11 @@ public class NiceDTO {
} }
@Schema(name = "NiceResponse", description = "NICE CI 전문 응답 DTO") @Schema(name = "NiceContractQueryResponse", description = "NICE CI 연락처조회 전문 응답 DTO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public static class NiceResponse implements Serializable { public static class NiceContractQueryResponse implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
@ -271,8 +271,6 @@ public class NiceDTO {
* - max: 9 * - max: 9
* </pre> * </pre>
*/ */
@Schema(title = "TR Code", example = " ")
@Size(min = 0, max = 9, message = "트랜잭션 코드는 0~9자리 입니다.")
private String trCode; private String trCode;
public void setTrCode(String trCode) { public void setTrCode(String trCode) {
this.trCode = StringUtils.trim(trCode); this.trCode = StringUtils.trim(trCode);
@ -281,8 +279,6 @@ public class NiceDTO {
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
// 공통부 : 100 자리 // 공통부 : 100 자리
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
@Valid
NiceCommon niceCommon; NiceCommon niceCommon;
/** /**
@ -290,8 +286,6 @@ public class NiceDTO {
* - 16 * - 16
* </pre> * </pre>
*/ */
@Schema(title = "공란", example = " ")
@Size(min = 16, max = 17, message = "공란(17자리)")
private String commonEmptyField; private String commonEmptyField;
public void setCommonEmptyField(String commonEmptyField) { public void setCommonEmptyField(String commonEmptyField) {
this.commonEmptyField = StringUtils.trim(commonEmptyField); this.commonEmptyField = StringUtils.trim(commonEmptyField);
@ -309,8 +303,6 @@ public class NiceDTO {
* 48 * 48
* </pre> * </pre>
*/ */
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "응답 건수", example = " ")
@Max(value = 48, message = "응답 최대건수는 48입니다")
private String resCnt; private String resCnt;
public void setResCnt(String resCnt) { public void setResCnt(String resCnt) {
this.resCnt = StringUtils.trim(resCnt); this.resCnt = StringUtils.trim(resCnt);
@ -326,8 +318,6 @@ public class NiceDTO {
* 3: 1 ~ 3 1 * 3: 1 ~ 3 1
* </pre> * </pre>
*/ */
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "SMS발송요청구분코드", example = " ", allowableValues = {"0", "1", "2", "3"})
@Pattern(regexp = "[0-3]", message = "SMS발송요청구분코드 0 ~ 3 입니다(1자리)")
private String smsSndReqCode; private String smsSndReqCode;
public void setSmsSndReq(String smsSndReqCode) { public void setSmsSndReq(String smsSndReqCode) {
this.smsSndReqCode = StringUtils.trim(smsSndReqCode); this.smsSndReqCode = StringUtils.trim(smsSndReqCode);
@ -339,8 +329,6 @@ public class NiceDTO {
* (smsSndReqCode) 1, 2, 3 * (smsSndReqCode) 1, 2, 3
* </pre> * </pre>
*/ */
@Schema(title = "SMS 발송메세지", example = " ")
@Pattern(regexp = "^$|[\\s]{10,2000}", message = "SMS발송메세지는 10 ~ 2000자리 입니다")
private String sndMessage; private String sndMessage;
public void setSndMessage(String sndMessage) { public void setSndMessage(String sndMessage) {
this.sndMessage = StringUtils.trim(sndMessage); this.sndMessage = StringUtils.trim(sndMessage);
@ -352,8 +340,6 @@ public class NiceDTO {
* (smsSndReqCode) 1, 2, 3 * (smsSndReqCode) 1, 2, 3
* </pre> * </pre>
*/ */
@Schema(title = "SMS 발신번호", example = " ")
@Pattern(regexp = "^$|[\\d]{3,12}", message = "SMS 발신번호는 3 ~ 12자리 입니다")
private String sndPhoneNo; private String sndPhoneNo;
public void setSndPhoneNo(String sndPhoneNo) { public void setSndPhoneNo(String sndPhoneNo) {
this.sndPhoneNo = StringUtils.trim(sndPhoneNo); this.sndPhoneNo = StringUtils.trim(sndPhoneNo);
@ -368,8 +354,6 @@ public class NiceDTO {
* 3: 3 * 3: 3
* </pre> * </pre>
*/ */
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "연락처조회구분코드", example = " ", allowableValues = {"1", "2", "3"})
@Pattern(regexp = "[1-3]", message = "연락처조회구분 코드는 1 ~ 3 입니다(1자리)")
private String contactSearchCode = "3"; private String contactSearchCode = "3";
/** /**
@ -377,8 +361,6 @@ public class NiceDTO {
* - 84 * - 84
* </pre> * </pre>
*/ */
@Schema(title = "공란", example = " ")
@Size(min = 84, max = 84, message = "공란(84자리)")
private String privateEmptyField; private String privateEmptyField;
public void setPrivateEmptyField(String privateEmptyField) { public void setPrivateEmptyField(String privateEmptyField) {
this.privateEmptyField = StringUtils.trim(privateEmptyField); this.privateEmptyField = StringUtils.trim(privateEmptyField);
@ -395,22 +377,23 @@ public class NiceDTO {
// 응답반복부 : 110 자리 // 응답반복부 : 110 자리
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
public String ofString() { // public String ofString() {
StringBuilder sb = new StringBuilder(); // StringBuilder sb = new StringBuilder();
sb.append(trCode); // sb.append(trCode);
sb.append(niceCommon.ofString()); // sb.append(niceCommon.ofString());
sb.append(commonEmptyField); // sb.append(commonEmptyField);
sb.append(resCnt); // sb.append(resCnt);
sb.append(smsSndReqCode); // sb.append(smsSndReqCode);
sb.append(sndMessage); // sb.append(sndMessage);
sb.append(sndPhoneNo); // sb.append(sndPhoneNo);
sb.append(contactSearchCode); // sb.append(contactSearchCode);
sb.append(privateEmptyField); // sb.append(privateEmptyField);
sb.append(resResults.stream().map(ResResult::ofString).collect(Collectors.joining())); // sb.append(resResults.stream().map(ResResult::ofString).collect(Collectors.joining()));
return sb.toString(); // return sb.toString();
} // }
public NiceResponse parse(String tgtStr) { public NiceContractQueryResponse parse(String tgtStr) {
final int repeatLength = 110;
final int[] parseLength = { final int[] parseLength = {
9, // tr-code 9, // tr-code
83, // 공통부 83, // 공통부
@ -426,7 +409,7 @@ public class NiceDTO {
String tgtString = new String(tgtStr.getBytes(), StandardCharsets.UTF_8); String tgtString = new String(tgtStr.getBytes(), StandardCharsets.UTF_8);
if (StringUtils.isNotBlank(tgtString) && tgtString.length() >= 2319) { if (StringUtils.isNotBlank(tgtString) && tgtString.length() >= 2319) {
NiceResponse nr = new NiceResponse(); NiceContractQueryResponse nr = new NiceContractQueryResponse();
int idx = 0; int idx = 0;
nr.setTrCode(StringUtils.left(tgtString, parseLength[idx])); nr.setTrCode(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]); tgtString = tgtString.substring(parseLength[idx++]);
@ -455,12 +438,350 @@ public class NiceDTO {
nr.setPrivateEmptyField(StringUtils.left(tgtString, parseLength[idx])); nr.setPrivateEmptyField(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx]); tgtString = tgtString.substring(parseLength[idx]);
if(tgtString.length() % 110 == 0){ if(tgtString.length() % repeatLength == 0){
int repeat = tgtString.length() / 110; int repeat = tgtString.length() / repeatLength;
String finalTgtString = tgtString;
List<ResResult> resResults = IntStream.range(0, repeat)
.mapToObj(i -> {
String currentString = finalTgtString.substring(i * repeatLength, (i + 1) * repeatLength);
return ResResult.parse(currentString);
})
.collect(Collectors.toList());
nr.setResResults(resResults);
}
return nr;
}
return null;
}
}
@Schema(name = "NiceContractHistoryQueryRequest", description = "NICE CI 연락처 이력 조회 전문 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class NiceContractHistoryQueryRequest 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자리 입니다.")
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>
* - 17
* </pre>
*/
@Schema(title = "공란", example = " ")
@Size(min = 17, max = 17, message = "공란(16자리)")
private String commonEmptyField = StringUtils.rightPad(StringUtils.EMPTY, 17, StringUtils.SPACE);
//----------------------------------------------------------------------------------------------
// 공통부 : 100 자리
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
// 개별요청부 : 100 자리
//----------------------------------------------------------------------------------------------
/**
* <pre>
* from - 20
* YYYYMMDDHHMMSS(14)+microSecond(6)
* </pre>
*/
@Schema(title = "검색기간 from", example = " ")
@Size(min = 20, max = 20, message = "검색기간 from")
private String fromDt = StringUtils.rightPad(StringUtils.EMPTY, 20, StringUtils.SPACE);
public void setFromDt(String fromDt) {
this.fromDt = StringUtils.rightPad(nvl(fromDt), 20, StringUtils.SPACE);
}
/**
* <pre>
* to - 20
* YYYYMMDDHHMMSS(14)+microSecond(6)
* </pre>
*/
@Schema(title = "검색기간 to", example = " ")
@Size(min = 20, max = 20, message = "검색기간 to")
private String toDt = StringUtils.rightPad(StringUtils.EMPTY, 20, StringUtils.SPACE);
public void setToDt(String toDt) {
this.toDt = StringUtils.rightPad(nvl(toDt), 20, StringUtils.SPACE);
}
/**
* <pre>
* // - 1
* 1()
* </pre>
*/
@Schema(title = "개인/사업자/법인구분", example = "1")
@Size(min = 1, max = 1, message = "개인/사업자/법인구분은 1자리 입니다.")
private String idDiv = "1";
/**
* <pre>
* - 13
* </pre>
*/
@Schema(title = "주민번호", example = " ")
@Size(min = 13, max = 13, message = "주민번호는 13자리 입니다.")
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>
* - 2
* " " -
* 00 - (SMS , SMS )
* 01 - (// )
* 10 - ( SMS )
* </pre>
*/
@Schema(title = "결과구분코드", example = " ", allowableValues = {" ", "00", "01", "10"})
@Size(min = 2, max = 2, message = "결과구분코드는 2자리 입니다.")
private String rsltDivCode = " ";
public void setRsltDivCode(String rsltDivCode) {
this.rsltDivCode = StringUtils.rightPad(nvl(rsltDivCode), 2, StringUtils.SPACE);
}
/**
* <pre>
* SMS - 1
* 0 : ,
* 1: 1 ,
* 2: 1 ~ 2 1
* 3: 1 ~ 3 1
* 4: 1{1 } + 2{1~2 } + 3{1~3 }
* </pre>
*/
@Schema(title = "SMS발송요청구분", example = " ", allowableValues = {"0", "1", "2", "3", "4"})
@Size(min = 1, max = 1, message = "SMS발송요청구분은 1자리 입니다.")
private String smsSndReqCode = "0";
/**
* <pre>
* - 10
* : 100
* </pre>
*/
@Schema(title = "요청건수", example = " ")
@Max(value = 100, message = "요청건수는 최대 10자리 입니다.")
private String reqCnt = StringUtils.rightPad(StringUtils.EMPTY, 9, StringUtils.SPACE);
public void setReqCnt(String reqCnt){
this.reqCnt = StringUtils.rightPad(nvl(reqCnt), 13, StringUtils.SPACE);
}
/**
* <pre>
* - 10
* "0000000000"
* </pre>
*/
@Schema(title = "누적수신건수", example = " ")
@Max(value = 100, message = "누적수신건수는 최대 10자리 입니다.")
private String accRecvCnt = "0000000000";
public void setAccRecvCnt(String accRecvCnt) {
this.accRecvCnt = StringUtils.rightPad(nvl(accRecvCnt), 10, StringUtils.SPACE);
}
/**
* <pre>
* - 880
* </pre>
*/
@Schema(title = "공란", example = " ")
@Size(min = 23, max = 23, message = "공란(23자리)")
private String privateEmptyField = StringUtils.rightPad(StringUtils.EMPTY, 23, StringUtils.SPACE);
//----------------------------------------------------------------------------------------------
// 개별요청부 : 3000 자리
//----------------------------------------------------------------------------------------------
public String ofString() {
StringBuilder sb = new StringBuilder();
sb.append(trCode);
// 공통부
sb.append(niceCommon.ofString());
sb.append(commonEmptyField);
// 개별요청부
sb.append(fromDt);
sb.append(toDt);
sb.append(idDiv);
sb.append(jumin);
sb.append(rsltDivCode);
sb.append(smsSndReqCode);
sb.append(reqCnt);
sb.append(accRecvCnt);
sb.append(privateEmptyField);
// FIXME: 인코딩확인후 적용
return new String(sb.toString().getBytes(), StandardCharsets.UTF_8);
}
}
@Schema(name = "NiceContractHistoryQueryResponse", description = "NICE CI 연락처 이력 조회 전문 응답 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class NiceContractHistoryQueryResponse implements Serializable {
private static final long serialVersionUID = 1L;
//----------------------------------------------------------------------------------------------
// TR-CODE : 0 ~ 9 자리
//----------------------------------------------------------------------------------------------
/**
* <pre>
* TR-CODE
* - max: 9
* </pre>
*/
private String trCode;
public void setTrCode(String trCode) {
this.trCode = StringUtils.trim(trCode);
}
//----------------------------------------------------------------------------------------------
// 공통부 : 100 자리
//----------------------------------------------------------------------------------------------
NiceCommon niceCommon;
/**
* <pre>
* - 16
* </pre>
*/
private String commonEmptyField;
public void setCommonEmptyField(String commonEmptyField) {
this.commonEmptyField = StringUtils.trim(commonEmptyField);
}
//----------------------------------------------------------------------------------------------
// 공통부 : 100 자리
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
// 개별응답부 : 30 자리
//----------------------------------------------------------------------------------------------
/**
* <pre>
* : 10
* </pre>
*/
private String totalCnt;
public void setTotalCnt(String totalCnt) {
this.totalCnt = StringUtils.trim(totalCnt);
}
/**
* <pre>
* : 10
* </pre>
*/
private String accCnt;
public void setAccCnt(String accCnt) {
this.accCnt = StringUtils.trim(accCnt);
}
/**
* <pre>
* : 10
* 100
* </pre>
*/
private String resCnt;
public void setResCnt(String resCnt) {
this.resCnt = StringUtils.trim(resCnt);
}
//----------------------------------------------------------------------------------------------
// 개별응답부 : 30 자리
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
// 응답반복부 : 1150 자리
//----------------------------------------------------------------------------------------------
List<ResResult> resResults = new ArrayList<>();
//----------------------------------------------------------------------------------------------
// 응답반복부 : 1150 자리
//----------------------------------------------------------------------------------------------
// public String ofString() {
// StringBuilder sb = new StringBuilder();
// sb.append(trCode);
// sb.append(niceCommon.ofString());
// 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::ofString).collect(Collectors.joining()));
// return sb.toString();
// }
public NiceContractHistoryQueryResponse parse(String tgtStr) {
final int repeatLength = 1150;
final int[] parseLength = {
9, // tr-code
83, // 공통부
17, // 공란
10, // 총건수
10, // 누적건수
10, // 응답건수
};
// FIXME: 인코딩확인후 적용
String tgtString = new String(tgtStr.getBytes(), StandardCharsets.UTF_8);
if (StringUtils.isNotBlank(tgtString) && tgtString.length() >= 1289) {
NiceContractHistoryQueryResponse nr = new NiceContractHistoryQueryResponse();
int idx = 0;
nr.setTrCode(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setNiceCommon(NiceCommon.parse(tgtString));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setCommonEmptyField(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setResCnt(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setTotalCnt(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setAccCnt(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
nr.setResCnt(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
if(tgtString.length() % repeatLength == 0){
int repeat = tgtString.length() / repeatLength;
String finalTgtString = tgtString; String finalTgtString = tgtString;
List<ResResult> resResults = IntStream.range(0, repeat) List<ResResult> resResults = IntStream.range(0, repeat)
.mapToObj(i -> { .mapToObj(i -> {
String currentString = finalTgtString.substring(i * 110, (i + 1) * 110); String currentString = finalTgtString.substring(i * repeatLength, (i + 1) * repeatLength);
return ResResult.parse(currentString); return ResResult.parse(currentString);
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -472,6 +793,7 @@ public class NiceDTO {
} }
} }
@Schema(name = "QueryRequest", description = "NICE CI 조회 요청 DTO") @Schema(name = "QueryRequest", description = "NICE CI 조회 요청 DTO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@ -598,15 +920,29 @@ public class NiceDTO {
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public static class ResResult { public static class ResResult {
//------------------------------------------------------------------------------------
// 연락처 이력 조회시만
//------------------------------------------------------------------------------------
/**
* <pre>
* - - 20
* YYYYMMDDHHMMSS(14)+microSecond(6)
* </pre>
*/
private String queryDt;
public void setQueryDt(String queryDt) {
this.queryDt = StringUtils.trim(queryDt);
}
//------------------------------------------------------------------------------------
// 연락처 이력 조회시만
//------------------------------------------------------------------------------------
/** /**
* <pre> * <pre>
* // - 1 * // - 1
* 1() * 1()
* </pre> * </pre>
*/ */
@Schema(title = "개인/사업자/법인구분", example = "1")
@Size(min = 1, max = 1, message = "개인/사업자/법인구분은 1자리 입니다.")
@Setter
private String idDiv = "1"; private String idDiv = "1";
/** /**
@ -614,8 +950,6 @@ public class NiceDTO {
* - 13 * - 13
* </pre> * </pre>
*/ */
@Schema(title = "주민번호", example = " ")
@Size(min = 13, max = 13, message = "주민번호는 13자리 입니다.")
private String jumin; private String jumin;
public void setJumin(String jumin) { public void setJumin(String jumin) {
this.jumin = StringUtils.trim(jumin); this.jumin = StringUtils.trim(jumin);
@ -626,8 +960,6 @@ public class NiceDTO {
* - 20 * - 20
* </pre> * </pre>
*/ */
@Schema(title = "이름", example = " ")
@Size(min = 20, max = 20, message = "이름은 20자리 입니다.")
private String name; private String name;
public void setName(String name) { public void setName(String name) {
this.name = StringUtils.trim(name); this.name = StringUtils.trim(name);
@ -638,8 +970,6 @@ public class NiceDTO {
* 1 - 11 * 1 - 11
* </pre> * </pre>
*/ */
@Schema(title = "1순위연락처", example = " ")
@Size(min = 11, max = 11, message = "1순위연락처는 11자리 입니다.")
private String contractOf1st; private String contractOf1st;
public void setContractOf1st(String contractOf1st) { public void setContractOf1st(String contractOf1st) {
this.contractOf1st = StringUtils.trim(contractOf1st); this.contractOf1st = StringUtils.trim(contractOf1st);
@ -650,8 +980,6 @@ public class NiceDTO {
* 2 - 11 * 2 - 11
* </pre> * </pre>
*/ */
@Schema(title = "2순위연락처", example = " ")
@Size(min = 11, max = 11, message = "2순위연락처는 11자리 입니다.")
private String contractOf2nd; private String contractOf2nd;
public void setContractOf2nd(String contractOf2nd) { public void setContractOf2nd(String contractOf2nd) {
this.contractOf2nd = StringUtils.trim(contractOf2nd); this.contractOf2nd = StringUtils.trim(contractOf2nd);
@ -662,8 +990,6 @@ public class NiceDTO {
* 3 - 11 * 3 - 11
* </pre> * </pre>
*/ */
@Schema(title = "3순위연락처", example = " ")
@Size(min = 11, max = 11, message = "3순위연락처는 11자리 입니다.")
private String contractOf3rd; private String contractOf3rd;
public void setContractOf3rd(String contractOf3rd) { public void setContractOf3rd(String contractOf3rd) {
this.contractOf3rd = StringUtils.trim(contractOf3rd); this.contractOf3rd = StringUtils.trim(contractOf3rd);
@ -679,13 +1005,52 @@ public class NiceDTO {
* 99 * 99
* </pre> * </pre>
*/ */
@Schema(title = "결과구분코드", example = " ", allowableValues = {"00", "01", "02", "10", "99"})
@Size(min = 2, max = 2, message = "결과구분코드는 2자리 입니다.")
private String rsltDivCode; private String rsltDivCode;
public void setRsltDivCode(String rsltDivCode) { public void setRsltDivCode(String rsltDivCode) {
this.rsltDivCode = StringUtils.trim(rsltDivCode); this.rsltDivCode = StringUtils.trim(rsltDivCode);
} }
//------------------------------------------------------------------------------------
// 연락처 이력 조회시만
//------------------------------------------------------------------------------------
/**
* <pre>
* - SMS: 1
* 1 ~ 3 :
* 0 : ,
* 4: (31894)
* </pre>
*/
private String smsSndReqCode;
public void setSmsSndReq(String smsSndReqCode) {
this.smsSndReqCode = StringUtils.trim(smsSndReqCode);
}
/**
* <pre>
* - : 10 ~ 2000
* (smsSndReqCode) 1, 2, 3
* </pre>
*/
private String sndMessage;
public void setSndMessage(String sndMessage) {
this.sndMessage = StringUtils.trim(sndMessage);
}
/**
* <pre>
* - : 12
* (smsSndReqCode) 1, 2, 3
* </pre>
*/
private String sndPhoneNo;
public void setSndPhoneNo(String sndPhoneNo) {
this.sndPhoneNo = StringUtils.trim(sndPhoneNo);
}
//------------------------------------------------------------------------------------
// 연락처 이력 조회시만
//------------------------------------------------------------------------------------
/** /**
* <pre> * <pre>
* SMS - 1 * SMS - 1
@ -695,8 +1060,6 @@ public class NiceDTO {
* 3: 3 * 3: 3
* </pre> * </pre>
*/ */
@Schema(title = "SMS발송연락처순위", example = " ", allowableValues = {"0", "1", "2", "3"})
@Size(min = 1, max = 1, message = "SMS발송연락처순위는 1자리 입니다.")
private String smsSndContractOrder = "1"; private String smsSndContractOrder = "1";
/** /**
@ -704,8 +1067,6 @@ public class NiceDTO {
* SMS - 11 * SMS - 11
* </pre> * </pre>
*/ */
@Schema(title = "SMS발송연락처번호", example = " ")
@Size(min = 11, max = 11, message = "SMS발송연락처번호는 11자리 입니다.")
private String smsSndContractNo; private String smsSndContractNo;
public void setSmsSndContractNo(String smsSndContractNo) { public void setSmsSndContractNo(String smsSndContractNo) {
this.smsSndContractNo = StringUtils.trim(smsSndContractNo); this.smsSndContractNo = StringUtils.trim(smsSndContractNo);
@ -716,42 +1077,75 @@ public class NiceDTO {
* SMS - 14 * SMS - 14
* </pre> * </pre>
*/ */
@Schema(title = "SMS발송예정일시", example = " ")
@Size(min = 14, max = 14, message = "SMS발송예정일시는 14자리 입니다.")
private String smsSndWillDt; private String smsSndWillDt;
public void setSmsSndWillDt(String smsSndWillDt) { public void setSmsSndWillDt(String smsSndWillDt) {
this.smsSndWillDt = StringUtils.trim(smsSndWillDt); this.smsSndWillDt = StringUtils.trim(smsSndWillDt);
} }
//------------------------------------------------------------------------------------
// 연락처 이력 조회시만
//------------------------------------------------------------------------------------
/** /**
* <pre> * <pre>
* - 15 * - ID : 9
* </pre>
*/
private String procId;
public void setProcId(String procId) {
this.procId = StringUtils.trim(procId);
}
/**
* <pre>
* - : 1
* default: 3
* 1: 1 ,
* 2: 2
* 3: 3
* </pre>
*/
private String contactSearchCode = "3";
/**
* <pre>
* - : 1
* 0(), 1( ), 2(SMS/LMS)
* , 0
* </pre>
*/
private String msgSndRsltDivCode;
//------------------------------------------------------------------------------------
// 연락처 이력 조회시만
//------------------------------------------------------------------------------------
/**
* <pre>
* - 15, 11
* </pre> * </pre>
*/ */
@Schema(title = "공란", example = " ")
@Size(min = 15, max = 15, message = "공란(36자리)")
private String emptyField; private String emptyField;
public void setEmptyField(String emptyField) { public void setEmptyField(String emptyField) {
this.emptyField = StringUtils.trim(emptyField); this.emptyField = StringUtils.trim(emptyField);
} }
public String ofString() { // public String ofString() {
StringBuilder sb = new StringBuilder(); // StringBuilder sb = new StringBuilder();
sb.append(idDiv); // sb.append(idDiv);
sb.append(jumin); // sb.append(jumin);
sb.append(name); // sb.append(name);
sb.append(contractOf1st); // sb.append(contractOf1st);
sb.append(contractOf2nd); // sb.append(contractOf2nd);
sb.append(contractOf3rd); // sb.append(contractOf3rd);
sb.append(rsltDivCode); // sb.append(rsltDivCode);
sb.append(smsSndContractOrder); // sb.append(smsSndContractOrder);
sb.append(smsSndContractNo); // sb.append(smsSndContractNo);
sb.append(smsSndWillDt); // sb.append(smsSndWillDt);
sb.append(emptyField); // sb.append(emptyField);
return sb.toString(); // return sb.toString();
} // }
public static ResResult parse(String tgtString) { public static ResResult parse(String tgtString) {
// 110 자리
final int[] parseLength = { final int[] parseLength = {
1, // 개인.사업자.법인구분 1, // 개인.사업자.법인구분
13, // 주민번호 13, // 주민번호
@ -805,6 +1199,92 @@ public class NiceDTO {
} }
return null; return null;
} }
public static ResResult parseHistory(String tgtString) {
// 1150
final int[] parseLength = {
20, // 조회일시 - 이력조회시만 사용
1, // 개인.사업자.법인구분
13, // 주민번호
20, // 성명
11, // 1순위 연락처
11, // 2순위 연락처
11, // 3순위 연락처
2, // 결과구분
1, // SMS발송 요청 구분 - 이력조회시만 사용
1000, // 발송메세지 - 이력조회시만 사용
12, // 발신번호 - 이력조회시만 사용
1, // SMS발송 연락처 순위
11, // SMS발송 연락처 번호
14, // SMS발송(예정)일시
9, // 처리자ID - 이력조회시만 사용
1, // 연락처 조회 구분 - 이력조회시만 사용
1, // 메세지발송결과 구붑
11, // 공란
};
if (StringUtils.isNotBlank(tgtString) && tgtString.length()%1150 == 0) {
ResResult rr = new ResResult();
int idx = 0;
// 이력조회시만 사용 ////////////////////////////////////////////////////////
rr.setQueryDt(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
// 이력조회시만 사용 ////////////////////////////////////////////////////////
rr.setIdDiv(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setJumin(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setName(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setContractOf1st(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setContractOf2nd(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setContractOf3rd(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setRsltDivCode(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
// 이력조회시만 사용 ////////////////////////////////////////////////////////
rr.setSmsSndReqCode(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setSndMessage(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setSmsSndContractNo(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
// 이력조회시만 사용 ////////////////////////////////////////////////////////
rr.setSmsSndContractOrder(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setSmsSndContractNo(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setSmsSndWillDt(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
// 이력조회시만 사용 ////////////////////////////////////////////////////////
rr.setProcId(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setContactSearchCode(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
rr.setRsltDivCode(StringUtils.left(tgtString, parseLength[idx]));
tgtString = tgtString.substring(parseLength[idx++]);
// 이력조회시만 사용 ////////////////////////////////////////////////////////
rr.setEmptyField(StringUtils.left(tgtString, parseLength[idx]));
return rr;
}
return null;
}
} }
@Schema(name = "NiceCommon", description = "NICE CI 전문 공통 DTO") @Schema(name = "NiceCommon", description = "NICE CI 전문 공통 DTO")
@ -1041,7 +1521,7 @@ public class NiceDTO {
} }
public static void main(String[] args) { public static void main(String[] args) {
NiceRequest nr = new NiceRequest(); NiceContractQueryRequest nr = new NiceContractQueryRequest();
nr.setTrCode("aa"); nr.setTrCode("aa");
// // 공통부 // // 공통부
// //
@ -1079,7 +1559,7 @@ public class NiceDTO {
System.out.println(String.format("[%s] %d", fullText, fullText.length())); System.out.println(String.format("[%s] %d", fullText, fullText.length()));
NiceResponse res = new NiceResponse(); NiceContractQueryResponse res = new NiceContractQueryResponse();
String resStr = "trCode " + String resStr = "trCode " +
// NiceCommon // NiceCommon
"NICEIF 020031895B503rsltorgId orgMngNo orgSndDt niceMngNo niceSndDt" + "NICEIF 020031895B503rsltorgId orgMngNo orgSndDt niceMngNo niceSndDt" +
@ -1089,7 +1569,7 @@ public class NiceDTO {
// 응답반복부 // 응답반복부
"18401011449211name2 001 "+ "18401011449211name2 001 "+
"19412341234567이름2 1 "; "19412341234567이름2 1 ";
NiceResponse niceResponse = res.parse(resStr); NiceContractQueryResponse niceResponse = res.parse(resStr);
System.out.println(niceResponse); System.out.println(niceResponse);
} }
} }

Loading…
Cancel
Save