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

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("isAdmin", isAdmin);
userInfo.getInfo().put("hasTaskAuth", hasTaskAuth); userInfo.getInfo().put("hasTaskAuth", hasTaskAuth);
//기본업무 //사용자별 업무 및 기본업무
stngBean.initDefaultTask(userInfo); stngBean.initUserInfo(userInfo);
mav.addObject("myInfo", userInfo); mav.addObject("myInfo", userInfo);

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

@ -13,6 +13,7 @@ import cokr.xit.base.code.service.CodeQuery;
import cokr.xit.base.code.service.bean.CodeBean; import cokr.xit.base.code.service.bean.CodeBean;
import cokr.xit.base.security.Authority; import cokr.xit.base.security.Authority;
import cokr.xit.base.security.SecuredUserInfo; import cokr.xit.base.security.SecuredUserInfo;
import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.cmmn.dao.StngMapper; import cokr.xit.fims.cmmn.dao.StngMapper;
import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.UserInfo; import cokr.xit.foundation.UserInfo;
@ -29,6 +30,9 @@ public class StngBean extends AbstractComponent {
@Resource(name = "stngMapper") @Resource(name = "stngMapper")
private StngMapper stngMapper; private StngMapper stngMapper;
@Resource(name = "taskBean")
private TaskBean taskBean;
/** . /** .
* @param type * @param type
* @return * @return
@ -67,34 +71,55 @@ public class StngBean extends AbstractComponent {
return stngMapper.updateDtbnActno(params) == 1 ? true : false; return stngMapper.updateDtbnActno(params) == 1 ? true : false;
} }
/** userInfo . /** userInfo , .
* @param userInfo * @param userInfo
* @return * @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(); availableTaskList = taskList;
codeQuery.setGroupIDs("FIM054");
List<DataObject> taskList = codeBean.getCodeList(codeQuery); } 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(); availableTaskList = taskBean.getTasks((new CmmnQuery()).setSggCd((String)userInfo.getInfo().get("sggCd")).setUseYN("Y"))
if(authorities != null && !authorities.isEmpty()) { .stream().map(item -> item.string("TASK_SE_CD")).toList();
for(Authority authority : authorities) {
String authId = authority.getId();
for(int i=0; i<taskList.size(); i++) { } else { //일반사용자
String task = taskList.get(i).string("CODE");
if(authId.equals("ROLE_"+task)) { List<Authority> authorities = userInfo.getAuthorities();
hasTaskAuthList.add(task);
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; return;
} }

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

@ -59,13 +59,15 @@
<select id="selectTasks" parameterType="map" resultType="dataobject">/* 업무 정보 객체 가져오기(taskMapper.selectTasks) */ <select id="selectTasks" parameterType="map" resultType="dataobject">/* 업무 정보 객체 가져오기(taskMapper.selectTasks) */
<include refid="select" /> <include refid="select" />
WHERE T.SGG_CD = #{sggCd} WHERE T.SGG_CD = #{sggCd}
<if test="taskSeCd != null and taskSeCd != ''">
AND T.TASK_SE_CD = #{taskSeCd} AND T.TASK_SE_CD = #{taskSeCd}
</if>
<if test="useYN != null"> <if test="useYN != null">
AND T.USE_YN = #{useYN} AND T.USE_YN = #{useYN}
</if> </if>
<include refid="utility.orderBy" /> <include refid="utility.orderBy" />
</select> </select>
<select id="selectAdvntceYmdInfo" parameterType="map" resultType="dataobject">/* 사전통지 정보 객체 가져오기(taskMapper.selectAdvntceYmdInfo) */ <select id="selectAdvntceYmdInfo" parameterType="map" resultType="dataobject">/* 사전통지 정보 객체 가져오기(taskMapper.selectAdvntceYmdInfo) */
SELECT SGG_CD /* 시군구 코드 */ SELECT SGG_CD /* 시군구 코드 */
, TASK_SE_CD /* 업무 구분 코드 */ , TASK_SE_CD /* 업무 구분 코드 */

@ -124,31 +124,7 @@
</a> </a>
</li> </li>
<li> <li>
<div class="d-flex align-items-center" style="flex-flow:column"> <div id="taskSeCd--Top" 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> </div>
</li> </li>
<li> <li>

@ -72,6 +72,14 @@
pageObject.childReq = []; pageObject.childReq = [];
pageObject.parentRes = []; pageObject.parentRes = [];
var ALL_TASK = {
"PVS" : "주정차위반",
"BPV" : "전용차로위반",
"DPV" : "장애인전용",
"ECA" : "전기차주차",
"TPV" : "밤샘주차위반",
"DVS" : "미세먼지"
};
var MY_INFO = {}; var MY_INFO = {};
function getBrowserName() { function getBrowserName() {
@ -152,6 +160,24 @@
return; 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){ if("${param.taskSeCd}" == "" || $("#layout-navbar").find("input[name='taskSeCd'][value='${param.taskSeCd}']").length == 0){

Loading…
Cancel
Save