사용자별 사용가능한 업무 조회 추가

main
이범준 11 months ago
parent 70179576a8
commit a059040ccf

@ -100,8 +100,8 @@ public class UserController extends cokr.xit.base.user.web.UserController<Manage
userInfo.getInfo().put("isAdmin", isAdmin);
userInfo.getInfo().put("hasTaskAuth", hasTaskAuth);
//기본업무
stngBean.initDefaultTask(userInfo);
//사용자별 업무 및 기본업무
stngBean.initUserInfo(userInfo);
mav.addObject("myInfo", userInfo);

@ -5,10 +5,10 @@ import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.cmmn.Task;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
*

@ -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;
}

@ -6,11 +6,11 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.cmmn.Task;
import cokr.xit.fims.cmmn.dao.TaskMapper;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
/** Bean
*

@ -59,7 +59,9 @@
<select id="selectTasks" parameterType="map" resultType="dataobject">/* 업무 정보 객체 가져오기(taskMapper.selectTasks) */
<include refid="select" />
WHERE T.SGG_CD = #{sggCd}
<if test="taskSeCd != null and taskSeCd != ''">
AND T.TASK_SE_CD = #{taskSeCd}
</if>
<if test="useYN != null">
AND T.USE_YN = #{useYN}
</if>

@ -124,31 +124,7 @@
</a>
</li>
<li>
<div class="d-flex align-items-center" style="flex-flow:column">
<span>
<input type='radio' id='taskSeCd1--top' name='taskSeCd' value='PVS' title="주정차" />
<label for="taskSeCd1--top">주정차</label>
</span>
<sapn>
<input type='radio' id='taskSeCd2--top' name='taskSeCd' value='BPV' title="전용차로" />
<label for="taskSeCd2--top">전용차로</label>
</sapn>
<sapn>
<input type='radio' id='taskSeCd3--top' name='taskSeCd' value='DPV' title="장애인" />
<label for="taskSeCd3--top">장애인</label>
</sapn>
<sapn>
<input type='radio' id='taskSeCd4--top' name='taskSeCd' value='ECA' title="전기차" />
<label for="taskSeCd4--top">전기차</label>
</sapn>
<sapn>
<input type='radio' id='taskSeCd5--top' name='taskSeCd' value='TPV' title="밤샘주차" />
<label for="taskSeCd5--top">밤샘주차</label>
</sapn>
<sapn>
<input type='radio' id='taskSeCd6--top' name='taskSeCd' value='DVS' title="미세먼지" />
<label for="taskSeCd6--top">미세먼지</label>
</sapn>
<div id="taskSeCd--Top" class="d-flex align-items-center" style="flex-flow:column">
</div>
</li>
<li>

@ -72,6 +72,14 @@
pageObject.childReq = [];
pageObject.parentRes = [];
var ALL_TASK = {
"PVS" : "주정차위반",
"BPV" : "전용차로위반",
"DPV" : "장애인전용",
"ECA" : "전기차주차",
"TPV" : "밤샘주차위반",
"DVS" : "미세먼지"
};
var MY_INFO = {};
function getBrowserName() {
@ -152,6 +160,24 @@
return;
}
//사용자별 선택가능한 업무 라디오버튼 렌더링
for(var i=0; i < MY_INFO.info.taskForUser.length; i++){
var taskCd = MY_INFO.info.taskForUser[i];
var taskNm = ALL_TASK[taskCd];
var radio = "";
radio += "<span>";
radio += "<input type='radio' id='taskSeCd"+(i+1)+"--top' name='taskSeCd' value='"+taskCd+"' title='"+taskNm+"' />";
radio += "<label for='taskSeCd"+(i+1)+"--top'>"+taskNm+"</label>";
radio += "</span>";
$("#taskSeCd--Top").append(radio);
}
//업무선택 모달 다이얼로그
if(MY_INFO.info.defaultTask == null || MY_INFO.info.defaultTask == ""){
//$("#selectTaskModal").modal("show");
//return;
}
//업무 체크
if("${param.taskSeCd}" == "" || $("#layout-navbar").find("input[name='taskSeCd'][value='${param.taskSeCd}']").length == 0){

Loading…
Cancel
Save