광주은행 표준전문 관련 작업

This commit is contained in:
yunjy-hp
2025-12-09 13:46:56 +09:00
parent c5ad5f7b7d
commit 24958ac00e
6 changed files with 76 additions and 17 deletions
@@ -107,16 +107,22 @@ public class FlatReader implements StandardReader {
case StandardType.GROUP:
logger.debug("@GROUP name={}, getLength={}, getRefPath={}, getRefValue=[{}]"
, currentItem.getName(), currentItem.getLength(), currentItem.getRefPath(), currentItem.getRefValue());
if( currentItem.getSize() == 0
&& StringUtils.isNotBlank(currentItem.getRefPath())
if( currentItem.getSize() == 0
&& StringUtils.isNotBlank(currentItem.getRefPath())
&& StringUtils.isNotBlank(currentItem.getRefValue()) ) {
String refItemValue = itemMap.get(currentItem.getRefPath());
//2024.08.07 아래추가로직은 Group 하위의 field 값에 따라서
//파싱을 해야 될경우 추가
String refItemValue ="";
if (currentItem.getRefPath().startsWith(fieldName)){
refItemValue = getRefItemValue(currentItem.getRefPath(), fieldName, srcbytes, currentItem, start);
}else{
refItemValue = itemMap.get(currentItem.getRefPath());
}
logger.debug("@GROUP name={}, getRefPath={}, refItemValue=[{}], getRefValue=[{}]"
, currentItem.getName(), currentItem.getRefPath(), refItemValue, currentItem.getRefValue());
if(refItemValue != null) refItemValue = refItemValue.trim();
/*
* 값의 경우의수 NR,ER,""(blank)
* ER이 아닐경우 표현하고 싶어서 ! 를 추가했음
@@ -284,6 +290,26 @@ public class FlatReader implements StandardReader {
}
return result;
}
private String getRefItemValue(String orgRef, String fieldName, byte[] srcbytes , StandardItem currentItem ,int start ){
String currentFieldName = orgRef.replace(fieldName+".","");
ArrayList<StandardItem> childList = currentItem.getChildsList();
String refItemValue ="";
for(StandardItem item : childList) {
if (currentFieldName.indexOf(".") < 0) {
byte[] tempValue = null;
if (orgRef.equals(fieldName + "." + item.getName())) {
tempValue = cut(fieldName, srcbytes, start, item.getLength());
return new String(tempValue);
}else{
start = start + item.getLength();
}
} else {
return getRefItemValue(orgRef, fieldName+"."+item.getName(), srcbytes, item, start);
}
}
return refItemValue;
}
// public static void main(String[] args) {
// }
}