From 4761765b126725227895235f000c1d429bd27c49 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 9 Nov 2023 17:36:40 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8B=A8=EC=86=8D=EC=A1=B0=EB=B3=84=20?= =?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 | 107 +++++++----------- .../cokr/xit/fims/stat/dao/StatMapper.java | 2 + .../xit/fims/stat/service/bean/StatBean.java | 72 +++++------- .../sql/mapper/fims/stat/stat-mapper.xml | 15 ++- .../WEB-INF/jsp/fims/stat/stat02010-main.jsp | 8 +- .../WEB-INF/jsp/fims/stat/stat05010-main.jsp | 13 +-- 6 files changed, 90 insertions(+), 127 deletions(-) diff --git a/src/main/java/cokr/xit/fims/cmmn/CodeConverter.java b/src/main/java/cokr/xit/fims/cmmn/CodeConverter.java index 12ccf278..4d10f24d 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CodeConverter.java +++ b/src/main/java/cokr/xit/fims/cmmn/CodeConverter.java @@ -18,26 +18,12 @@ public class CodeConverter { List deptList = new ArrayList(); List vltnList = new ArrayList(); List userList = new ArrayList(); + List teamList = new ArrayList(); 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 코드값 @@ -124,65 +110,54 @@ public class CodeConverter { return result; } - /** 위반ID로 위반항목명을 반환한다. - * @param vltnId 위반ID - * @return 위반항목명 - */ - public String vltnIdToValue(String vltnId){ - String result = ""; - - for(int i = 0; i < vltnList.size(); i++) { - if(vltnId.equals(vltnList.get(i).string("VLTN_ID"))) { - result = vltnList.get(i).string("VLTN_NM"); - } + public void putOtherCode(String type, DataObject dataobject){ + switch(type) { + case "SGG_CD" : + this.sggList.add(dataobject); + break; + case "DEPT_CD" : + this.deptList.add(dataobject); + break; + case "VLTN_ID" : + this.vltnList.add(dataobject); + break; + case "USER_ID" : + this.userList.add(dataobject); + break; + case "TEAM_ID" : + this.teamList.add(dataobject); + break; } - - return result; } - /** 시군구코드로 시군구명을 반환한다. - * @param sggCd 시군구코드 - * @return 시군구명 - */ - public String sggCodeToValue(String sggCd){ + public String uniqOtherCodeToValue(String type, String uniqId) { String result = ""; - for(int i = 0; i < sggList.size(); i++) { - if(sggCd.equals(sggList.get(i).string("SGG_CD"))) { - result = sggList.get(i).string("SGG_NM"); - } + List otherCodeList = null; + switch(type) { + case "SGG_CD" : + otherCodeList = this.sggList; + break; + case "DEPT_CD" : + otherCodeList = this.deptList; + break; + case "VLTN_ID" : + otherCodeList = this.vltnList; + break; + case "USER_ID" : + otherCodeList = this.userList; + break; + case "TEAM_ID" : + otherCodeList = this.teamList; + break; } - - return result; - } - - /** 부서코드로 부서명을 반환한다. - * @param deptCd 부서코드 - * @return 부서명 - */ - public String deptCodeToValue(String deptCd){ - String result = ""; - - for(int i = 0; i < deptList.size(); i++) { - if(deptCd.equals(deptList.get(i).string("DEPT_CD"))) { - result = deptList.get(i).string("DEPT_NM"); - } + if(otherCodeList == null) { + return result; } - return result; - } - - - /** 유저ID로 유저이름을 반환한다. - * @param userId 유저ID - * @return 유저이름 - */ - public String userIdToUserName(String userId){ - String result = ""; - - for(int i = 0; i < userList.size(); i++) { - if(userId.equals(userList.get(i).string("USER_ID"))) { - result = userList.get(i).string("USER_NM"); + for(int i = 0; i < otherCodeList.size(); i++) { + if(uniqId.equals(otherCodeList.get(i).string(type))) { + result = otherCodeList.get(i).string("NAME"); } } diff --git a/src/main/java/cokr/xit/fims/stat/dao/StatMapper.java b/src/main/java/cokr/xit/fims/stat/dao/StatMapper.java index a1194422..f22b7d42 100644 --- a/src/main/java/cokr/xit/fims/stat/dao/StatMapper.java +++ b/src/main/java/cokr/xit/fims/stat/dao/StatMapper.java @@ -16,4 +16,6 @@ public interface StatMapper extends AbstractMapper { DataObject selectUserById(String userId); + DataObject selectTeamById(String teamId); + } 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 f900d414..50336fac 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 @@ -402,52 +402,19 @@ public class StatBean extends AbstractComponent { } itemName = codeConverter.vltnCdToValue(taskSeCd, compositeItemId[i]); - } else if(dtlCtgr.equals("VLTN_ID")) { - 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")) { - 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")) { - String find = codeConverter.deptCodeToValue(compositeItemId[i]); - if(!find.equals("")) { - itemName = find; - } else { - DataObject findRow = statMapper.selectDeptByCode(compositeItemId[i]); + } else if(dtlCtgr.equals("VLTN_ID") || dtlCtgr.equals("TEAM_ID") + || dtlCtgr.equals("SGG_CD") || dtlCtgr.equals("DEPT_CD") || dtlCtgr.equals("USER_ID")) { - if(findRow != null){ - itemName = findRow.string("DEPT_NM"); - codeConverter.putDept(findRow); - } - } - } else if(dtlCtgr.equals("USER_ID")) { - String find = codeConverter.userIdToUserName(compositeItemId[i]); + String find = codeConverter.uniqOtherCodeToValue(dtlCtgr,compositeItemId[i]); if(!find.equals("")) { itemName = find; } else { - DataObject findRow = statMapper.selectUserById(compositeItemId[i]); + DataObject findRow = this.selectOtherCode(dtlCtgr, compositeItemId[i]); if(findRow != null){ - itemName = findRow.string("USER_NM"); - codeConverter.putUser(findRow); + itemName = findRow.string("NAME"); + codeConverter.putOtherCode(dtlCtgr, findRow); } } } @@ -455,9 +422,6 @@ public class StatBean extends AbstractComponent { } compositeItemName[i] = itemName; - - - } statItem.setItemName(compositeItemName); @@ -505,6 +469,30 @@ public class StatBean extends AbstractComponent { } + public DataObject selectOtherCode(String type, String uniqId) { + DataObject result = null; + + switch(type) { + case "SGG_CD" : + result = statMapper.selectSggByCode(uniqId); + break; + case "DEPT_CD" : + result = statMapper.selectDeptByCode(uniqId); + break; + case "VLTN_ID" : + result = statMapper.selectVltnById(uniqId); + break; + case "USER_ID" : + result = statMapper.selectUserById(uniqId); + break; + case "TEAM_ID" : + result = statMapper.selectTeamById(uniqId); + break; + } + + return result; + } + /** 통계결과를 정렬한다. * @param stat 통계 * @return diff --git a/src/main/resources/sql/mapper/fims/stat/stat-mapper.xml b/src/main/resources/sql/mapper/fims/stat/stat-mapper.xml index 92a65791..0960f6ba 100644 --- a/src/main/resources/sql/mapper/fims/stat/stat-mapper.xml +++ b/src/main/resources/sql/mapper/fims/stat/stat-mapper.xml @@ -4,30 +4,37 @@ + + \ 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 bd88ed62..ea96118a 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 @@ -56,7 +56,7 @@ data-ref-col="TASK_SE_CD" data-ctgr-type="code" data-dtl-ctgr="FIM054" >과태료 + data-ref-col="RGTR" data-ctgr-type="otherCode" data-dtl-ctgr="USER_ID" + >자료입력사용자 diff --git a/src/main/webapp/WEB-INF/jsp/fims/stat/stat05010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/stat/stat05010-main.jsp index a3308c28..18a5f76e 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/stat/stat05010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/stat/stat05010-main.jsp @@ -56,7 +56,7 @@ data-ref-col="TASK_SE_CD" data-ctgr-type="code" data-dtl-ctgr="FIM054" >과태료 - - -