diff --git a/src/main/java/cokr/xit/fims/stat/StatQuery.java b/src/main/java/cokr/xit/fims/stat/StatQuery.java index 1d9e6cbe..7bf79a1f 100644 --- a/src/main/java/cokr/xit/fims/stat/StatQuery.java +++ b/src/main/java/cokr/xit/fims/stat/StatQuery.java @@ -21,6 +21,11 @@ public class StatQuery extends CmmnQuery { */ private String structureType; + /** + * 참조 리스트 추가 여부 + */ + private String refListYn; + /** * 항목 분류 방법(컬럼명) */ @@ -80,6 +85,15 @@ public class StatQuery extends CmmnQuery { return self(); } + public String getRefListYn() { + return ifEmpty(refListYn, () -> null); + } + + public T setRefListYn(String refListYn) { + this.refListYn = refListYn; + return self(); + } + public String getNamedNumberValueSeperator() { return ifEmpty(namedNumberValueSeperator, () -> null); } diff --git a/src/main/java/cokr/xit/fims/stat/service/bean/StatBean.java b/src/main/java/cokr/xit/fims/stat/service/bean/StatBean.java index 560041e7..582e8dc1 100644 --- a/src/main/java/cokr/xit/fims/stat/service/bean/StatBean.java +++ b/src/main/java/cokr/xit/fims/stat/service/bean/StatBean.java @@ -127,6 +127,10 @@ public class StatBean extends AbstractComponent { statItem.setNumberValue(numberValues); + if(ifEmpty(statQuery.getRefListYn(), () -> "").equals("Y")) { + statItem.setRefList(listByKey); + } + statItems.add(statItem); } @@ -349,10 +353,14 @@ public class StatBean extends AbstractComponent { } /** 통계의 일부 항목을 합쳐 새 범주로 묶는다. - * @param statItems 통계 항목 목록, regroupInfos 재그룹화 정보 + * @param statItems 통계 항목 목록, statQuery 통계 요청 * @return */ - public void regroupItem(List statItems, String[] regroupInfos) { + public void regroupItem(List statItems, StatQuery statQuery) { + + String refListYn = statQuery.getRefListYn(); + + String[] regroupInfos = statQuery.getRegroupInfos(); for(int i=0; i < regroupInfos.length; i++) { @@ -365,9 +373,11 @@ public class StatBean extends AbstractComponent { newItem.setItemName(new String[]{targetCodeName}); int[] numberValues = null; + List refList = new ArrayList(); for(StatItem statItem : statItems) { if(Arrays.asList(sourceCodes).contains(statItem.getItemId()[0])) { + if(numberValues == null) { numberValues = statItem.getNumberValue(); } else { @@ -375,11 +385,22 @@ public class StatBean extends AbstractComponent { numberValues[j] += statItem.getNumberValue()[j]; } } + + if(ifEmpty(refListYn, () -> "").equals("Y") + && !ifEmpty(statItem.getRefList(), () -> "").equals("") + && !statItem.getRefList().isEmpty()) { + refList.addAll(statItem.getRefList()); + } + } } newItem.setNumberValue(numberValues); + if(ifEmpty(refListYn, () -> "").equals("Y")) { + newItem.setRefList(refList); + } + statItems.removeIf(item -> Arrays.asList(sourceCodes).contains(item.getItemId()[0])); statItems.add(newItem); diff --git a/src/main/java/cokr/xit/fims/stat/service/bean/StatServiceBean.java b/src/main/java/cokr/xit/fims/stat/service/bean/StatServiceBean.java index 3214152b..86b799e0 100644 --- a/src/main/java/cokr/xit/fims/stat/service/bean/StatServiceBean.java +++ b/src/main/java/cokr/xit/fims/stat/service/bean/StatServiceBean.java @@ -197,7 +197,7 @@ public class StatServiceBean extends AbstractServiceBean implements StatService //통계 항목 재그룹화 if(statQuery.getRegroupInfos() != null){ - statBean.regroupItem(stat.getStatItems(), statQuery.getRegroupInfos()); + statBean.regroupItem(stat.getStatItems(), statQuery); } //비율 계산 @@ -211,6 +211,7 @@ public class StatServiceBean extends AbstractServiceBean implements StatService statBean.attachRatioValue(stat.getStatItems(), statQuery); } + //수치값 제목(건수, 금액, 비율 등) if(numberValueLabel != null) { stat.setNumberValueLabel(numberValueLabel); }