Commit f45e4933 by 罗绍泽

添加应用角色功能,添加模拟登陆配置

parent 921abd56
......@@ -8,7 +8,7 @@
<list>
<value>classpath:com/jw/app/business/portal/column/ColumnDAO.xml</value>
<value>classpath:com/jw/app/business/portal/portlet/PortletDAO.xml</value>
<value>classpath:com/jw/app/business/portal/apps/AppsDAO.xml</value>
<value>classpath:com/jw/app/business/portal/apps/appsDAO.xml</value>
<value>classpath:com/jw/app/business/portal/content/ContentDAO.xml</value>
<value>classpath:com/jw/app/business/table/TableDAO.xml</value>
......@@ -21,6 +21,7 @@
<value>classpath:com/jw/app/business/store/user/storeUserDAO.xml</value>
<value>classpath:com/jw/app/business/userchoice/userchoiceDAO.xml</value>
<value>classpath:com/jw/app/business/calendar/calendarDAO.xml</value>
<value>classpath:com/jw/app/business/portal/role/appsRoleDAO.xml</value>
</list>
</property>
</bean>
......@@ -45,6 +46,11 @@
class="com.jw.app.business.portal.content.ContentBusinessImpl">
<property name="contentDAO" ref="portal_contentDAO"/>
</bean>
<bean id="PortalAppsRoleBusiness"
class="com.jw.app.business.portal.role.AppsRoleBusinessImpl">
<property name="appsRoleDAO" ref="appsRoleDAO"/>
<property name="appsDAO" ref="portal_appsDAO"/>
</bean>
<!-- DAO -->
<bean id="portal_columnDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.jw.app.business.portal.column.ColumnDAO"/>
......@@ -59,7 +65,7 @@
<property name="sqlSessionFactory" ref="sqlSessionFactory-apps"/>
</bean>
<bean id="portal_appsDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.jw.app.business.portal.apps.AppsDAO"/>
<property name="mapperInterface" value="com.jw.app.business.portal.apps.appsDAO"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory-apps"/>
</bean>
<bean id="portal_contentDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
......@@ -70,6 +76,10 @@
<property name="mapperInterface" value="com.jw.app.business.calendar.calendarDAO"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory-apps"/>
</bean>
<bean id="appsRoleDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.jw.app.business.portal.role.appsRoleDAO"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory-apps"/>
</bean>
<!-- BusinessInterFace -->
<bean id="PortletBusiness"
class="com.jw.app.business.portlet.PortletBusinessImpl">
......@@ -79,6 +89,7 @@
<bean id="AppsBusiness"
class="com.jw.app.business.apps.AppsBusinessImpl">
<property name="appsDAO" ref="appsDAO"/>
<property name="appsRoleDAO" ref="appsRoleDAO"/>
</bean>
<bean id="StoreBusiness"
......
......@@ -69,12 +69,12 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j
<filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>
<init-param>
<param-name>casServerLoginUrl</param-name>
<param-value>http://localhost:8080/cas-jfsso/login</param-value><!-- cas 服务器登录 地址 http://IP:PORT/CasWebProName/login -->
<param-value>http://cas.jfbrother.com:9003/cas-jfsso/login</param-value><!-- cas 服务器登录 地址 http://IP:PORT/CasWebProName/login -->
</init-param>
<init-param>
<!-- 这里的server是服务端的IP -->
<param-name>serverName</param-name>
<param-value>http://localhost:8081</param-value><!-- 客户端服务器地址 http://IP:PORT -->
<param-value>http://localhost:8080</param-value><!-- 客户端服务器地址 http://IP:PORT -->
</init-param>
</filter>
<filter-mapping>
......@@ -89,11 +89,11 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j
<filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>
<init-param>
<param-name>casServerUrlPrefix</param-name>
<param-value>http://localhost:8080/cas-jfsso</param-value><!-- cas 服务器地址 http://IP:PORT/CasWebProName -->
<param-value>http://cas.jfbrother.com:9003/cas-jfsso</param-value><!-- cas 服务器地址 http://IP:PORT/CasWebProName -->
</init-param>
<init-param>
<param-name>serverName</param-name>
<param-value>http://localhost:8081</param-value><!-- 客户端服务器地址 http://IP:PORT -->
<param-value>http://localhost:8080</param-value><!-- 客户端服务器地址 http://IP:PORT -->
</init-param>
</filter>
<filter-mapping>
......
......@@ -346,3 +346,6 @@
.icon-ext-13_48 {
background:url('../../../../images/icons/(13,48).png') no-repeat left center;
}
.icon-ext-10_20 {
background:url('../../../../images/icons/(10,20).png') no-repeat left center;
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
<div id="tb">
<form id="calendarTab_searchForm" style="float:left">
<input id="FIELD_USER_ID" name="FIELD_USER_ID" type="hidden"/>
内容: <input id="FIELD_TITLE" name="FIELD_TITLE" type="text" style="width: 300px" >&nbsp;&nbsp;
内容: <input id="FIELD_TITLE" name="FIELD_TITLE" class="tableInput-easyui" type="text" style="width: 300px" >&nbsp;&nbsp;
从<input class="easyui-datetimebox" id="FIELD_START_TIME" name="FIELD_START_TIME" style="width:150px"/>&nbsp;
到 &nbsp;<input class="easyui-datetimebox" id="FIELD_END_TIME" name="FIELD_END_TIME" style="width:150px"/>&nbsp;&nbsp;
</form>
......
......@@ -11,7 +11,7 @@
<div id="tb">
<form id="calendarTab_searchForm" style="float:left">
<input id="FIELD_USER_ID" name="FIELD_USER_ID" type="hidden"/>
内容: <input id="FIELD_TITLE" name="FIELD_TITLE" type="text" style="width: 300px" >&nbsp;&nbsp;
内容: <input id="FIELD_TITLE" name="FIELD_TITLE" class="tableInput-easyui" type="text" style="width: 300px" >&nbsp;&nbsp;
从<input class="easyui-datetimebox" id="FIELD_START_TIME" name="FIELD_START_TIME" style="width:150px"/>&nbsp;
到 &nbsp;<input class="easyui-datetimebox" id="FIELD_END_TIME" name="FIELD_END_TIME" style="width:150px"/>&nbsp;&nbsp;
</form>
......
......@@ -24,5 +24,6 @@
<script type="text/javascript" src="${ctx}/jwapp/pages/portal/column/js/jwAppColumnModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/portal/apps/js/jwAppAppstoreModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/portal/portlet/js/jwAppPortletModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/portal/role/js/roleModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/portal/apps/js/appsTab.js" charset="utf-8"></script>
......@@ -17,14 +17,6 @@
</tr>
<tr>
<td class="tableStyleLable">
<span>映射应用:</span>
</td>
<td colspan="5">
<input class="easyui-textbox" id="FIELD_NAMES" name="FIELD_FIELD_NAMES" style="width:630px" value="${is_row.FIELD_NAMES}"/>
</td>
</tr>
<tr>
<td class="tableStyleLable">
<span>应用名称:</span>
</td>
<td>
......@@ -193,5 +185,33 @@
<input class="easyui-combobox" id="VERIFY_TYPE" name="FIELD_VERIFY_TYPE" data-options="required:true" style="width:130px" value="${is_row.VERIFY_TYPE}"/>
</td>
</tr>
<tr class="simulation">
<td class="tableStyleLable">
<span>用户名映射字段:</span>
</td>
<td>
<input class="easyui-textbox" data-options="required:true" id="SIMULATION_USERNAME_MAPPING" name="FIELD_SIMULATION_USERNAME_MAPPING" style="width:130px" value="${is_row.SIMULATION_USERNAME_MAPPING}"/>
</td>
<td class="tableStyleLable">
<span>密码映射字段:</span>
</td>
<td>
<input class="easyui-textbox" data-options="required:true" id="SIMULATION_PASSWORD_MAPPING" name="FIELD_SIMULATION_PASSWORD_MAPPING" style="width:130px" value="${is_row.SIMULATION_PASSWORD_MAPPING}"/>
</td>
<td class="tableStyleLable">
<span>加密方式</span>
</td>
<td>
<input class="easyui-combobox" data-options="required:true" id="SIMULATION_PASSWORD_ENCRYPTION" name="FIELD_SIMULATION_PASSWORD_ENCRYPTION" style="width:130px" value="${is_row.SIMULATION_PASSWORD_ENCRYPTION}"/>
</td>
</tr>
<tr class="simulation">
<td class="tableStyleLable">
<span>登录URL:</span>
</td>
<td colspan="5">
<input class="easyui-textbox" data-options="required:true" id="SIMULATION_LOGIN_URL" name="FIELD_SIMULATION_LOGIN_URL" style="width:630px" value="${is_row.SIMULATION_LOGIN_URL}"/>
</td>
</tr>
</table>
</form>
......@@ -60,9 +60,9 @@ var v_entity_datasource = [{CODE_ID:'0',CODE_NAME:'手工录入'},
{CODE_ID:'6',CODE_NAME:'集成应用'}];
//授权角色
var v_gidquery = {};
var v_gid_data = jwAppCommonModel.jwAppsCommonDataAction.listSysRoleAll(v_gidquery);
var v_gidquery1 = {"DPT_NO":"all","DPT_NAME":"所有用戶"};
v_gid_data.rowSet.push(v_gidquery1);
var v_gid_data = roleModule.data.listAllRoleInfo(v_gidquery);
var v_gidquery1 = {"UUID":"all","ROLE_NAME":"所有角色"};
v_gid_data.rowSet.unshift(v_gidquery1);
//集成门户
var v_portlet_data = jwAppPortletModel.jwAppsPortletDataAction.listAllPTemplate({"FIELD_P_TYPE":"6"});
......@@ -80,6 +80,9 @@ var v_entity_verify = [{CODE_ID:'0',CODE_NAME:'模拟登录'},
//映射应用
var v_apps_base = jwAppPortletModel.jwAppsPortletDataAction.listBaseApps();
//加密方式
var v_simulation_password_encryption = [{CODE_ID:'0',CODE_NAME:'无'},
{CODE_ID:'1',CODE_NAME:'BASE64'}];
/****/
/**
......@@ -245,6 +248,7 @@ function addRow(){
}
//加载增加子页面成功后的回调
function addUrlOnloadCallback(is_row){
simulationToggle(1);
//console.log(is_row);
//$("#appUserFileImage").attr("src","jwapp/pages/apps/photo.jsp?ls_photo="+is_row.IMG_ID_S);
$("#app_content_image").hide();
......@@ -273,10 +277,41 @@ function addUrlOnloadCallback(is_row){
});
$('#G_ID').combobox({
data : v_gid_data.rowSet,
valueField : 'DPT_NO',
textField : 'DPT_NAME',
valueField : 'UUID',
textField : 'ROLE_NAME',
panelHeight : 'auto',
editable:false
multiple : true,
formatter : function(row) {
var opts;
if (row.selected == true) {
opts = "<input type='checkbox' checked='checked' id='" + row.UUID + "' value='" + row.UUID + "'>" + row.ROLE_NAME + "</input>";
} else {
opts = "<input type='checkbox' id='" + row.UUID + "' value='" + row.UUID + "'>" + row.ROLE_NAME + "</input>";
}
return opts;
},
onSelect : function(rec) {
if(rec.UUID=='all'){
//如果选中了所有角色
//则将该节点外的其他节点均变为未选中状态
var checkedIds=$('#G_ID').combobox('getValues');
for(var i=0;i<checkedIds.length;i++){
if(checkedIds[i]=='all'){
continue;
}
$('#G_ID').combobox('unselect',checkedIds[i]);
}
}else{
$('#G_ID').combobox('unselect','all');
}
oCheckbox = document.getElementById(rec.UUID);
$(oCheckbox).prop("checked",true);
},
onUnselect : function(rec) {
oCheckbox = document.getElementById(rec.UUID);
$(oCheckbox).prop("checked",false);
},
editable : false
});
$('#IS_POPUP').combobox({
data : v_yesno_data.rowSet,
......@@ -306,20 +341,50 @@ function addUrlOnloadCallback(is_row){
editable:false,
panelHeight:'auto'
});
$('#SIMULATION_PASSWORD_ENCRYPTION').combobox({
data : v_simulation_password_encryption,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
$('#VERIFY_TYPE').combobox({
data : v_entity_verify,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
panelHeight:'auto',
onSelect:function(record){
simulationToggle(record.CODE_ID);
}
});
}
function simulationToggle(codeId){
if(codeId==0){
//显示模拟登录的配置信息
$(".simulation").show();
$("#SIMULATION_USERNAME_MAPPING").textbox('enableValidation');
$("#SIMULATION_PASSWORD_MAPPING").textbox('enableValidation');
$("#SIMULATION_PASSWORD_ENCRYPTION").textbox('enableValidation');
$("#SIMULATION_LOGIN_URL").textbox('enableValidation');
}else{
//隐藏模拟登录的配置信息
$(".simulation").hide();
$("#SIMULATION_USERNAME_MAPPING").textbox('disableValidation');
$("#SIMULATION_PASSWORD_MAPPING").textbox('disableValidation');
$("#SIMULATION_PASSWORD_ENCRYPTION").textbox('disableValidation');
$("#SIMULATION_LOGIN_URL").textbox('disableValidation');
}
}
//保存
function insertData(is_entity){
//var g_ids = $('#G_ID').combobox('getValues');
// is_entity.FIELD_G_ID = json2str_dh(g_ids);
is_entity.FIELD_PUB_DATE = strToDateObj(is_entity.FIELD_PUB_DATE);
is_entity.FIELD_OPEN_TIME = strToDateObj(is_entity.FIELD_OPEN_TIME);
is_entity.FIELD_G_ID =$('#G_ID').combobox('getValues').join(',');
var data = {};
data = appstoreModel.actAction.insertApp(is_entity);
......@@ -381,10 +446,46 @@ function updateUrlOnloadCallback(is_row){
});
$('#G_ID').combobox({
data : v_gid_data.rowSet,
valueField : 'DPT_NO',
textField : 'DPT_NAME',
valueField : 'UUID',
textField : 'ROLE_NAME',
panelHeight : 'auto',
editable:false
editable:false,
multiple : true,
formatter : function(row) {
var opts='';
var roleIds=is_row.G_ID.split(',');
for(var i=0;i<roleIds.length;i++){
if(roleIds[i]==row.UUID){
opts = "<input type='checkbox' checked='checked' id='" + row.UUID + "' value='" + row.UUID + "'>" + row.ROLE_NAME + "</input>";
break;
}
}
if (opts=='') {
opts = "<input type='checkbox' id='" + row.UUID + "' value='" + row.UUID + "'>" + row.ROLE_NAME + "</input>";
}
return opts;
},
onSelect : function(rec) {
if(rec.UUID=='all'){
//如果选中了所有角色
//则将该节点外的其他节点均变为未选中状态
var checkedIds=$('#G_ID').combobox('getValues');
for(var i=0;i<checkedIds.length;i++){
if(checkedIds[i]=='all'){
continue;
}
$('#G_ID').combobox('unselect',checkedIds[i]);
}
}else{
$('#G_ID').combobox('unselect','all');
}
oCheckbox = document.getElementById(rec.UUID);
$(oCheckbox).prop("checked",true);
},
onUnselect : function(rec) {
oCheckbox = document.getElementById(rec.UUID);
$(oCheckbox).prop("checked",false);
}
});
$('#IS_POPUP').combobox({
data : v_yesno_data.rowSet,
......@@ -414,13 +515,24 @@ function updateUrlOnloadCallback(is_row){
editable:false,
panelHeight:'auto'
});
$('#SIMULATION_PASSWORD_ENCRYPTION').combobox({
data : v_simulation_password_encryption,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
$('#VERIFY_TYPE').combobox({
data : v_entity_verify,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
panelHeight:'auto',
onSelect:function(record){
simulationToggle(record.CODE_ID);
}
});
simulationToggle(is_row.VERIFY_TYPE);
//var row = $('#list').datagrid('getSelections');
//$("#appUserFileImage").attr("src","jwapp/pages/apps/photo.jsp?ls_photo="+row[0].IMG_ID_S);
//$("#appUserFileImage").attr("src","jwapp/pages/apps/photo.jsp?ls_photo="+"D:/workspace2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/jwgV4portal/uploadFile/apps/apps/15060651209957448.png");
......@@ -429,14 +541,16 @@ function updateUrlOnloadCallback(is_row){
function updateData(is_entity){
is_entity.FIELD_PUB_DATE = strToDateObj(is_entity.FIELD_PUB_DATE);
is_entity.FIELD_OPEN_TIME = strToDateObj(is_entity.FIELD_OPEN_TIME);
is_entity.FIELD_G_ID =$('#G_ID').combobox('getValues').join(',');
var v_result = appstoreModel.actAction.updateApp(is_entity);
//自动为授予角色用户默认安装
/* var v_default_data = {};
var v_default_data = {};
v_default_data.FIELD_APP_ID = is_entity.FIELD_APP_ID;
v_default_data.FIELD_G_ID = is_entity.FIELD_G_ID;
v_default_data.FIELD_IS_DEFAULT = is_entity.FIELD_IS_DEFAULT
var v_result = appstoreModel.actAction.insertDefaultInstall(v_default_data);*/
var v_result = appstoreModel.actAction.insertDefaultInstall(v_default_data);
$('#list').datagrid('reload', {});
return v_result;
......
//此乃本模块与后台交互的方法接口部分
var roleModule = function(format) {
this.module = "";
this.action = "";
this.format = format;
};
//定义数据交互
roleModule.prototype = BusinessObject;
//获取角色信息
roleModule.prototype.listRoleInfo = function(){};
//保存角色信息
roleModule.prototype.saveRoleInfo = function(){};
//删除角色信息
roleModule.prototype.removeRoleInfo = function(){};
//保存角色人员
roleModule.prototype.saveUserByRoleId = function(){};
//获取全部角色信息
roleModule.prototype.listAllRoleInfo = function(){};
//创建一个数据操作对象,然后再后续使用
roleModule.act = new roleModule("json").delegate("jwAppsRoleAct");
//创建一个数据获取对象,然后再后续使用
roleModule.data = new roleModule("json").delegate("jwAppsRoleData");
//说明: 1、所有方法里统一传递josn格式的参数,用于后台交互,如data.listTables(param) ,如没有参数则传'{}',如data.listTables({})
// 2、前后台数据获取传输协议 如:json[{'0':{pageCount':'2','pageNo':'1','pageSize':'20','rowSet':'[{0},{1}....]'}}]
// 3、前后台增删改的返回状态 如:json[{'0':{'rowSet':{'NAME':'-1','VALUE':'保存失败'}}}]
/**
* 序号:1
* 功能:定义分页(EasyUI)
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:无需更改
**/
var ls_width = $(window).width();
var ls_height = $(window).height();
var local_page=1;
var rows=20;
var listPageSize = [10,20,50,100,500,1000];
var queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
var tab_n = 0;
//重置分页参数
function resetQueryData(){
queryData = "";
queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
}
//定义附件关联模块ID(1:一般业务,2:测试信息,3:审批业务,999:其它数据 )
var ls_module_id='2';
//定义当前模块业务类型(YBYW:一般业务,SPGL:审批业务)
var ls_ywlx = 'YBYW';
/****/
/**
* 序号:2
* 功能:构建下拉框内容
* 参数:
* 说明:方便新增、修改页面里的下拉选项加载数据
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
/****/
/**
* 序号:3
* 功能:构建主页面列表
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//定义grid列表
var ls_title="角色管理";
var is_column = [ [
{field : 'ROLE_NAME',title : '角色名称',width : 120,align : 'left'},
{field : 'DESCRIBE_INFO',title : '描述',width : 380,align : 'left'},
{field : 'CREATE_USER_NAME',title : '创建人员',width : 100,align : 'center'},
{field : 'CREATE_TIME',title : '创建时间',width : 120,align : 'center'},
{field : 'UPDATE_USER_NAME',title : '更新人员',width : 100,align : 'center'},
{field : 'UPDATE_TIME',title : '更新时间',width : 120,align : 'center'}
] ];
//列表加载完成回调
function dataOnLoadSuccess(){
}
//设置颜色和每行高度
function rowstyler(index,row){
return 'color:blue;height:30px;';
}
//展示列表
datagrid("list",ls_title,gaowj.WEB_APP_NAME + "/jwAppsRoleData_listRoleInfo",queryData,is_column,60,80);
/****/
/**
* 序号:4
* 功能:设置主页面操作列菜单
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//操用列显示更多(一般情况下无需更改)
function formatMenu(value, data,index) {
var returnData="";
return returnData
+ "<span class=\"icon-ext-moremenu\" style=\"padding-left:20px;*width:20px;\"></span>"
+ "<span data-p1="+index+" class=\"easyui-tooltip\" style=\"color:blue;cursor:pointer;\">更多</span>";
}
//上浮横向菜单集里的具体菜单项(需更改)
function getOptionMenu(data,index){
var returnData= "<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"editRow('"
+ index + "')\">编辑</a> | <span class=\"icon-clear\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"deleteRow('"
+ index + "')\">删除</a> | <span class=\"icon-ext-09_42\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"chosePerson('"
+ index + "')\">人员选择</a>";
return returnData;
}
//返回菜单集的菜单个数(需更改)
function getOptionMenuCount(){
var is_menu_count = 3.3;
return is_menu_count;
}
/****/
/**
* 序号:5
* 功能:新增修改弹出
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载增加子页面
function addRow(){
var is_row={OPETYPE:'insert'};
openEditRow("jwAppsRoleView_roleTabDetail",is_row,"新增",true,0.65,0.95,0,0);
}
//加载增加子页面成功后的回调
function addUrlOnloadCallback(is_row){
$('#SORT_NUM').numberspinner({
required:true,
min: 1,
max: 9999,
value:1,
increment:1
});
}
//保存
function insertData(is_entity){
var v_result = roleModule.act.saveRoleInfo(is_entity);
$('#list').datagrid('reload');
return v_result;
}
//加载修改子页面
function editRow(index) {
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
is_row[0].OPETYPE = 'update';
openEditRow("jwAppsRoleView_roleTabDetail",is_row[0],"编辑",true,0.65,0.95,0,0);
}
//加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){
var new_is_row={};
for(k in is_row){
new_is_row['FIELD_'+k]=is_row[k];
}
$("#inputForm").form('load',new_is_row);
}
//保存
function updateData(is_entity){
var v_result = roleModule.act.saveRoleInfo(is_entity);
$('#list').datagrid('reload');
return v_result;
}
/****/
/**
* 序号:6
* 功能:单个删除
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function deleteRow(index){
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
var code = is_row[0].UUID;
$.messager.confirm('提示', '确定删除?', function(r) {
if (r) {
var v_query = {};
v_query.UUID = code;
var v_result = roleModule.act.removeRoleInfo(v_query);
$.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload');
}
});
}
/****/
/**
* 序号:7
* 功能:批量删除
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function deleteBatchRow(){
var code="";
var rows = $('#list').datagrid('getSelections');
for(var i=0; i<rows.length; i++){
code = code + rows[i].UUID+",";
}
if(rows == null || rows == ""){
$.messager.alert('提示',"请选择需删除的记录!",'info');
return;
}
if(code.length>0){
code = code.substring(0,code.length - 1);
}
$.messager.confirm('提示', '确定删除?', function(r) {
if (r) {
var v_query = {};
v_query.UUID = code;
var v_result = roleModule.act.removeRoleInfo(v_query);
$.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload');
}
});
}
/****/
/**
* 序号:8
* 功能:刷新
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function refreshRow(){
$('#list').datagrid('load',{});
$("#roleTab_searchForm")[0].reset();
}
/****/
/**
* 序号:9
* 功能:查询
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function searchRow(){
var v_query = $("#roleTab_searchForm").getFormVal();
$('#list').datagrid('load',v_query);
}
/****/
/**
* 序号:10
* 功能:高级查询弹出
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载高级查询子页面
function advsearchRow(){
}
//加载高级查询子页面成功后的回调
function addAdvsearchCallback(is_row){
}
//高级查询
function advsearchData(is_entity){
}
/****/
/**
* 序号:11
* 功能:处理接口附件
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function uploadcommonRow(index){
}
/****/
/**
* 序号:12
* 功能:批量处理接口附件
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function uploadcommonBatchRow(){
}
/**
* 序号:13
* 功能:角色选人
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2018-08-09
* 单位:杰夫兄弟
* 备注:需更改
**/
function chosePerson(index){
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
var modifyUrl = gaowj.WEB_APP_NAME+"/jwAppsRoleView_userChoice?FIELD_UUID="+is_row[0].UUID;
is_row[0].G_ID=is_row[0].UUID;
openViewIframGroup("userTabChoice",modifyUrl,is_row[0],"人员选择",false,0.27,0.95,160,0);
}
//添加授权
function addToGroup(is_entity, is_type) {
var selectUser = document.getElementById("return_text").innerHTML;
var v_query = {};
v_query.FIELD_SELECT_USER = selectUser;
v_query.FIELD_ROLE_ID = is_entity;
var result = roleModule.act.saveUserByRoleId(v_query);
return result;
}
\ No newline at end of file
/**
* 序号:1
* 功能:定义分页(EasyUI)
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:无需更改
**/
var ls_width = $(window).width();
var ls_height = $(window).height();
$(window).resize(function(){
ls_width = $(window).width();
ls_height = $(window).height();
});
var local_page=1;
var rows=20;
var listPageSize = [10,20,50,100,500,1000];
var queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
var tab_n = 0;
//重置分页参数
function resetQueryData(){
queryData = "";
queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
}
//定义用户当前全局参数
var ls_node=null;//当前选中的Node
queryData.FIELD_UNIT_ID_IS_PARENT='A';
var uuid = $.getUrlParam('FIELD_UUID');
/**
* 序号:6
* 功能:加载单位树列表
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
var setting = setInitTreeGroup("NAME","NAME","UUID","PARENT_ID");
loadTreeGroup("jwAppsRoleData_listAllUser?FIELD_ROLE_ID="+uuid,"usertab_user_tree","UUID","1_0");
function getTreeNode(treeNode){
parent.$('#return_text').text(treeNode);
}
function defautClick(zTree,treeNode){
var nodes = zTree.getCheckedNodes(true);
v="";
for(var i=0;i<nodes.length;i++){
v+=nodes[i].UUID + ",";
}
getTreeNode(v);
}
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="roleTab">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<form id="roleTab_searchForm" style="float:left">
<input id="FIELD_USER_ID" name="FIELD_USER_ID" type="hidden"/>
角色名称: <input id="FIELD_ROLE_NAME" name="FIELD_ROLE_NAME" class="tableInput-easyui" type="text" style="width: 120px" >&nbsp;&nbsp;
描述: <input id="FIELD_DESCRIBE_INFO" name="FIELD_DESCRIBE_INFO" class="tableInput-easyui" type="text" style="width: 200px" >&nbsp;&nbsp;
</form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
</div>
<div id="detail" style="overflow:auto;"></div>
<div id="userTabChoice" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/portal/role/js/roleModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/portal/role/js/roleTab.js" charset="utf-8"></script>
<%@page contentType="text/html; charset=UTF-8"%>
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" />
<input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}" />
<input type="hidden" name="FIELD_USER_ID" id="USER_ID" value="${is_row.USER_ID}" />
<table align="center" border="0" cellpadding="0" cellspacing="0" class="tableStyle" style="margin: 10px 15px; width: 95%; line-height: 30px;">
<tr>
<td style="width: 15%;" class="tableStyleLable"><span>角色名称:</span></td>
<td style="width: 85%">
<input class="easyui-textbox" data-options="required:true" id="ROLE_NAME" name="FIELD_ROLE_NAME" style="width:300px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable"><span>描述:</span></td>
<td style="width: 85%">
<input class="easyui-textbox" data-options="required:true" id="DESCRIBE_INFO" name="FIELD_DESCRIBE_INFO" style="width:300px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable"><span>排序号:</span></td>
<td style="width: 85%">
<input id="SORT_NUM" name="FIELD_SORT_NUM" style="width:300px" />
</td>
</tr>
</table>
</form>
\ No newline at end of file
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="userChoice_css">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<div id="userChoice_layout" class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
<div data-options="region:'west',split:true,iconCls:'icon-ext-06_29'" style="width: 300px;">
<ul id="usertab_user_tree" class="ztree"></ul>
</div>
<script type="text/javascript" src="${ctx}/jwapp/pages/portal/role/js/userChoice.js" charset="utf-8"></script>
......@@ -248,6 +248,20 @@
<action name="jwAppsContentView_*" class="com.jw.app.portal.content.action.viewAction" method="{1}">
<result name="{1}">/jwapp/pages/portal/content/{1}.jsp</result>
</action>
<action name="jwAppsRoleView_*" class="com.jw.app.portal.role.action.viewAction" method="{1}">
<result name="{1}">/jwapp/pages/portal/role/{1}.jsp</result>
</action>
<action name="jwAppsRoleData_*" class="com.jw.app.portal.role.action.dataAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="jwAppsRoleAct_*" class="com.jw.app.portal.role.action.actAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
</package>
<package name="caslogin" extends="struts-default,json-default">
......
package com.jw.app.business;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
@Service
public interface PortalAppsRoleBusiness {
Page<Map<String,Object>> list_apps_role(int pageNo, int pageSize,Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_all_apps_role(Map<String, Object> query) throws BusinessException ;
Map<String, Object> save_apps_role(Map<String, Object> info) throws BusinessException;
void delete_apps_role(String uuids) throws BusinessException;
List<Map<String, Object>> list_all_user(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_all_user_by_roleId(Map<String, Object> query) throws BusinessException;
void saveUserByRoleId(String roleId,String users) throws BusinessException;
}
......@@ -14,11 +14,14 @@ import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.SessionUtil;
import com.jw.app.business.AppsBusiness;
import com.jw.app.business.utils.QueryParamUtil;
import com.jw.app.business.portal.role.appsRoleDAO;
public class AppsBusinessImpl implements AppsBusiness {
private AppsDAO appsDAO;
private appsRoleDAO appsRoleDAO;
public AppsDAO getAppsDAO() {
return appsDAO;
}
......@@ -27,13 +30,30 @@ public class AppsBusinessImpl implements AppsBusiness {
this.appsDAO = appsDAO;
}
public appsRoleDAO getAppsRoleDAO() {
return appsRoleDAO;
}
public void setAppsRoleDAO(appsRoleDAO appsRoleDAO) {
this.appsRoleDAO = appsRoleDAO;
}
@Override
public List<Map<String, Object>> list_allApps_by_user(Map<String, Object> query) throws BusinessException {
List<Map<String, Object>> listData = null;
try {
//根据当前登陆人id获取所有的角色id
Map<String, Object> query2=new HashMap<String, Object>();
query2.put("USER_ID", SessionUtil.getEmid());
List<Map<String, Object>> listRole=appsRoleDAO.list_all_role_by_userId(query2);
List<String> listRoleId=new ArrayList<String>();
for(Map<String, Object> role:listRole){
listRoleId.add("%"+role.get("ROLE_ID").toString()+"%");
}
query.put("USER_ID", SessionUtil.getEmid());
Map<String, Object> m=SessionUtil.getSessionUser();
query.put("USER_ROLE", m.get("EMDEPART"));
query.put("G_IDS", listRoleId);
listData = QueryParamUtil.ClobToString(appsDAO.list_allApps_by_user(query));
} catch (IOException e) {
// TODO Auto-generated catch block
......@@ -133,6 +153,17 @@ public class AppsBusinessImpl implements AppsBusiness {
public List<Map<String, Object>> list_AllApps(Map<String, Object> query) throws BusinessException {
List<Map<String, Object>> listData = null;
try {
//根据当前登陆人id获取所有的角色id
Map<String, Object> query2=new HashMap<String, Object>();
query2.put("USER_ID", SessionUtil.getEmid());
List<Map<String, Object>> listRole=appsRoleDAO.list_all_role_by_userId(query2);
List<String> listRoleId=new ArrayList<String>();
for(Map<String, Object> role:listRole){
listRoleId.add("%"+role.get("ROLE_ID").toString()+"%");
}
//只能查看有权限的
query.put("G_IDS", listRoleId);
listData = QueryParamUtil.ClobToString(appsDAO.list_AllApps(query));
} catch (IOException e) {
// TODO Auto-generated catch block
......
......@@ -7,7 +7,14 @@
SELECT ai_in.* FROM app_install ai_in where ai_in.USERID=#{USER_ID}
) ai
RIGHT JOIN apps_app apps ON ai.APP_ID=apps.APP_ID
where apps.G_ID=#{USER_ROLE} OR apps.G_ID='all'
<where>
apps.G_ID='all'
<if test="G_IDS != null and G_IDS != ''">
<foreach collection="G_IDS" item="G_ID">
OR apps.G_ID like #{G_ID}
</foreach>
</if>
</where>
</select>
<select id="list_allCategory" parameterType="map"
......@@ -62,7 +69,15 @@
<select id="list_AllApps" parameterType="map"
resultType="upperCaseKeyMap">
SELECT * FROM apps_app
SELECT * FROM apps_app apps
<where>
apps.G_ID='all'
<if test="G_IDS != null and G_IDS != ''">
<foreach collection="G_IDS" item="G_ID">
OR apps.G_ID like #{G_ID}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -18,13 +18,13 @@ import com.jw.app.business.PortalAppsBusiness;
public class AppsBusinessImpl implements PortalAppsBusiness {
private AppsDAO appsDAO;
private appsDAO appsDAO;
public AppsDAO getAppsDAO() {
public appsDAO getAppsDAO() {
return appsDAO;
}
public void setAppsDAO(AppsDAO appsDAO) {
public void setAppsDAO(appsDAO appsDAO) {
this.appsDAO = appsDAO;
}
......
......@@ -7,7 +7,7 @@ import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
public interface AppsDAO {
public interface appsDAO {
//APP_ACCOUNT 模拟登陆帐号密码管理
void insert_app_account(Map<String,Object> entity) throws BusinessException ;
......@@ -61,6 +61,8 @@ public interface AppsDAO {
void delete_install_app_user(Map<String, Object> query) throws BusinessException ;
void delete_install_app_byuser(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_install(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_install(Map<String,Object> query) throws BusinessException ;
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jw.app.business.portal.apps.AppsDAO">
<mapper namespace="com.jw.app.business.portal.apps.appsDAO">
<!-- APP_ACCOUNT 模拟登陆帐号密码管理 -->
<insert id="insert_app_account" parameterType="map">
insert into APP_ACCOUNT(
......@@ -367,6 +367,26 @@
</if>
</delete>
<delete id="delete_install_app_byuser" parameterType="map">
<![CDATA[
delete from APP_INSTALL
]]>
<where>
<if test="USERIDS != null and USERIDS != ''">
<foreach collection="USERIDS" item="USERID" separator=" OR ">
(USERID = #{USERID}
<if test="APP_IDS != null and APP_IDS != ''">
AND APP_ID IN
<foreach collection="APP_IDS" item="APP_ID" open="(" close=")" separator=",">
#{APP_ID}
</foreach>
</if>
)
</foreach>
</if>
</where>
</delete>
<select id="list_install" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*,app.NAME APPNAME,app.PUB_DATE APPPUB_DATE,app.CATEGORY APPCATEGORY,app.LINK APPLINK,app.IMG_ID_L APPIMG_ID_L,app.IMG_ID_M APPIMG_ID_M,
......
package com.jw.app.business.portal.role;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.SessionUtil;
import com.jw.app.business.PortalAppsRoleBusiness;
import com.jw.app.business.portal.apps.appsDAO;
public class AppsRoleBusinessImpl implements PortalAppsRoleBusiness {
private appsRoleDAO appsRoleDAO;
private appsDAO appsDAO;
public appsRoleDAO getAppsRoleDAO() {
return appsRoleDAO;
}
public void setAppsRoleDAO(appsRoleDAO appsRoleDAO) {
this.appsRoleDAO = appsRoleDAO;
}
public appsDAO getAppsDAO() {
return appsDAO;
}
public void setAppsDAO(appsDAO appsDAO) {
this.appsDAO = appsDAO;
}
@Override
public Page<Map<String, Object>> list_apps_role(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException {
// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
// 查询条件处理
if (query.get("ROLE_NAME") != null && !"".equals(query.get("ROLE_NAME"))) {
query.put("ROLE_NAME_LIKE", "%" + query.get("ROLE_NAME") + "%");
}
if (query.get("DESCRIBE_INFO") != null && !"".equals(query.get("DESCRIBE_INFO"))) {
query.put("DESCRIBE_INFO_LIKE", "%" + query.get("DESCRIBE_INFO") + "%");
}
List<Map<String, Object>> items = appsRoleDAO.list_apps_role(new RowBounds(pageStart, pageSize), query);
int count = appsRoleDAO.list_count_apps_role(query);
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_all_apps_role(Map<String, Object> query) throws BusinessException {
// 查询条件处理
if (query.get("ROLE_NAME") != null && !"".equals(query.get("ROLE_NAME"))) {
query.put("ROLE_NAME_LIKE", "%" + query.get("ROLE_NAME") + "%");
}
if (query.get("DESCRIBE_INFO") != null && !"".equals(query.get("DESCRIBE_INFO"))) {
query.put("DESCRIBE_INFO_LIKE", "%" + query.get("DESCRIBE_INFO") + "%");
}
return appsRoleDAO.list_apps_role(query);
}
@Override
public Map<String, Object> save_apps_role(Map<String, Object> info) throws BusinessException {
if (info.get("UUID") == null || "".equals(info.get("UUID"))) {
// 表示新增
info.put("UUID", UUID.randomUUID().toString());
info.put("CREATE_USER", SessionUtil.getEmid());
info.put("CREATE_TIME", new Date());
info.put("UPDATE_USER", SessionUtil.getEmid());
info.put("UPDATE_TIME", new Date());
List<Map<String, Object>> listField = new ArrayList<Map<String, Object>>();
for (String k : info.keySet()) {
Map<String, Object> field = new HashMap<String, Object>();
field.put("key", k);
field.put("value", info.get(k));
listField.add(field);
}
info.put("list", listField);
appsRoleDAO.insert_apps_role(info);
} else {
// 表示更新
info.put("UPDATE_USER", SessionUtil.getEmid());
info.put("UPDATE_TIME", new Date());
List<Map<String, Object>> listField = new ArrayList<Map<String, Object>>();
for (String k : info.keySet()) {
if ("UUID".equals(k)) {
continue;
}
Map<String, Object> field = new HashMap<String, Object>();
field.put("key", k);
field.put("value", info.get(k));
listField.add(field);
}
info.put("list", listField);
appsRoleDAO.update_apps_role(info);
}
return info;
}
@Override
public void delete_apps_role(String uuids) throws BusinessException {
List<String> listUuid = new ArrayList<String>();
for (String uuid : uuids.split(",")) {
listUuid.add(uuid);
appsRoleDAO.delete_apps_role_user_by_roleId(uuid);
}
appsRoleDAO.delete_apps_role(listUuid);
}
@Override
public List<Map<String, Object>> list_all_user(Map<String, Object> query) throws BusinessException {
return appsRoleDAO.list_all_user(query);
}
@Override
public List<Map<String, Object>> list_all_user_by_roleId(Map<String, Object> query) throws BusinessException {
return appsRoleDAO.list_all_user_by_roleId(query);
}
@Override
public void saveUserByRoleId(String roleId, String users) throws BusinessException {
// 查询该角色下原本有的人员
Map<String, Object> query = new HashMap<String, Object>();
query.put("ROLE_ID", roleId);
List<Map<String, Object>> listUsersOld = appsRoleDAO.list_all_user_by_roleId(query);
// 查询该角色用于哪些app
Map<String, Object> query2 = new HashMap<String, Object>();
query2.put("G_ID", roleId);
List<Map<String, Object>> listApp = appsDAO.list_app(query2);
// 删除原先该角色下所有的用户
appsRoleDAO.delete_apps_role_user_by_roleId(roleId);
// 重新添加用户
String[] arrayUser = null;
if (users != null && !"".equals(users)) {
arrayUser = users.split(",");
for (String userId : arrayUser) {
Map<String, Object> info = new HashMap<String, Object>();
info.put("USER_ID", userId);
info.put("ROLE_ID", roleId);
info.put("UUID", UUID.randomUUID().toString());
info.put("CREATE_USER", SessionUtil.getEmid());
info.put("CREATE_TIME", new Date());
info.put("UPDATE_USER", SessionUtil.getEmid());
info.put("UPDATE_TIME", new Date());
List<Map<String, Object>> listField = new ArrayList<Map<String, Object>>();
for (String k : info.keySet()) {
Map<String, Object> field = new HashMap<String, Object>();
field.put("key", k);
field.put("value", info.get(k));
listField.add(field);
}
info.put("list", listField);
appsRoleDAO.insert_apps_role_user(info);
}
}
if (arrayUser == null) {
arrayUser = new String[] {};
}
// 获取少了哪些用户
List<String> listLessUser = new ArrayList<String>();
outer: for (Map<String, Object> user : listUsersOld) {
for (String userId : arrayUser) {
if (userId.equals(user.get("USER_ID"))) {
continue outer;
}
}
listLessUser.add(user.get("USER_ID").toString());
}
// 获取多了哪些用户
List<String> listMuchUser = new ArrayList<String>();
outer: for (String userId : arrayUser) {
for (Map<String, Object> user : listUsersOld) {
if (userId.equals(user.get("USER_ID"))) {
continue outer;
}
}
listMuchUser.add(userId);
}
// 循环遍历这些app,如果这些app是默认需要安装的,则给多了的用户添加安装数据
List<String> listAppId = new ArrayList<String>();
for (Map<String, Object> app : listApp) {
listAppId.add(app.get("APP_ID").toString());
// 判断是否需要默认安装
if ("1".equals(app.get("IS_DEFAULT"))) {
// 需要安装
for (String userId : listMuchUser) {
Map<String, Object> entityNew = new HashMap<String, Object>();
entityNew.put("APP_ID", app.get("APP_ID").toString());
entityNew.put("USERID", userId);
insert_install(entityNew);
}
}
}
// 删除少了的用户对应这些app的安装记录
Map<String, Object> query4 = new HashMap<String, Object>();
query4.put("USERIDS", listLessUser);
query4.put("APP_IDS", listAppId);
appsDAO.delete_install_app_byuser(query4);
}
private void insert_install(Map<String, Object> entity) throws BusinessException {
if (entity.get("RESOURCE_ID") == null) {
entity.put("RESOURCE_ID", java.util.UUID.randomUUID().toString());
}
if (entity.get("USERID") == null) {
entity.put("USERID", SessionUtil.getCode());
}
if (entity.get("INSTALL_TIME") == null) {
entity.put("INSTALL_TIME", new Date());
}
// 动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if (entity.keySet() != null) {
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_install(entity);
}
//
}
}
package com.jw.app.business.portal.role;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
public interface appsRoleDAO {
List<Map<String, Object>> list_apps_role(Map<String, Object> query) throws BusinessException;
int list_count_apps_role(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_apps_role(RowBounds rowbounds, Map<String, Object> query) throws BusinessException;
void insert_apps_role(Map<String, Object> info) throws BusinessException;
void update_apps_role(Map<String, Object> info) throws BusinessException;
void delete_apps_role(List<String> uuids) throws BusinessException;
List<Map<String, Object>> list_all_user(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_all_user_by_roleId(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_all_role_by_userId(Map<String, Object> query) throws BusinessException;
void insert_apps_role_user(Map<String, Object> info) throws BusinessException;
void delete_apps_role_user_by_roleId(String roleId) throws BusinessException;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jw.app.business.portal.role.appsRoleDAO">
<sql id="WHERE">
<where>
<trim prefixOverrides="AND |OR">
<if test="ROLE_NAME_LIKE != null and ROLE_NAME_LIKE != ''">
and ROLE_NAME LIKE #{ROLE_NAME_LIKE}
</if>
<if test="DESCRIBE_INFO_LIKE != null and DESCRIBE_INFO_LIKE != ''">
and DESCRIBE_INFO LIKE #{DESCRIBE_INFO_LIKE}
</if>
</trim>
</where>
</sql>
<select id="list_apps_role" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select t.*
,u1.USER_NAME AS CREATE_USER_NAME
,u2.USER_NAME AS UPDATE_USER_NAME
from apps_role t
left join uicm_user u1
on t.CREATE_USER=u1.USER_ID
left join uicm_user u2
on t.UPDATE_USER=u2.USER_ID
]]>
<include refid="WHERE" />
ORDER BY t.SORT_NUM ASC
</select>
<select id="list_count_apps_role" parameterType="map" resultType="int">
<![CDATA[
select count(*) from apps_role t
]]>
<include refid="WHERE" />
</select>
<insert id="insert_apps_role" parameterType="java.util.List">
insert into apps_role(
<trim prefix="" suffixOverrides=",">
<foreach collection="list" item="field">
${field.key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="list" item="field">
#{field.value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_apps_role" parameterType="java.util.List">
update apps_role set
<trim prefix="" suffixOverrides=",">
<foreach collection="list" item="field">
${field.key}=#{field.value},
</foreach>
</trim>
where UUID=#{UUID}
</update>
<delete id="delete_apps_role" parameterType="java.util.List">
delete from apps_role where
UUID in
<trim prefix="(" suffix=")" suffixOverrides=",">
<foreach collection="uuids" item="uuid">
#{uuid},
</foreach>
</trim>
</delete>
<select id="list_all_user" parameterType="map" resultType="upperCaseKeyMap">
select tree.*
,case when aru.UUID is null then 0 else 1 end as CHK
FROM (
select unit.UUID,unit.NAME AS NAME,unit.PARENT_ID,'0' as type from uicm_unit unit
UNION ALL
select users.USER_ID as UUID,users.USER_NAME AS NAME,account.UNIT_ID as PARENT_ID,'1' as type from uicm_user users
LEFT JOIN uicm_user_account account
ON users.USER_ID=account.USER_ID
) tree
LEFT JOIN
(
SELECT * FROM
apps_role_user
where ROLE_ID= #{ROLE_ID}
)aru
ON tree.UUID=aru.USER_ID
</select>
<select id="list_all_user_by_roleId" parameterType="map" resultType="upperCaseKeyMap">
select distinct USER_ID FROM apps_role_user
where
<if test="ROLE_ID != null and ROLE_ID != ''">
ROLE_ID= #{ROLE_ID}
</if>
<if test="ROLE_IDS != null and ROLE_IDS != ''">
ROLE_ID IN
<foreach collection="ROLE_IDS" item="ROLE_ID" open="(" close=")" separator=",">
#{ROLE_ID}
</foreach>
</if>
</select>
<select id="list_all_role_by_userId" parameterType="map" resultType="upperCaseKeyMap">
select * FROM apps_role_user
<where>
<if test="USER_ID != null and USER_ID != ''">
USER_ID= #{USER_ID}
</if>
</where>
</select>
<insert id="insert_apps_role_user" parameterType="java.util.List">
insert into apps_role_user(
<trim prefix="" suffixOverrides=",">
<foreach collection="list" item="field">
${field.key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="list" item="field">
#{field.value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<delete id="delete_apps_role_user_by_roleId" parameterType="String">
delete from apps_role_user where
ROLE_ID = #{roleId}
</delete>
</mapper>
\ No newline at end of file
......@@ -17,6 +17,7 @@ import com.gaowj.business.util.Encipher;
import com.gaowj.business.util.PropUtil;
import com.gaowj.business.util.RequestUtils;
import com.jw.app.business.PortalAppsBusiness;
import com.jw.app.business.PortalAppsRoleBusiness;
import com.gaowj.business.SystemOpeBusiness;
import com.jw.app.business.utils.QueryParamUtil;
import com.jw.app.business.utils.Status;
......@@ -222,7 +223,7 @@ public class actAction extends BasicAction{
PortalAppsBusiness business = BusinessManager.getBusiness(PortalAppsBusiness.class);
SystemOpeBusiness business_sys = BusinessManager.getBusiness(SystemOpeBusiness.class);
PortalAppsRoleBusiness business_app_role = BusinessManager.getBusiness(PortalAppsRoleBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
entity.remove("OPETYPE");
try{
......@@ -231,12 +232,13 @@ public class actAction extends BasicAction{
if(entity.get("G_ID")!=null&&!entity.get("G_ID").toString().equals("all"))
{
String gids[] = ((String)entity.get("G_ID")).split(",");
for(int i=0;i<gids.length;i++){
Map<String, Object>map=new HashMap<String, Object>();
map.put("EMDEPART", gids[i]);
List<Map<String,Object>> t_alluser= business_sys.listLoginUserInfo(map);
alluser.addAll(t_alluser);
Map<String, Object> map=new HashMap<String, Object>();
map.put("ROLE_IDS", gids);
List<Map<String, Object>> listUserByRoleId=business_app_role.list_all_user_by_roleId(map);
for(Map<String, Object> user:listUserByRoleId){
user.put("CODE", user.get("USER_ID"));
}
alluser.addAll(listUserByRoleId);
}
else {
alluser= business_sys.listLoginUserInfo(null);
......
......@@ -12,12 +12,13 @@ public class viewAction extends BasicAction {
*
*/
private static final long serialVersionUID = -9417888985460968L;
public String appsTab() throws BusinessException {
return "appsTab";
}
public String appsTabDetail() throws BusinessException {
Map<String,Object> query = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX);
Map<String, Object> query = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX);
request.setAttribute("is_row", query);
return "appsTabDetail";
}
......
package com.jw.app.portal.role.action;
import java.util.Map;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import com.jw.app.business.PortalAppsRoleBusiness;
import com.jw.app.business.utils.Status;
import net.sf.json.JSONObject;
public class actAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = 124457626402410251L;
private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
/**
* 保存角色信息
*
* @return
* @throws BusinessException
*/
public String saveRoleInfo() throws BusinessException {
Map<String, Object> info = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
PortalAppsRoleBusiness business = BusinessManager.getBusiness(PortalAppsRoleBusiness.class);
try {
info = QueryParamUtil.StringToDate(info);
info.remove("OPETYPE");
business.save_apps_role(info);
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
} catch (Exception e) {
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
}
return "json";
}
/**
* 删除角色信息
*
* @return
* @throws BusinessException
*/
public String removeRoleInfo() throws BusinessException {
PortalAppsRoleBusiness business = BusinessManager.getBusiness(PortalAppsRoleBusiness.class);
try {
business.delete_apps_role(RequestUtils.getString(request, "UUID"));
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
} catch (Exception e) {
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
}
return "json";
}
/**
* 删除角色信息
*
* @return
* @throws BusinessException
*/
public String saveUserByRoleId() throws BusinessException {
PortalAppsRoleBusiness business = BusinessManager.getBusiness(PortalAppsRoleBusiness.class);
try {
business.saveUserByRoleId(RequestUtils.getString(request, "FIELD_ROLE_ID"),RequestUtils.getString(request, "FIELD_SELECT_USER"));
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
} catch (Exception e) {
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
}
return "json";
}
}
package com.jw.app.portal.role.action;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import com.jw.app.business.PortalAppsRoleBusiness;
import net.sf.json.JSONObject;
public class dataAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = 1838735286131979745L;
private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public int getRows() {
rows = getPageSize();
return rows;
}
public void setRows(int rows) {
setPageSize(rows);
this.rows = getPageSize();
}
public int getPage() {
page = getPageNo();
return page;
}
public void setPage(int page) {
setPageNo(page);
this.page = getPageNo();
}
/**
* 获取角色列表
*
* @return
* @throws BusinessException
*/
public String listRoleInfo() throws BusinessException {
PortalAppsRoleBusiness business = BusinessManager.getBusiness(PortalAppsRoleBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageData = business.list_apps_role(pageNo, pageSize, query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateTimeToString(pageData.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageData.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
/**
* 获取全部角色列表
*
* @return
* @throws BusinessException
*/
public String listAllRoleInfo() throws BusinessException {
PortalAppsRoleBusiness business = BusinessManager.getBusiness(PortalAppsRoleBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> list = business.list_all_apps_role(query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateTimeToString(list));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", list.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
/**
* 获取用户树结构
*
* @return
* @throws BusinessException
*/
public String listAllUser() throws BusinessException {
PortalAppsRoleBusiness business = BusinessManager.getBusiness(PortalAppsRoleBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> list = business.list_all_user(query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateTimeToString(list));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", list.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
}
package com.jw.app.portal.role.action;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
public class viewAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -6713122465589081789L;
public String roleTab() throws BusinessException {
return "roleTab";
}
public String roleTabDetail() throws BusinessException {
return "roleTabDetail";
}
public String userChoice() throws BusinessException {
return "userChoice";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment