|
|
|
@ -13,6 +13,7 @@ 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.CmmnQuery;
|
|
|
|
|
import cokr.xit.fims.cmmn.dao.StngMapper;
|
|
|
|
|
import cokr.xit.foundation.AbstractComponent;
|
|
|
|
|
import cokr.xit.foundation.UserInfo;
|
|
|
|
@ -29,6 +30,9 @@ public class StngBean extends AbstractComponent {
|
|
|
|
|
@Resource(name = "stngMapper")
|
|
|
|
|
private StngMapper stngMapper;
|
|
|
|
|
|
|
|
|
|
@Resource(name = "taskBean")
|
|
|
|
|
private TaskBean taskBean;
|
|
|
|
|
|
|
|
|
|
/**현재 사용자와 관련된 설정 정보를 조회한다.
|
|
|
|
|
* @param type 설정 유형
|
|
|
|
|
* @return
|
|
|
|
@ -67,34 +71,55 @@ public class StngBean extends AbstractComponent {
|
|
|
|
|
return stngMapper.updateDtbnActno(params) == 1 ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** userInfo에 기본 업무를 설정한다.
|
|
|
|
|
/** userInfo에 사용가능업무, 기본업무를 설정한다.
|
|
|
|
|
* @param userInfo 사용자정보
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void initDefaultTask(SecuredUserInfo userInfo) {
|
|
|
|
|
public void initUserInfo(SecuredUserInfo userInfo) {
|
|
|
|
|
|
|
|
|
|
boolean isAdmin = userInfo.hasAuthorities("ROLE_ADMIN");
|
|
|
|
|
List<String> taskList = codeBean.getCodeList((new CodeQuery()).setGroupIDs("FIM054"))
|
|
|
|
|
.stream().map(item -> item.string("CODE")).toList();
|
|
|
|
|
|
|
|
|
|
List<String> availableTaskList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
List<String> hasTaskAuthList = new ArrayList<>();
|
|
|
|
|
if(userInfo.getInstitute().equals("default")) { //최고관리자
|
|
|
|
|
|
|
|
|
|
CodeQuery codeQuery = new CodeQuery();
|
|
|
|
|
codeQuery.setGroupIDs("FIM054");
|
|
|
|
|
List<DataObject> taskList = codeBean.getCodeList(codeQuery);
|
|
|
|
|
availableTaskList = taskList;
|
|
|
|
|
|
|
|
|
|
} else if(isAdmin) { //관리자
|
|
|
|
|
Map<String, Object> info = userInfo.getInfo();
|
|
|
|
|
if(info == null || info.get("sggCd") == null || info.get("sggCd").equals("")) {
|
|
|
|
|
factionBean.initUserInfo(userInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Authority> authorities = userInfo.getAuthorities();
|
|
|
|
|
if(authorities != null && !authorities.isEmpty()) {
|
|
|
|
|
for(Authority authority : authorities) {
|
|
|
|
|
String authId = authority.getId();
|
|
|
|
|
availableTaskList = taskBean.getTasks((new CmmnQuery()).setSggCd((String)userInfo.getInfo().get("sggCd")).setUseYN("Y"))
|
|
|
|
|
.stream().map(item -> item.string("TASK_SE_CD")).toList();
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<taskList.size(); i++) {
|
|
|
|
|
String task = taskList.get(i).string("CODE");
|
|
|
|
|
if(authId.equals("ROLE_"+task)) {
|
|
|
|
|
hasTaskAuthList.add(task);
|
|
|
|
|
} else { //일반사용자
|
|
|
|
|
|
|
|
|
|
List<Authority> authorities = userInfo.getAuthorities();
|
|
|
|
|
|
|
|
|
|
if(authorities != null && !authorities.isEmpty()) {
|
|
|
|
|
for(Authority authority : authorities) {
|
|
|
|
|
String authId = authority.getId();
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<taskList.size(); i++) {
|
|
|
|
|
String task = taskList.get(i);
|
|
|
|
|
if(authId.equals("ROLE_"+task)) {
|
|
|
|
|
availableTaskList.add(task);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(hasTaskAuthList.size() == 1) {
|
|
|
|
|
userInfo.getInfo().put("defaultTask", hasTaskAuthList.get(0));
|
|
|
|
|
//계정별 사용가능 업무
|
|
|
|
|
userInfo.getInfo().put("taskForUser", availableTaskList);
|
|
|
|
|
|
|
|
|
|
//계정별 기본업무
|
|
|
|
|
if(availableTaskList.size() == 1) {
|
|
|
|
|
userInfo.getInfo().put("defaultTask", availableTaskList.get(0));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|