통계 수정

main
이범준 1 year ago
parent f2df91c63c
commit 3c2fb33e45

@ -21,6 +21,11 @@ public class StatQuery extends CmmnQuery {
*/ */
private String structureType; private String structureType;
/**
*
*/
private String refListYn;
/** /**
* () * ()
*/ */
@ -80,6 +85,15 @@ public class StatQuery extends CmmnQuery {
return self(); return self();
} }
public String getRefListYn() {
return ifEmpty(refListYn, () -> null);
}
public <T extends StatQuery> T setRefListYn(String refListYn) {
this.refListYn = refListYn;
return self();
}
public String getNamedNumberValueSeperator() { public String getNamedNumberValueSeperator() {
return ifEmpty(namedNumberValueSeperator, () -> null); return ifEmpty(namedNumberValueSeperator, () -> null);
} }

@ -127,6 +127,10 @@ public class StatBean extends AbstractComponent {
statItem.setNumberValue(numberValues); statItem.setNumberValue(numberValues);
if(ifEmpty(statQuery.getRefListYn(), () -> "").equals("Y")) {
statItem.setRefList(listByKey);
}
statItems.add(statItem); statItems.add(statItem);
} }
@ -349,10 +353,14 @@ public class StatBean extends AbstractComponent {
} }
/** . /** .
* @param statItems , regroupInfos * @param statItems , statQuery
* @return * @return
*/ */
public void regroupItem(List<StatItem> statItems, String[] regroupInfos) { public void regroupItem(List<StatItem> statItems, StatQuery statQuery) {
String refListYn = statQuery.getRefListYn();
String[] regroupInfos = statQuery.getRegroupInfos();
for(int i=0; i < regroupInfos.length; i++) { for(int i=0; i < regroupInfos.length; i++) {
@ -365,9 +373,11 @@ public class StatBean extends AbstractComponent {
newItem.setItemName(new String[]{targetCodeName}); newItem.setItemName(new String[]{targetCodeName});
int[] numberValues = null; int[] numberValues = null;
List<DataObject> refList = new ArrayList<DataObject>();
for(StatItem statItem : statItems) { for(StatItem statItem : statItems) {
if(Arrays.asList(sourceCodes).contains(statItem.getItemId()[0])) { if(Arrays.asList(sourceCodes).contains(statItem.getItemId()[0])) {
if(numberValues == null) { if(numberValues == null) {
numberValues = statItem.getNumberValue(); numberValues = statItem.getNumberValue();
} else { } else {
@ -375,11 +385,22 @@ public class StatBean extends AbstractComponent {
numberValues[j] += statItem.getNumberValue()[j]; numberValues[j] += statItem.getNumberValue()[j];
} }
} }
if(ifEmpty(refListYn, () -> "").equals("Y")
&& !ifEmpty(statItem.getRefList(), () -> "").equals("")
&& !statItem.getRefList().isEmpty()) {
refList.addAll(statItem.getRefList());
}
} }
} }
newItem.setNumberValue(numberValues); newItem.setNumberValue(numberValues);
if(ifEmpty(refListYn, () -> "").equals("Y")) {
newItem.setRefList(refList);
}
statItems.removeIf(item -> Arrays.asList(sourceCodes).contains(item.getItemId()[0])); statItems.removeIf(item -> Arrays.asList(sourceCodes).contains(item.getItemId()[0]));
statItems.add(newItem); statItems.add(newItem);

@ -197,7 +197,7 @@ public class StatServiceBean extends AbstractServiceBean implements StatService
//통계 항목 재그룹화 //통계 항목 재그룹화
if(statQuery.getRegroupInfos() != null){ 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); statBean.attachRatioValue(stat.getStatItems(), statQuery);
} }
//수치값 제목(건수, 금액, 비율 등)
if(numberValueLabel != null) { if(numberValueLabel != null) {
stat.setNumberValueLabel(numberValueLabel); stat.setNumberValueLabel(numberValueLabel);
} }

Loading…
Cancel
Save