From 22db24e93de12fdf27f7067b6c2809b21bdb7984 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 9 Nov 2023 10:29:22 +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/cmmn/CodeConverter.java | 58 +++------ .../xit/fims/stat/service/bean/StatBean.java | 60 +++++++++- .../xit/fims/stat/web/Stat01Controller.java | 60 +++++++--- .../cokr/xit/fims/task/web/CmnController.java | 12 ++ .../WEB-INF/jsp/fims/stat/stat01010-main.jsp | 112 +++++++++++++++--- .../WEB-INF/jsp/fims/stat/stat02010-main.jsp | 10 +- .../WEB-INF/jsp/fims/stat/stat03010-main.jsp | 10 +- .../WEB-INF/jsp/fims/stat/stat04010-main.jsp | 5 +- .../WEB-INF/jsp/fims/stat/stat05010-main.jsp | 6 +- .../resources/js/fims/stat/crdnPreset.js | 22 ++++ 10 files changed, 263 insertions(+), 92 deletions(-) create mode 100644 src/main/webapp/resources/js/fims/stat/crdnPreset.js diff --git a/src/main/java/cokr/xit/fims/cmmn/CodeConverter.java b/src/main/java/cokr/xit/fims/cmmn/CodeConverter.java index a9f78b33..12ccf278 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CodeConverter.java +++ b/src/main/java/cokr/xit/fims/cmmn/CodeConverter.java @@ -6,10 +6,7 @@ import java.util.List; import java.util.Map; import java.util.regex.Matcher; -import javax.annotation.Resource; - import cokr.xit.base.code.CommonCode; -import cokr.xit.fims.stat.dao.StatMapper; import cokr.xit.foundation.data.DataObject; @@ -22,13 +19,26 @@ public class CodeConverter { List vltnList = new ArrayList(); List userList = new ArrayList(); - @Resource(name = "statMapper") - private StatMapper statMapper; - public CodeConverter(Map> commonCodes){ this.commonCodes = commonCodes; } + public void putSgg(DataObject dataobject){ + this.sggList.add(dataobject); + } + + public void putDept(DataObject dataobject){ + this.deptList.add(dataobject); + } + + public void putVltn(DataObject dataobject){ + this.vltnList.add(dataobject); + } + + public void putUser(DataObject dataobject){ + this.userList.add(dataobject); + } + /** 코드값으로 코드를 반환한다. * @param codeGroupName 코드그룹명, value 코드값 * @return 코드 @@ -127,15 +137,6 @@ public class CodeConverter { } } - if(result.equals("")) { - DataObject findRow = statMapper.selectVltnById(vltnId); - - if(findRow != null){ - vltnList.add(findRow); - result = findRow.string("VLTN_NM"); - } - } - return result; } @@ -152,15 +153,6 @@ public class CodeConverter { } } - if(result.equals("")) { - DataObject findRow = statMapper.selectSggByCode(sggCd); - - if(findRow != null){ - vltnList.add(findRow); - result = findRow.string("SGG_NM"); - } - } - return result; } @@ -177,15 +169,6 @@ public class CodeConverter { } } - if(result.equals("")) { - DataObject findRow = statMapper.selectDeptByCode(deptCd); - - if(findRow != null){ - vltnList.add(findRow); - result = findRow.string("DEPT_NM"); - } - } - return result; } @@ -203,15 +186,6 @@ public class CodeConverter { } } - if(result.equals("")) { - DataObject findRow = statMapper.selectUserById(userId); - - if(findRow != null){ - vltnList.add(findRow); - result = findRow.string("USER_NM"); - } - } - return result; } 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 1e3ea0ec..88309812 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 @@ -9,6 +9,8 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import javax.annotation.Resource; + import org.springframework.stereotype.Component; import cokr.xit.base.code.CommonCode; @@ -21,6 +23,7 @@ import cokr.xit.fims.stat.NumberValueInfo; import cokr.xit.fims.stat.Stat; import cokr.xit.fims.stat.StatItem; import cokr.xit.fims.stat.StatQuery; +import cokr.xit.fims.stat.dao.StatMapper; import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.data.DataObject; @@ -28,6 +31,9 @@ import cokr.xit.foundation.data.DataObject; @Component("statBean") public class StatBean extends AbstractComponent { + @Resource(name = "statMapper") + StatMapper statMapper; + /**쿼리에서 날짜와 관련된 파라미터를 설정한다. * @param sql처리용 query, dayCol 날짜조회용 컬럼, from 조회시작일, to 조회종료일 * @return @@ -396,13 +402,53 @@ public class StatBean extends AbstractComponent { itemName = codeConverter.vltnCdToValue(taskSeCd, compositeItemId[i]); } else if(dtlCtgr.equals("VLTN_ID")) { - itemName = codeConverter.vltnIdToValue(compositeItemId[i]); + String find = codeConverter.vltnIdToValue(compositeItemId[i]); + if(!find.equals("")) { + itemName = find; + } else { + DataObject findRow = statMapper.selectVltnById(compositeItemId[i]); + + if(findRow != null){ + itemName = findRow.string("VLTN_NM"); + codeConverter.putVltn(findRow); + } + } } else if(dtlCtgr.equals("SGG_CD")) { - itemName = codeConverter.sggCodeToValue(compositeItemId[i]); + String find = codeConverter.sggCodeToValue(compositeItemId[i]); + if(!find.equals("")) { + itemName = find; + } else { + DataObject findRow = statMapper.selectSggByCode(compositeItemId[i]); + + if(findRow != null){ + itemName = findRow.string("SGG_NM"); + codeConverter.putSgg(findRow); + } + } } else if(dtlCtgr.equals("DEPT_CD")) { - itemName = codeConverter.deptCodeToValue(compositeItemId[i]); + String find = codeConverter.deptCodeToValue(compositeItemId[i]); + if(!find.equals("")) { + itemName = find; + } else { + DataObject findRow = statMapper.selectDeptByCode(compositeItemId[i]); + + if(findRow != null){ + itemName = findRow.string("DEPT_NM"); + codeConverter.putDept(findRow); + } + } } else if(dtlCtgr.equals("USER_ID")) { - itemName = codeConverter.userIdToUserName(compositeItemId[i]); + String find = codeConverter.userIdToUserName(compositeItemId[i]); + if(!find.equals("")) { + itemName = find; + } else { + DataObject findRow = statMapper.selectUserById(compositeItemId[i]); + + if(findRow != null){ + itemName = findRow.string("USER_NM"); + codeConverter.putUser(findRow); + } + } } } @@ -445,8 +491,8 @@ public class StatBean extends AbstractComponent { statItem.getNumberValue()[i] = 0; } else { int originalValue = statItem.getNumberValue()[i]; - double ratioValue = originalValue / totValue; - double percent = ratioValue * 100 * (decimalPoint+1); + double ratioValue = (double) originalValue / (double) totValue; + double percent = ratioValue * Math.pow(10, 2+decimalPoint); statItem.getNumberValue()[i] = (int) Math.floor(percent); } @@ -458,4 +504,6 @@ public class StatBean extends AbstractComponent { } + + } 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 58acbe8d..4a78c04e 100644 --- a/src/main/java/cokr/xit/fims/stat/web/Stat01Controller.java +++ b/src/main/java/cokr/xit/fims/stat/web/Stat01Controller.java @@ -16,6 +16,7 @@ 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.NumberValueInfo; import cokr.xit.fims.stat.Stat; import cokr.xit.fims.stat.StatQuery; import cokr.xit.fims.stat.service.StatService; @@ -46,30 +47,53 @@ public class Stat01Controller extends ApplicationController { String sggCd = globalStngMapper.selectSggCd(curDeptCode); statQuery.setSggCd(sggCd); - List groupInfoList = statQuery.getGroupInfoList(); - List codeGroup = new ArrayList(); - for(int i=0; i < groupInfoList.size(); i++) { - GroupInfo groupInfo = groupInfoList.get(i); - String ctgrType = groupInfo.getCtgrType(); - String dtlCtgr = groupInfo.getDtlCtgr(); - if(ctgrType.equals("code")) { - codeGroup.add(dtlCtgr); - } else if(ctgrType.equals("otherCode")) { - - if(dtlCtgr.equals("VLTN_CD")) { - codeGroup.add("FIM054"); - codeGroup.add("FIM004"); - codeGroup.add("FIM005"); - codeGroup.add("FIM006"); - codeGroup.add("FIM061"); - codeGroup.add("FIM064"); - } + List groupInfoList = statQuery.getGroupInfoList(); + if(groupInfoList != null) { + for(int i=0; i < groupInfoList.size(); i++) { + GroupInfo groupInfo = groupInfoList.get(i); + String ctgrType = ifEmpty(groupInfo.getCtgrType(), () -> ""); + String dtlCtgr = ifEmpty(groupInfo.getDtlCtgr(), () -> ""); + if(ctgrType.equals("code")) { + codeGroup.add(dtlCtgr); + } else if(ctgrType.equals("otherCode")) { + + if(dtlCtgr.equals("VLTN_CD")) { + codeGroup.add("FIM054"); + codeGroup.add("FIM004"); + codeGroup.add("FIM005"); + codeGroup.add("FIM006"); + codeGroup.add("FIM061"); + codeGroup.add("FIM064"); + } + } } } + List numberValueInfoList = statQuery.getNumberValueInfoList(); + if(numberValueInfoList != null) { + for(int i=0; i < numberValueInfoList.size(); i++) { + NumberValueInfo numberValueInfo = numberValueInfoList.get(i); + String ctgrType = ifEmpty(numberValueInfo.getSeperatorCtgrType(), () -> ""); + String dtlCtgr = ifEmpty(numberValueInfo.getSeperatorDtlCtgr(), () -> ""); + if(ctgrType.equals("code")) { + codeGroup.add(dtlCtgr); + } else if(ctgrType.equals("otherCode")) { + + if(dtlCtgr.equals("VLTN_CD")) { + codeGroup.add("FIM054"); + codeGroup.add("FIM004"); + codeGroup.add("FIM005"); + codeGroup.add("FIM006"); + codeGroup.add("FIM061"); + codeGroup.add("FIM064"); + } + + } + } + } Map> commonCodes = new HashMap>(); if(codeGroup.size() > 0) { diff --git a/src/main/java/cokr/xit/fims/task/web/CmnController.java b/src/main/java/cokr/xit/fims/task/web/CmnController.java index a471157d..47dcfb29 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -438,6 +438,18 @@ public class CmnController { return super.statMain(); } + } + + @Controller + @RequestMapping(name="종합 통계", value="/stat/stat05") + class Stat05Controller extends cokr.xit.fims.stat.web.Stat05Controller { + + @Override + @RequestMapping(name="종합 통계 메인", value="/010/main.do") + public ModelAndView statMain() { + return super.statMain(); + } + } @Controller diff --git a/src/main/webapp/WEB-INF/jsp/fims/stat/stat01010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/stat/stat01010-main.jsp index e1d4aa48..4de16cc3 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/stat/stat01010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/stat/stat01010-main.jsp @@ -48,16 +48,16 @@
- - ~ - @@ -100,7 +100,7 @@
@@ -173,6 +173,7 @@ $(document).ready(function(){ var $P = pageObject["${pageName}"]; + $P.statQuery = {}; /************************************************************************** * pageObject.function **************************************************************************/ @@ -230,11 +231,30 @@ $(document).ready(function(){ $P.getNumberValueInfoList = () => { var numberValuefoLiost = []; + var preset = $("#preset--${pageName}").find(":selected"); + + if(preset.val() == "totCnt"){ + numberValuefoLiost = [{ aggregateType : "count" }]; + return numberValuefoLiost; + } + numberValuefoLiost = window[preset.val()]; return numberValuefoLiost; } + $P.getCodeSubsetInfoList = () => { + var codeSubsetInfoList = []; + + var preset = $("#preset--${pageName}").find(":selected"); + + if(window[preset.val()+"_codeSubsetInfoList"] != undefined){ + codeSubsetInfoList = window[preset.val()+"_codeSubsetInfoList"]; + } + + return codeSubsetInfoList; + } + $P.changeGrid = () => { $("#masterThead--${pageName}").html(""); @@ -279,30 +299,59 @@ $(document).ready(function(){ $P.searchStat = () => { - var statQuery = { - structureType : "aggregate" - }; var formFields = new FimsFormFields("#frmSearch--${pageName}"); var formFieldsData = formFields.get(); - + + if(formFieldsData.firstDay == "" || formFieldsData.lastDay == ""){ + dialog.alert("시작일자와 종료일자를 입력하세요."); + return; + } + + var statQuery = { + structureType : "aggregate", + decimalPoint : 1 + }; + //업무구분 if(formFieldsData.taskSeCd != ""){ statQuery.taskSeCd = formFieldsData.taskSeCd; } + //날짜 조회조건 + statQuery.dayColumn = formFieldsData.dayColumn; + statQuery.firstDay = formFieldsData.firstDay; + statQuery.lastDay = formFieldsData.lastDay; + + //통계 유형 + var preset = $("#preset--${pageName}").find(":selected"); + if(preset.val() == "totCnt"){ + statQuery.statDomain = $("#defaultStatDomain--${pageName}").val(); + } else { + statQuery.statDomain = preset[0].dataset.statDomain; + } + //집계 그룹 정보 - statQuery.groupInfoList = $P.getGroupInfoList(); + statQuery.groupInfoList = $P.getGroupInfoList(); + //수치값 정보 statQuery.numberValueInfoList = $P.getNumberValueInfoList(); + //코드서브셋 정보 + statQuery.codeSubsetInfoList = $P.getCodeSubsetInfoList(); + //상세목록 조회 여부 statQuery.refListYn = formFieldsData.refListYn; + $P.statQuery = JSON.parse(JSON.stringify(statQuery)); + + statQuery = fnJsonToFormData(statQuery, "groupInfoList"); + statQuery = fnJsonToFormData(statQuery, "numberValueInfoList"); + statQuery = fnJsonToFormData(statQuery, "codeSubsetInfoList"); ajax.get({ url : wctx.url("/stat/stat01/010/info.do"), - data : defaultQuery, + data : statQuery, success : (resp) => { var stat = resp.stat; $P.renderStat(stat); @@ -312,7 +361,22 @@ $(document).ready(function(){ } $P.renderStat = (stat) => { + $("#masterTbody--${pageName}").html(""); + var statItems = stat.statItems; + + if(statItems == null || statItems.length == 0){ + dialog.alert("조회된 자료가 없습니다."); + return; + } + + //비율 소수점 + var decimalPoint = 0; + if($P.statQuery.decimalPoint != null){ + decimalPoint = $P.statQuery.decimalPoint; + } + var pointMove = Number.parseFloat(0.1 ** decimalPoint).toFixed(decimalPoint); + for(var i=0; i < statItems.length; i++){ var statItem = statItems[i]; @@ -320,18 +384,34 @@ $(document).ready(function(){ var itemNames = statItem.itemName; var numberValues = statItem.numberValue; - // - // "tr" - // "td" itemNames.length - // "td" numberValues.length + + var tr = ""; + + for(var j=0; j < itemNames.length; j++){ + tr += "" + itemNames[j] + ""; + } + for(var k=0; k < numberValues.length; k++){ + tr += ""; + + if($P.statQuery.numberValueInfoList[k].aggregateType == "ratio"){ + tr += Number.parseFloat(numberValues[k] * pointMove).toFixed(decimalPoint); + tr += " %"; + } else { + tr += numberFormat.format(numberValues[k]); + } + tr += ""; + } + tr += ""; + + $("#masterTbody--${pageName}").append(tr); } } initDatepicker("frmSearch--${pageName}"); //달력 초기화 - $("#schDateOpt--${pageName}").append(document.getElementById("schDateOptDatalist--${pageName}").innerHTML); + $("#dayColumn--${pageName}").append(document.getElementById("dayColumnDatalist--${pageName}").innerHTML); $("#searchForMenu--${pageName}").append(document.getElementById("searchForMenuTemplate--${pageName}").innerHTML); @@ -358,4 +438,6 @@ $(document).ready(function(){ $P.changeGrid(); }); + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/fims/stat/stat02010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/stat/stat02010-main.jsp index 00866417..02a54f12 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/stat/stat02010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/stat/stat02010-main.jsp @@ -4,8 +4,10 @@ 단속 통계 - - + + + +