From 2573ccd1d302feb03a94aabbc3678bbd98cb0462 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 3 Nov 2023 16:16:13 +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 --- .../java/cokr/xit/fims/stat/GroupInfo.java | 34 ++++ .../java/cokr/xit/fims/stat/StatQuery.java | 62 +++++--- .../xit/fims/stat/service/bean/StatBean.java | 66 +++++--- .../stat/service/bean/StatServiceBean.java | 9 +- .../xit/fims/stat/web/Stat01Controller.java | 17 +- .../webapp/WEB-INF/jsp/include/dashboard.jsp | 146 +++++++++++++----- 6 files changed, 238 insertions(+), 96 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/stat/GroupInfo.java diff --git a/src/main/java/cokr/xit/fims/stat/GroupInfo.java b/src/main/java/cokr/xit/fims/stat/GroupInfo.java new file mode 100644 index 00000000..70516ef8 --- /dev/null +++ b/src/main/java/cokr/xit/fims/stat/GroupInfo.java @@ -0,0 +1,34 @@ +package cokr.xit.fims.stat; + +public class GroupInfo { + + private String groupColName; + + private String categoryNameConverter; + + private String categorizationAddOption; + + public String getGroupColName(){ + return this.groupColName; + } + + public void setGroupColName(String groupColName){ + this.groupColName = groupColName; + } + + public String getCategoryNameConverter(){ + return this.categoryNameConverter; + } + + public void setCategoryNameConverter(String categoryNameConverter){ + this.categoryNameConverter = categoryNameConverter; + } + + public String getCategorizationAddOption(){ + return this.categorizationAddOption; + } + + public void setCategorizationAddOption(String categorizationAddOption){ + this.categorizationAddOption = categorizationAddOption; + } +} diff --git a/src/main/java/cokr/xit/fims/stat/StatQuery.java b/src/main/java/cokr/xit/fims/stat/StatQuery.java index 301dc882..d9e1d176 100644 --- a/src/main/java/cokr/xit/fims/stat/StatQuery.java +++ b/src/main/java/cokr/xit/fims/stat/StatQuery.java @@ -28,20 +28,25 @@ public class StatQuery extends CmmnQuery { */ private String refListYn; + /** + * 항목 정보 + */ + private List groupInfoList; + /** * 항목 분류 방법(컬럼명) */ - private String[] categorization; + //private String[] groupColName; /** * 항목 분류 방법 추가 옵션 */ - private String[] categorizationAddOption; + //private String[] categorizationAddOption; /** * 항목명 변환(코드그룹ID) */ - private String[] categoryNameConverter; + //private String[] categoryNameConverter; /** * 고정 항목 ID (항목이 단일키일 경우) @@ -101,6 +106,15 @@ public class StatQuery extends CmmnQuery { return self(); } + public List getGroupInfoList() { + return this.groupInfoList; + } + + public T setGroupInfoList(List groupInfoList) { + this.groupInfoList = groupInfoList; + return self(); + } + public String getNamedNumberValueSeperator() { return ifEmpty(namedNumberValueSeperator, () -> null); } @@ -110,32 +124,32 @@ public class StatQuery extends CmmnQuery { return self(); } - public String[] getCategorization() { - return ifEmpty(categorization, () -> null); - } + //public String[] getGroupColName() { + //return ifEmpty(groupColName, () -> null); + //} - public T setCategorization(String... categorization) { - this.categorization = categorization; - return self(); - } + //public T setGroupColName(String... groupColName) { + //this.groupColName = groupColName; + //return self(); + //} - public String[] getCategorizationAddOption() { - return ifEmpty(categorizationAddOption, () -> null); - } + //public String[] getCategorizationAddOption() { + //return ifEmpty(categorizationAddOption, () -> null); + //} - public T setCategorizationAddOption(String... categorizationAddOption) { - this.categorizationAddOption = categorizationAddOption; - return self(); - } + //public T setCategorizationAddOption(String... categorizationAddOption) { + //this.categorizationAddOption = categorizationAddOption; + //return self(); + //} - public String[] getCategoryNameConverter() { - return ifEmpty(categoryNameConverter, () -> null); - } + //public String[] getCategoryNameConverter() { + //return ifEmpty(categoryNameConverter, () -> null); + //} - public T setCategoryNameConverter(String... categoryNameConverter) { - this.categoryNameConverter = categoryNameConverter; - return self(); - } + //public T setCategoryNameConverter(String... categoryNameConverter) { + //this.categoryNameConverter = categoryNameConverter; + //return self(); + //} public String[] getAggregateType() { return ifEmpty(aggregateType, () -> 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 1a61be8b..3df2c38d 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 @@ -19,6 +19,7 @@ import cokr.xit.base.code.CommonCode; 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.Stat; import cokr.xit.fims.stat.StatItem; import cokr.xit.fims.stat.StatQuery; @@ -145,11 +146,15 @@ public class StatBean extends AbstractComponent { * @return 통계 항목별로 그룹핑된 목록 */ public Map> grouping(List queryResult, StatQuery statQuery){ - String[] categorizations = statQuery.getCategorization(); - String[] addOptions = statQuery.getCategorizationAddOption(); + List groupInfoList = statQuery.getGroupInfoList(); + + //String[] categorizations = statQuery.getGroupColName(); + + //String[] addOptions = statQuery.getCategorizationAddOption(); + + //String[] categoryNameConverters = statQuery.getCategoryNameConverter(); - String[] categoryNameConverters = statQuery.getCategoryNameConverter(); List subsetInfoList = statQuery.getCodeSubsetInfoList(); @@ -158,18 +163,22 @@ public class StatBean extends AbstractComponent { Collectors.groupingBy( (item) -> { String result = ""; - for(int i = 0; i < categorizations.length; i++) { + for(int i = 0; i < groupInfoList.size(); i++) { + GroupInfo groupInfo = groupInfoList.get(i); + if(i != 0) { result += ","; } - String colValue = item.string(categorizations[i]); + String colValue = item.string(groupInfo.getGroupColName()); + + if(!ifEmpty(groupInfo.getCategorizationAddOption(), ()-> "").equals("")) { + String addOption = groupInfo.getCategorizationAddOption(); - if(addOptions != null) { - if(addOptions[i].equals("YYYY")) { //연도별 + if(addOption.equals("YYYY")) { //연도별 result += colValue.substring(0,4); - } else if(addOptions[i].equals("YYYYMM")) { //연월별 + } else if(addOption.equals("YYYYMM")) { //연월별 result += colValue.substring(0,6); - } else if(addOptions[i].equals("DAY_OF_WEEK")) { //요일별 + } else if(addOption.equals("DAY_OF_WEEK")) { //요일별 int y = Integer.parseInt(colValue.substring(0,4)); int m = Integer.parseInt(colValue.substring(4,6)); int d = Integer.parseInt(colValue.substring(6,8)); @@ -177,7 +186,7 @@ public class StatBean extends AbstractComponent { DayOfWeek dayOfWeek = date.getDayOfWeek(); String dow = dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN); result += dow; - } else if(addOptions[i].equals("HH")) { //시간대별 + } else if(addOption.equals("HH")) { //시간대별 if(colValue.length() == 14) { result += colValue.substring(8,10); } else { @@ -188,13 +197,14 @@ public class StatBean extends AbstractComponent { } } else { - if(categorizations[i].endsWith("_CD") - && categoryNameConverters != null && categoryNameConverters[i].startsWith("code=") + if(groupInfo.getGroupColName().endsWith("_CD") + && groupInfo.getCategoryNameConverter() != null + && groupInfo.getCategoryNameConverter().startsWith("code=") && subsetInfoList != null && !subsetInfoList.isEmpty() ) { for(CodeSubsetInfo subsetInfo : subsetInfoList) { - if(subsetInfo.getSourceGroup().equals(categoryNameConverters[i].split("=")[1])) { + if(subsetInfo.getSourceGroup().equals(groupInfo.getCategoryNameConverter().split("=")[1])) { if(Arrays.asList(subsetInfo.getSourceCodes()).contains(colValue)) { colValue = subsetInfo.getTargetCode(); } @@ -307,11 +317,11 @@ public class StatBean extends AbstractComponent { CodeConverter codeConverter = new CodeConverter(allCode); - String[] nameConverters = statQuery.getCategoryNameConverter(); + List groupInfoList = statQuery.getGroupInfoList(); int taskSeCdIndex = -1; - for(int i=0; i < nameConverters.length; i++) { - if(nameConverters[i].equals("code=FIM054")) { + for(int i=0; i < groupInfoList.size(); i++) { + if(groupInfoList.get(i).getCategoryNameConverter().equals("code=FIM054")) { taskSeCdIndex = i; } } @@ -323,7 +333,10 @@ public class StatBean extends AbstractComponent { for(int i=0; i < compositeItemId.length ;i++) { - if(nameConverters[i].equals("") || nameConverters[i].equals("plain")) { //일반텍스트 + GroupInfo groupInfo = groupInfoList.get(i); + String converter = groupInfo.getCategoryNameConverter(); + + if(converter.equals("") || converter.equals("plain")) { //일반텍스트 compositeItemName[i] = compositeItemId[i]; continue; } @@ -331,13 +344,13 @@ public class StatBean extends AbstractComponent { String itemName = ""; - if(nameConverters[i].startsWith("code=")){ //공통코드 + if(converter.startsWith("code=")){ //공통코드 - itemName = codeConverter.codeToValue(nameConverters[i].split("=")[1], compositeItemId[i]); + itemName = codeConverter.codeToValue(converter.split("=")[1], compositeItemId[i]); - } else if(nameConverters[i].startsWith("otherCode=")) { //비공통코드 + } else if(converter.startsWith("otherCode=")) { //비공통코드 - if(nameConverters[i].equals("otherCode=VLTN_CD")) { + if(converter.equals("otherCode=VLTN_CD")) { String taskSeCd = ""; if(taskSeCdIndex != -1) { @@ -351,19 +364,22 @@ public class StatBean extends AbstractComponent { } itemName = codeConverter.vltnCdToValue(taskSeCd, compositeItemId[i]); - } else if(nameConverters[i].equals("otherCode=VLTN_ID")) { + } else if(converter.equals("otherCode=VLTN_ID")) { itemName = codeConverter.vltnIdToValue(compositeItemId[i]); - } else if(nameConverters[i].equals("otherCode=SGG_CD")) { + } else if(converter.equals("otherCode=SGG_CD")) { itemName = codeConverter.sggCodeToValue(compositeItemId[i]); - } else if(nameConverters[i].equals("otherCode=DEPT_CD")) { + } else if(converter.equals("otherCode=DEPT_CD")) { itemName = codeConverter.deptCodeToValue(compositeItemId[i]); - } else if(nameConverters[i].equals("otherCode=USER_ID")) { + } else if(converter.equals("otherCode=USER_ID")) { itemName = codeConverter.userIdToUserName(compositeItemId[i]); } } compositeItemName[i] = itemName; + + + } statItem.setItemName(compositeItemName); 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 0454ffa8..d0ee2517 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 @@ -19,6 +19,7 @@ import cokr.xit.fims.excl.LevyExclQuery; 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.Stat; import cokr.xit.fims.stat.StatQuery; import cokr.xit.fims.stat.service.StatService; @@ -121,9 +122,13 @@ public class StatServiceBean extends AbstractServiceBean implements StatService } String domain = ""; - String[] categorizations = statQuery.getCategorization(); - for(String categorization : categorizations) { + List GroupInfoList = statQuery.getGroupInfoList(); + + for(GroupInfo groupInfo : GroupInfoList) { + + String categorization = groupInfo.getGroupColName(); + switch(categorization) { case "CRDN_SE_CD" : case "등록대상,이첩대상" : diff --git a/src/main/java/cokr/xit/fims/stat/web/Stat01Controller.java b/src/main/java/cokr/xit/fims/stat/web/Stat01Controller.java index d3aacbcf..a0c764fc 100644 --- a/src/main/java/cokr/xit/fims/stat/web/Stat01Controller.java +++ b/src/main/java/cokr/xit/fims/stat/web/Stat01Controller.java @@ -15,6 +15,7 @@ import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.crdn.dao.GlobalStngMapper; import cokr.xit.fims.stat.CodeSubsetInfo; +import cokr.xit.fims.stat.GroupInfo; import cokr.xit.fims.stat.Stat; import cokr.xit.fims.stat.StatQuery; import cokr.xit.fims.stat.service.StatService; @@ -60,15 +61,18 @@ public class Stat01Controller extends ApplicationController { String sggCd = globalStngMapper.selectSggCd(curDeptCode); statQuery.setSggCd(sggCd); - String[] categoryNameConverter = statQuery.getCategoryNameConverter(); + List groupInfoList = statQuery.getGroupInfoList(); List codeGroup = new ArrayList(); - for(int i=0; i < categoryNameConverter.length; i++) { - if(categoryNameConverter[i].startsWith("code=")) { - codeGroup.add(categoryNameConverter[i].split("=")[1]); - } else if(categoryNameConverter[i].startsWith("otherCode=")) { - if(categoryNameConverter[i].equals("otherCode=VLTN_CD")) { + for(int i=0; i < groupInfoList.size(); i++) { + GroupInfo groupInfo = groupInfoList.get(i); + String converter = groupInfo.getCategoryNameConverter(); + if(converter.startsWith("code=")) { + codeGroup.add(converter.split("=")[1]); + } else if(converter.startsWith("otherCode=")) { + + if(converter.equals("otherCode=VLTN_CD")) { codeGroup.add("FIM054"); codeGroup.add("FIM004"); codeGroup.add("FIM005"); @@ -80,6 +84,7 @@ public class Stat01Controller extends ApplicationController { } } + Map> commonCodes = new HashMap>(); if(codeGroup.size() > 0) { commonCodes = getCodesOf(codeGroup.toArray(new String[codeGroup.size()])); diff --git a/src/main/webapp/WEB-INF/jsp/include/dashboard.jsp b/src/main/webapp/WEB-INF/jsp/include/dashboard.jsp index c8ab85bd..537da745 100644 --- a/src/main/webapp/WEB-INF/jsp/include/dashboard.jsp +++ b/src/main/webapp/WEB-INF/jsp/include/dashboard.jsp @@ -196,18 +196,32 @@ function fnMakeSkeleton(){ //통계 데이터 조회(여러 건) function fnLoadStatisticsDatas(){ - var queryParam = {}; + var mergedQuery = {}; + + var groupInfoList = []; var codeSubsetInfoList = []; - var queryInQuery = {}; + + var defaultQuery = {}; + var queryInQuery1 = {}; + var queryInQuery2 = {}; + var queryInQuery3 = {}; //단속구분별 전체/완료 건수 - queryParam = { + defaultQuery = { structureType : "aggregate", - categorization : ["CRDN_SE_CD"], - categoryNameConverter : ["code=FIM002"], fixedItemId : ["01","02","minwon","dobo"], namedNumberValueSeperator : "completeAndTotal" }; + + groupInfoList = [ + { + groupColName : "CRDN_SE_CD", + categoryNameConverter : "code=FIM002" + } + ]; + + queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList"); + codeSubsetInfoList = [ { sourceGroup : "FIM002", @@ -223,41 +237,62 @@ function fnLoadStatisticsDatas(){ } ]; - queryInQuery = fnJsonArrayToFormData(codeSubsetInfoList, "codeSubsetInfoList"); + queryInQuery3 = fnJsonArrayToFormData(codeSubsetInfoList, "codeSubsetInfoList"); - queryParam = {...queryParam, ...queryInQuery}; + mergedQuery = {...defaultQuery, ...queryInQuery1, ...queryInQuery3}; - fnLoadStatisticsData(queryParam, "card1", "progressAndTotal"); + fnLoadStatisticsData(mergedQuery, "card1", "progressAndTotal"); //초기자료처리별 전체/완료건수 - queryParam = { + defaultQuery = { structureType : "aggregate", - categorization : ["등록대상이첩대상구분"], - categoryNameConverter : ["code=FIM999"], fixedItemId : ["등록대상","이첩대상"], namedNumberValueSeperator : "completeAndTotal" }; - //fnLoadStatisticsData(queryParam, "card2", "progressAndTotal"); + + groupInfoList = [ + groupColName : "등록대상이첩대상구분", + categoryNameConverter : "code=FIM999" + ]; + + queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList"); + + mergedQuery = {...defaultQuery, ...queryInQuery1 }; + + //fnLoadStatisticsData(mergedQuery, "card2", "progressAndTotal"); //발송문서별 전체/완료 건수 - queryParam = { + defaultQuery = { structureType : "aggregate", - categorization : ["SNDNG_SE_CD"], - categoryNameConverter : ["code=FIM047"], fixedItemId : ["01", "02", "03"], namedNumberValueSeperator : "completeAndTotal" }; - //fnLoadStatisticsData(queryParam, "card3" , "progressAndTotal"); + + groupInfoList = [ + groupColName : "SNDNG_SE_CD", + categoryNameConverter : "code=FIM047" + ]; + + queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList"); + + mergedQuery = {...defaultQuery, ...queryInQuery1 }; + + //fnLoadStatisticsData(mergedQuery, "card3" , "progressAndTotal"); //의견진술자료상태 - queryParam = { + defaultQuery = { structureType : "aggregate", - categorization : ["OPNN_SBMSN_STTS_CD"], - categoryNameConverter : ["code=FIM031"], fixedItemId : ["00", "acceptOrNonAccept", "03"], namedNumberValueSeperator : "completeAndTotal" }; + groupInfoList = [ + groupColName : "OPNN_SBMSN_STTS_CD", + categoryNameConverter : "code=FIM031" + ]; + + queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList"); + codeSubsetInfoList = [ { sourceGroup : "FIM031", @@ -267,23 +302,30 @@ function fnLoadStatisticsDatas(){ } ]; - queryInQuery = fnJsonArrayToFormData(codeSubsetInfoList, "codeSubsetInfoList"); + queryInQuery3 = fnJsonArrayToFormData(codeSubsetInfoList, "codeSubsetInfoList"); - queryParam = {...queryParam, ...queryInQuery}; + mergedQuery = {...defaultQuery, ...queryInQuery1, ...queryInQuery3}; - //fnLoadStatisticsData(queryParam, "card4" , "progressAndTotal"); + //fnLoadStatisticsData(mergedQuery, "card4" , "progressAndTotal"); //단속구분별 최근n일 건수 - queryParam = { + defaultQuery = { structureType : "aggregate", - categorization : ["CRDN_SE_CD"], - categoryNameConverter : ["code=FIM002"], fixedItemId : ["01","02","dobo","minwon"], namedNumberValueSeperator : "lastFewDays", dayRange : 15, dayColumn : "CRDN_YMD" }; + groupInfoList = [ + { + groupColName : "CRDN_SE_CD", + categoryNameConverter : "code=FIM002" + } + ]; + + queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList"); + codeSubsetInfoList = [ { sourceGroup : "FIM002", @@ -299,38 +341,64 @@ function fnLoadStatisticsDatas(){ } ]; - queryInQuery = fnJsonArrayToFormData(codeSubsetInfoList, "codeSubsetInfoList"); + queryInQuery3 = fnJsonArrayToFormData(codeSubsetInfoList, "codeSubsetInfoList"); - queryParam = {...queryParam, ...queryInQuery}; + mergedQuery = {...defaultQuery, ...queryInQuery1, ...queryInQuery3}; - fnLoadStatisticsData(queryParam, "lineChart", "line"); + fnLoadStatisticsData(mergedQuery, "lineChart", "line"); //초기자료처리별 건수 차트 - queryParam = { + defaultQuery = { structureType : "aggregate", - categorization : ["초기자료처리"], + groupColName : ["초기자료처리"], categoryNameConverter : ["code=FIM999"], fixedItemId : ["단속","계고","서손"] }; - //fnLoadStatisticsData(queryParam, "doughnutChart1", "doughnut"); + + groupInfoList = [ + groupColName : "초기자료처리", + categoryNameConverter : "code=FIM999" + ]; + + queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList"); + + mergedQuery = {...defaultQuery, ...queryInQuery1 }; + + //fnLoadStatisticsData(mergedQuery, "doughnutChart1", "doughnut"); //발송문서종류별 건수 차트 - queryParam = { + defaultQuery = { structureType : "aggregate", - categorization : ["SNDNG_SE_CD"], - categoryNameConverter : ["code=FIM047"], fixedItemId : ["01", "02", "03"] }; - //fnLoadStatisticsData(queryParam, "doughnutChart2", "doughnut"); + + groupInfoList = [ + groupColName : "SNDNG_SE_CD", + categoryNameConverter : "code=FIM047" + ]; + + queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList"); + + mergedQuery = {...defaultQuery, ...queryInQuery1 }; + + //fnLoadStatisticsData(mergedQuery, "doughnutChart2", "doughnut"); //의견진술결과별 건수 차트 - queryParam = { + defaultQuery = { structureType : "aggregate", - categorization : ["OPNN_SBMSN_STTS_CD"], - categoryNameConverter : ["code=FIM031"], fixedItemId : ["01", "02", "03"] }; - //fnLoadStatisticsData(queryParam, "doughnutChart3", "doughnut"); + + groupInfoList = [ + groupColName : "OPNN_SBMSN_STTS_CD", + categoryNameConverter : "code=FIM031" + ]; + + queryInQuery1 = fnJsonArrayToFormData(groupInfoList, "groupInfoList"); + + mergedQuery = {...defaultQuery, ...queryInQuery1 }; + + //fnLoadStatisticsData(mergedQuery, "doughnutChart3", "doughnut"); } //통계 데이터 조회