From 9c640066a6b1f48f0a37ef93932816059fea3831 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 3 Nov 2023 18:22:10 +0900 Subject: [PATCH] =?UTF-8?q?=ED=86=B5=EA=B3=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cokr/xit/fims/stat/NumberValueInfo.java | 31 +++++++ .../java/cokr/xit/fims/stat/StatQuery.java | 77 ++++----------- .../xit/fims/stat/service/bean/StatBean.java | 93 ++++++------------- .../stat/service/bean/StatServiceBean.java | 66 ++++++------- .../webapp/WEB-INF/jsp/include/dashboard.jsp | 86 ++++++++++++----- 5 files changed, 172 insertions(+), 181 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/stat/NumberValueInfo.java diff --git a/src/main/java/cokr/xit/fims/stat/NumberValueInfo.java b/src/main/java/cokr/xit/fims/stat/NumberValueInfo.java new file mode 100644 index 00000000..a18cd369 --- /dev/null +++ b/src/main/java/cokr/xit/fims/stat/NumberValueInfo.java @@ -0,0 +1,31 @@ +package cokr.xit.fims.stat; + +public class NumberValueInfo { + + /** + * 복합 수치 값 구분자 + */ + private String numberValueSeperator; + + /** + * 수치값 집계 유형(count 건수, sum 합계, ratio 비율) + */ + private String aggregateType; + + public String getNumberValueSeperator(){ + return this.numberValueSeperator; + } + + public void setNumberValueSeperator(String numberValueSeperator){ + this.numberValueSeperator = numberValueSeperator; + } + + public String getAggregateType(){ + return this.aggregateType; + } + + public void setAggregateType(String aggregateType){ + this.aggregateType = aggregateType; + } + +} diff --git a/src/main/java/cokr/xit/fims/stat/StatQuery.java b/src/main/java/cokr/xit/fims/stat/StatQuery.java index d9e1d176..5fbd028d 100644 --- a/src/main/java/cokr/xit/fims/stat/StatQuery.java +++ b/src/main/java/cokr/xit/fims/stat/StatQuery.java @@ -34,19 +34,9 @@ public class StatQuery extends CmmnQuery { private List groupInfoList; /** - * 항목 분류 방법(컬럼명) + * 수치값 정보 */ - //private String[] groupColName; - - /** - * 항목 분류 방법 추가 옵션 - */ - //private String[] categorizationAddOption; - - /** - * 항목명 변환(코드그룹ID) - */ - //private String[] categoryNameConverter; + private List numberValueInfoList; /** * 고정 항목 ID (항목이 단일키일 경우) @@ -59,14 +49,9 @@ public class StatQuery extends CmmnQuery { private String namedNumberValueSeperator; /** - * 복합 수치 값 구분자 + * 전역 집계 형식 */ - private String[] compositeNumberValueSeperator; - - /** - * 수치값 집계 유형(count 건수, sum 합계, ratio 비율) - */ - private String[] aggregateType; + private String globalAggregate; /** * 표기할 소수점 자릿수 @@ -115,6 +100,16 @@ public class StatQuery extends CmmnQuery { return self(); } + public List getNumberValueInfoList() { + return this.numberValueInfoList; + } + + public T setNumberValueInfoList(List numberValueInfoList) { + this.numberValueInfoList = numberValueInfoList; + return self(); + } + + public String getNamedNumberValueSeperator() { return ifEmpty(namedNumberValueSeperator, () -> null); } @@ -124,39 +119,12 @@ public class StatQuery extends CmmnQuery { return self(); } - //public String[] getGroupColName() { - //return ifEmpty(groupColName, () -> null); - //} - - //public T setGroupColName(String... groupColName) { - //this.groupColName = groupColName; - //return self(); - //} - - //public String[] getCategorizationAddOption() { - //return ifEmpty(categorizationAddOption, () -> null); - //} - - //public T setCategorizationAddOption(String... categorizationAddOption) { - //this.categorizationAddOption = categorizationAddOption; - //return self(); - //} - - //public String[] getCategoryNameConverter() { - //return ifEmpty(categoryNameConverter, () -> null); - //} - - //public T setCategoryNameConverter(String... categoryNameConverter) { - //this.categoryNameConverter = categoryNameConverter; - //return self(); - //} - - public String[] getAggregateType() { - return ifEmpty(aggregateType, () -> null); + public String getGlobalAggregate() { + return ifEmpty(globalAggregate, () -> null); } - public T setAggregateType(String... aggregateType) { - this.aggregateType = aggregateType; + public T setGlobalAggregate(String globalAggregate) { + this.globalAggregate = globalAggregate; return self(); } @@ -169,15 +137,6 @@ public class StatQuery extends CmmnQuery { return self(); } - public String[] getCompositeNumberValueSeperator() { - return ifEmpty(compositeNumberValueSeperator, () -> null); - } - - public T setCompositeNumberValueSeperator(String... compositeNumberValueSeperator) { - this.compositeNumberValueSeperator = compositeNumberValueSeperator; - return self(); - } - public String[] getFixedItemId() { return ifEmpty(fixedItemId, () -> 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 3df2c38d..da0ff664 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 @@ -20,6 +20,7 @@ import cokr.xit.fims.cmmn.CmmnQuery; import cokr.xit.fims.cmmn.CodeConverter; import cokr.xit.fims.stat.CodeSubsetInfo; import cokr.xit.fims.stat.GroupInfo; +import cokr.xit.fims.stat.NumberValueInfo; import cokr.xit.fims.stat.Stat; import cokr.xit.fims.stat.StatItem; import cokr.xit.fims.stat.StatQuery; @@ -67,41 +68,6 @@ public class StatBean extends AbstractComponent { Stat stat = new Stat(); - //통계 요청 설정 - int compositeSize = 0; - - String[] compositeNumberValueSeperator = statQuery.getCompositeNumberValueSeperator(); - String[] aggregateType = statQuery.getAggregateType(); - - if(compositeNumberValueSeperator == null && aggregateType == null) { - compositeSize = 1; - compositeNumberValueSeperator = new String[] {""}; - aggregateType = new String[] {"count"}; - } else if(compositeNumberValueSeperator != null && aggregateType == null) { - compositeSize = compositeNumberValueSeperator.length; - aggregateType = new String[compositeSize]; - } else if(compositeNumberValueSeperator == null && aggregateType != null) { - compositeSize = aggregateType.length; - compositeNumberValueSeperator = new String[compositeSize]; - } else { - if(compositeNumberValueSeperator.length > aggregateType.length) { - compositeSize = compositeNumberValueSeperator.length; - } else { - compositeSize = aggregateType.length; - } - } - - for(int i=0; i < compositeSize; i++) { - if(compositeNumberValueSeperator[i] == null) { - compositeNumberValueSeperator[i] = ""; - } - if(aggregateType[i] == null || aggregateType[i].equals("")) { - aggregateType[i] = "count"; - } - } - - statQuery.setAggregateType(aggregateType); - statQuery.setCompositeNumberValueSeperator(compositeNumberValueSeperator); //통계 항목별 그룹핑 Map> group = this.grouping(queryResult, statQuery); @@ -149,13 +115,6 @@ public class StatBean extends AbstractComponent { List groupInfoList = statQuery.getGroupInfoList(); - //String[] categorizations = statQuery.getGroupColName(); - - //String[] addOptions = statQuery.getCategorizationAddOption(); - - //String[] categoryNameConverters = statQuery.getCategoryNameConverter(); - - List subsetInfoList = statQuery.getCodeSubsetInfoList(); Map> group = queryResult.stream() @@ -258,11 +217,10 @@ public class StatBean extends AbstractComponent { */ public int[] extractNumberValue(List listByKey, StatQuery statQuery) { - String[] compositeNumberValueSeperator = statQuery.getCompositeNumberValueSeperator(); - String[] aggregateType = statQuery.getAggregateType(); + List numberValueInfoList = statQuery.getNumberValueInfoList(); - int[] aggregateArr = new int[compositeNumberValueSeperator.length]; - for(int i=0; i < compositeNumberValueSeperator.length; i++) { + int[] aggregateArr = new int[numberValueInfoList.size()]; + for(int i=0; i < numberValueInfoList.size(); i++) { aggregateArr[i] = 0; } @@ -273,29 +231,31 @@ public class StatBean extends AbstractComponent { for(int j=0; j < aggregateArr.length; j++) { - String condition = compositeNumberValueSeperator[j]; + String condition = numberValueInfoList.get(j).getNumberValueSeperator(); + String aggregateType = numberValueInfoList.get(j).getAggregateType(); - if(condition.contains("=")) { + if(!condition.equals("")) { - String conditionColumn = condition.split("=")[0]; - String conditionColumnValue = dataObject.string(conditionColumn); - String conditionValue = condition.split("=")[1]; + if(condition.contains("=")) { - if(conditionColumnValue.equals("")) { - continue; - } + String conditionColumn = condition.split("=")[0]; + String conditionColumnValue = dataObject.string(conditionColumn); + String conditionValue = condition.split("=")[1]; - if(conditionColumn.endsWith("_DT") && conditionValue.length() == 8) { - conditionColumnValue = conditionColumnValue.substring(0,8); - } + if(conditionColumn.endsWith("_DT") && conditionValue.length() == 8) { + conditionColumnValue = conditionColumnValue.substring(0,8); + } - if(!conditionColumnValue.equals(conditionValue)) { - continue; + if(!conditionColumnValue.equals(conditionValue)) { + continue; + } } + } - if(aggregateType[j].startsWith("sum=")) { - aggregateArr[j] += dataObject.number(aggregateType[j].split("=")[1]).intValue(); + + if(aggregateType.startsWith("sum=")) { + aggregateArr[j] += dataObject.number(aggregateType.split("=")[1]).intValue(); } else { aggregateArr[j] += 1; } @@ -396,15 +356,18 @@ public class StatBean extends AbstractComponent { int decimalPoint = statQuery.getDecimalPoint(); - String[] aggregateTypes = statQuery.getAggregateType(); + List numberValueInfoList = statQuery.getNumberValueInfoList(); for(StatItem statItem : statItems) { - for(int i = 0; i < aggregateTypes.length ; i++) { + for(int i = 0; i < numberValueInfoList.size(); i++) { + NumberValueInfo numberValueInfo = numberValueInfoList.get(i); + + String aggregateType = numberValueInfo.getAggregateType(); - if(aggregateTypes[i].startsWith("ratio=")) { + if(aggregateType.startsWith("ratio=")) { - int refIndex = Integer.parseInt(aggregateTypes[i].split("=")[1]); + int refIndex = Integer.parseInt(aggregateType.split("=")[1]); int totValue = statItem.getNumberValue()[refIndex]; if(totValue == 0) { 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 d0ee2517..e7716f99 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 @@ -2,7 +2,6 @@ package cokr.xit.fims.stat.service.bean; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Map; @@ -20,6 +19,7 @@ import cokr.xit.fims.excl.service.OpnnSbmsnService; import cokr.xit.fims.sndb.SndbQuery; import cokr.xit.fims.sndb.service.SndngService; import cokr.xit.fims.stat.GroupInfo; +import cokr.xit.fims.stat.NumberValueInfo; import cokr.xit.fims.stat.Stat; import cokr.xit.fims.stat.StatQuery; import cokr.xit.fims.stat.service.StatService; @@ -66,49 +66,42 @@ public class StatServiceBean extends AbstractServiceBean implements StatService if(statQuery.getNamedNumberValueSeperator().equals("completeAndTotal")) { //완료자료 및 전체자료 - String[] compositeNumberValueSeperator = new String[] {"COMPLETE_YN=Y", ""}; - statQuery.setCompositeNumberValueSeperator(compositeNumberValueSeperator); + String seperator1 = "COMPLETE_YN=Y"; + String seperator2 = ""; - if(statQuery.getAggregateType() == null) { - String[] aggregateType = new String[] {"count", "count"}; - statQuery.setAggregateType(aggregateType); - } - - daySetting = true; + String globalAggregate = statQuery.getGlobalAggregate(); + String aggregate1 = globalAggregate; + String aggregate2 = globalAggregate; - numberValueLabel = new String[] {"처리건수","전체건수"}; + List numberValueInfoList = new ArrayList(); + NumberValueInfo col1 = new NumberValueInfo(); + col1.setNumberValueSeperator(seperator1); + col1.setAggregateType(aggregate1); + numberValueInfoList.add(col1); + NumberValueInfo col2 = new NumberValueInfo(); + col2.setNumberValueSeperator(seperator2); + col2.setAggregateType(aggregate2); + numberValueInfoList.add(col2); + statQuery.setNumberValueInfoList(numberValueInfoList); - } else if(statQuery.getNamedNumberValueSeperator().equals("lastFewDays")) { - - String[] compositeNumberValueSeperator = new String[dayRange]; - for(int i=0; i"").equals("")) { - defaultType = "count"; - } + String globalAggregate = statQuery.getGlobalAggregate(); - for(int i=0; i numberValueInfoList = new ArrayList(); - statQuery.setAggregateType(aggregateType); + for(int i=0; i