|
|
|
@ -10,6 +10,7 @@ import javax.validation.constraints.*;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.*;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.ens.modules.nice.cmm.*;
|
|
|
|
|
import io.swagger.v3.oas.annotations.media.*;
|
|
|
|
|
import lombok.*;
|
|
|
|
|
|
|
|
|
@ -48,8 +49,8 @@ public class NiceCiHistoryDTO {
|
|
|
|
|
* 전문길이 set
|
|
|
|
|
* </pre>
|
|
|
|
|
*/
|
|
|
|
|
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "TR Code", example = " ")
|
|
|
|
|
@Size(min = 10, max = 10, message = "트랜잭션 코드는 10자리 입니다.")
|
|
|
|
|
//@Schema(requiredMode = Schema.RequiredMode.REQUIRED, title = "TR Code", example = " ")
|
|
|
|
|
//@Size(min = 10, max = 10, message = "트랜잭션 코드는 10자리 입니다.")
|
|
|
|
|
private String trCode = StringUtils.EMPTY;
|
|
|
|
|
public void setTrCode(String trCode) {
|
|
|
|
|
this.trCode = StringUtils.leftPad(nvl(trCode), 10, StringUtils.SPACE);
|
|
|
|
@ -164,10 +165,10 @@ public class NiceCiHistoryDTO {
|
|
|
|
|
* </pre>
|
|
|
|
|
*/
|
|
|
|
|
@Schema(title = "요청건수", example = " ")
|
|
|
|
|
@Max(value = 100, message = "요청건수는 최대 10자리 입니다.")
|
|
|
|
|
private String reqCnt = StringUtils.rightPad(StringUtils.EMPTY, 9, StringUtils.SPACE);
|
|
|
|
|
@Pattern(regexp = "^\\s{10}$|\\d{10}", message = "요청건수는 10자리(max 100)입니다")
|
|
|
|
|
private String reqCnt = StringUtils.rightPad(StringUtils.EMPTY, 10, StringUtils.SPACE);
|
|
|
|
|
public void setReqCnt(String reqCnt){
|
|
|
|
|
this.reqCnt = StringUtils.rightPad(nvl(reqCnt), 13, StringUtils.SPACE);
|
|
|
|
|
this.reqCnt = StringUtils.rightPad(nvl(reqCnt), 10, StringUtils.SPACE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -317,7 +318,7 @@ public class NiceCiHistoryDTO {
|
|
|
|
|
// return sb.toString();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
public static Response parse(String tgtStr) {
|
|
|
|
|
public static Response parse(String tgtString) {
|
|
|
|
|
final int repeatLength = 1150;
|
|
|
|
|
final int[] parseLength = {
|
|
|
|
|
10, // tr-code
|
|
|
|
@ -327,10 +328,10 @@ public class NiceCiHistoryDTO {
|
|
|
|
|
10, // 누적건수
|
|
|
|
|
10, // 응답건수
|
|
|
|
|
};
|
|
|
|
|
// FIXME: 인코딩확인후 적용
|
|
|
|
|
String tgtString = new String(tgtStr.getBytes(), StandardCharsets.UTF_8);
|
|
|
|
|
// FIXME: 인코딩확인후 필요시 사용
|
|
|
|
|
//String tgtString = new String(tgtStr.getBytes(), StandardCharsets.UTF_8);
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(tgtString) && tgtString.length() >= 1289) {
|
|
|
|
|
if (StringUtils.isNotBlank(tgtString) && NiceCiUtils.lengthKr(tgtString) >= 1290) {
|
|
|
|
|
Response nr = new Response();
|
|
|
|
|
int idx = 0;
|
|
|
|
|
nr.setTrCode(StringUtils.left(tgtString, parseLength[idx]));
|
|
|
|
@ -342,9 +343,6 @@ public class NiceCiHistoryDTO {
|
|
|
|
|
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++]);
|
|
|
|
|
|
|
|
|
@ -354,13 +352,13 @@ public class NiceCiHistoryDTO {
|
|
|
|
|
nr.setResCnt(StringUtils.left(tgtString, parseLength[idx]));
|
|
|
|
|
tgtString = tgtString.substring(parseLength[idx++]);
|
|
|
|
|
|
|
|
|
|
if(tgtString.length() % repeatLength == 0){
|
|
|
|
|
int repeat = tgtString.length() / repeatLength;
|
|
|
|
|
if(NiceCiUtils.lengthKr(tgtString) % repeatLength == 0){
|
|
|
|
|
int repeat = NiceCiUtils.lengthKr(tgtString) / repeatLength;
|
|
|
|
|
String finalTgtString = tgtString;
|
|
|
|
|
List<NiceCiResult> resResults = IntStream.range(0, repeat)
|
|
|
|
|
.mapToObj(i -> {
|
|
|
|
|
String currentString = finalTgtString.substring(i * repeatLength, (i + 1) * repeatLength);
|
|
|
|
|
return NiceCiResult.parse(currentString);
|
|
|
|
|
String currentString = NiceCiUtils.substringKr(finalTgtString, i * repeatLength);
|
|
|
|
|
return NiceCiResult.parseHistory(currentString);
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
nr.setNiceCiResults(resResults);
|
|
|
|
|