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