From 70179576a8bca2020f53c88cff85a308bfe788f5 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 28 Dec 2023 11:15:53 +0900 Subject: [PATCH] =?UTF-8?q?1.=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=9B=84=20?= =?UTF-8?q?=EC=97=85=EB=AC=B4=EA=B6=8C=ED=95=9C=20=ED=99=95=EC=9D=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=202.=20=EC=82=AC=EC=9A=A9=EC=9E=90=EB=B3=84?= =?UTF-8?q?=20=EA=B8=B0=EB=B3=B8=20=EC=97=85=EB=AC=B4=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cokr/xit/fims/base/UserController.java | 27 +++- .../cokr/xit/fims/cmmn/dao/StngMapper.java | 6 + .../xit/fims/cmmn/service/bean/StngBean.java | 52 ++++++- .../sql/mapper/fims/cmmn/stng-mapper.xml | 8 ++ src/main/webapp/WEB-INF/jsp/include/top.jsp | 2 +- src/main/webapp/WEB-INF/jsp/index.jsp | 127 ++++++++++++------ 6 files changed, 176 insertions(+), 46 deletions(-) diff --git a/src/main/java/cokr/xit/fims/base/UserController.java b/src/main/java/cokr/xit/fims/base/UserController.java index 95e74b7e..5637bf3e 100644 --- a/src/main/java/cokr/xit/fims/base/UserController.java +++ b/src/main/java/cokr/xit/fims/base/UserController.java @@ -18,6 +18,9 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; +import cokr.xit.base.code.service.CodeQuery; +import cokr.xit.base.code.service.bean.CodeBean; +import cokr.xit.base.security.SecuredUserInfo; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.service.UserService; import cokr.xit.fims.cmmn.DirectoryStructureToJson; @@ -26,7 +29,6 @@ import cokr.xit.fims.cmmn.dao.FactionMapper; import cokr.xit.fims.cmmn.service.bean.FactionBean; import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.crdn.service.bean.ImportServiceBean; -import cokr.xit.foundation.UserInfo; import cokr.xit.foundation.data.DataObject; import cokr.xit.interfaces.smg.service.bean.SmgServiceBean; @@ -39,6 +41,9 @@ public class UserController extends cokr.xit.base.user.web.UserController taskList = codeBean.getCodeList(codeQuery); + String[] taskRoles = taskList.stream().map((item) -> { return "ROLE_"+item.string("CODE"); }) + .toList().toArray(new String[taskList.size()]); + boolean hasTaskAuth = userInfo.hasAuthorities(taskRoles); + + userInfo.getInfo().put("isAdmin", isAdmin); + userInfo.getInfo().put("hasTaskAuth", hasTaskAuth); + + //기본업무 + stngBean.initDefaultTask(userInfo); + mav.addObject("myInfo", userInfo); return mav; diff --git a/src/main/java/cokr/xit/fims/cmmn/dao/StngMapper.java b/src/main/java/cokr/xit/fims/cmmn/dao/StngMapper.java index 84756a32..fdb85000 100644 --- a/src/main/java/cokr/xit/fims/cmmn/dao/StngMapper.java +++ b/src/main/java/cokr/xit/fims/cmmn/dao/StngMapper.java @@ -10,6 +10,12 @@ import cokr.xit.foundation.data.DataObject; @Mapper("stngMapper") public interface StngMapper extends AbstractMapper { + /**사용자의 기본 업무를 조회한다. + * @param userId 유저ID + * @return 기본 업무코드 + */ + String selectDefaultTask(String userId); + /**사용자 설정 정보를 조회한다. * @param userId 사용자ID * @return 사용자 설정정보 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 accf79f7..3045df57 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 @@ -1,12 +1,18 @@ package cokr.xit.fims.cmmn.service.bean; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Component; +import cokr.xit.base.code.service.CodeQuery; +import cokr.xit.base.code.service.bean.CodeBean; +import cokr.xit.base.security.Authority; +import cokr.xit.base.security.SecuredUserInfo; import cokr.xit.fims.cmmn.dao.StngMapper; import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.UserInfo; @@ -14,12 +20,14 @@ import cokr.xit.foundation.data.DataObject; @Component("stngBean") public class StngBean extends AbstractComponent { + @Resource(name = "codeBean") + private CodeBean codeBean; @Resource(name = "factionBean") - FactionBean factionBean; + private FactionBean factionBean; @Resource(name = "stngMapper") - StngMapper stngMapper; + private StngMapper stngMapper; /**현재 사용자와 관련된 설정 정보를 조회한다. * @param type 설정 유형 @@ -59,4 +67,44 @@ public class StngBean extends AbstractComponent { return stngMapper.updateDtbnActno(params) == 1 ? true : false; } + /** userInfo에 기본 업무를 설정한다. + * @param userInfo 사용자정보 + * @return + */ + public void initDefaultTask(SecuredUserInfo userInfo) { + + List hasTaskAuthList = new ArrayList<>(); + + CodeQuery codeQuery = new CodeQuery(); + codeQuery.setGroupIDs("FIM054"); + List taskList = codeBean.getCodeList(codeQuery); + + List authorities = userInfo.getAuthorities(); + if(authorities != null && !authorities.isEmpty()) { + for(Authority authority : authorities) { + String authId = authority.getId(); + + for(int i=0; i + + + diff --git a/src/main/webapp/WEB-INF/jsp/index.jsp b/src/main/webapp/WEB-INF/jsp/index.jsp index eb1437f2..a3d8718d 100644 --- a/src/main/webapp/WEB-INF/jsp/index.jsp +++ b/src/main/webapp/WEB-INF/jsp/index.jsp @@ -33,26 +33,30 @@ - + + + - - if("${param.taskSeCd}" == "" || $("#layout-navbar").find("input[name='taskSeCd'][value='${param.taskSeCd}']").length == 0){ - $("#layout-navbar input[name='taskSeCd'][value='DPV']").prop("checked", true); - } else { - $("#layout-navbar input[name='taskSeCd'][value='${param.taskSeCd}']").prop("checked", true); - } - - var checkedId = $("#layout-navbar input[name='taskSeCd']:checked")[0].id; - var checkedText = $("label[for='"+checkedId+"']").text(); - $("#home").html("과태료통합관리시스템
("+checkedText+")"); - $("#layout-navbar input[name='taskSeCd']").on("click", function(){ - $("#userNav--top").click(); - window.open(wctx.url("/")+"?taskSeCd="+this.value, "_blank", ""); - return false; - });
+ \ No newline at end of file