diff --git a/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java b/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java index 890300dd..38b43ec9 100644 --- a/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java @@ -9,6 +9,7 @@ import javax.annotation.Resource; import org.springframework.stereotype.Component; +import cokr.xit.base.code.CommonCode; import cokr.xit.base.code.service.CodeQuery; import cokr.xit.base.code.service.bean.CodeBean; import cokr.xit.base.security.Authority; @@ -160,4 +161,30 @@ public class StngBean extends AbstractComponent { return effected == 1 ? true : false; } + /** 업무구분코드 목록 중에서 현재 로그인한 사용자의 시군구에서 사용하는 업무구분코드 목록만 반환한다. + * @param taskSectionCodes 업무구분코드 목록 + * @return 현재 로그인한 사용자의 시군구에서 사용하는 업무구분코드 목록 + */ + public List filterTaskSectionCodeForSgg(List taskSectionCodes) { + + List taskListForSgg = new ArrayList(); + if(currentUser().getInstitute().equals("default")) { + taskListForSgg = taskSectionCodes; + } else { + SecuredUserInfo userInfo = currentUser(); + Map info = userInfo.getInfo(); + if(info == null || info.get("sggCd") == null || info.get("sggCd").equals("")) { + factionBean.initUserInfo(userInfo); + } + + List taskSeCdListForSgg = taskBean.getTasks((new CmmnQuery()).setSggCd((String)userInfo.getInfo().get("sggCd")).setUseYN("Y")) + .stream().map(item -> item.string("TASK_SE_CD")).toList(); + + taskListForSgg = taskSectionCodes.stream() + .filter(item -> taskSeCdListForSgg.contains(item.getCode())).toList(); + } + + return taskListForSgg; + } + } diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java index 116f55c8..dc4da525 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -21,13 +21,12 @@ import cokr.xit.base.code.CommonCode; import cokr.xit.base.file.xls.XLSWriter; import cokr.xit.base.file.xls.XLSWriter.CellDef; import cokr.xit.base.file.xls.XLSWriter.Styler; -import cokr.xit.base.security.SecuredUserInfo; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.web.ApplicationController; -import cokr.xit.fims.cmmn.CmmnQuery; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.service.bean.FactionBean; +import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.cmmn.service.bean.TaskBean; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.dao.GlobalStngMapper; @@ -105,6 +104,9 @@ public class Sprt01Controller extends ApplicationController { @Resource(name = "factionBean") private FactionBean factionBean; + @Resource(name = "stngBean") + private StngBean stngBean; + /**통합 조회 메인화면(fims/sprt/sprt01/010-main)을 연다. * * @return /fims/sprt/sprt01010 @@ -127,25 +129,7 @@ public class Sprt01Controller extends ApplicationController { mav.addObject("FIM010List", commonCodes.get("FIM010")); mav.addObject("FIM026List", commonCodes.get("FIM026")); mav.addObject("FIM054List", commonCodes.get("FIM054")); - - List taskListForSgg = new ArrayList(); - if(currentUser().getInstitute().equals("default")) { - taskListForSgg = commonCodes.get("FIM054"); - } else { - SecuredUserInfo userInfo = currentUser(); - Map info = userInfo.getInfo(); - if(info == null || info.get("sggCd") == null || info.get("sggCd").equals("")) { - factionBean.initUserInfo(userInfo); - } - - List taskSeCdListForSgg = taskBean.getTasks((new CmmnQuery()).setSggCd((String)userInfo.getInfo().get("sggCd")).setUseYN("Y")) - .stream().map(item -> item.string("TASK_SE_CD")).toList(); - - taskListForSgg = commonCodes.get("FIM054").stream() - .filter(item -> taskSeCdListForSgg.contains(item.getCode())).toList(); - } - mav.addObject("TaskListForSgg", taskListForSgg); - + mav.addObject("TaskListForSgg", stngBean.filterTaskSectionCodeForSgg(commonCodes.get("FIM054"))); mav.addObject("FIM004List", commonCodes.get("FIM004")); mav.addObject("FIM005List", commonCodes.get("FIM005")); mav.addObject("FIM006List", commonCodes.get("FIM006"));