📄 orgusermanageaction.java
字号:
package cn.com.iaspec.workflow.client.web.action.sysmanage;
import cn.com.iaspec.workflow.client.web.action.base.*;
import org.apache.struts.action.ActionForward;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import cn.com.iaspec.workflow.helper.SysManageHelper;
import cn.com.iaspec.workflow.vo.db.WfOrganization;
import java.util.*;
import cn.com.iaspec.workflow.vo.db.WfUser;
import cn.com.iaspec.workflow.exception.LoginIdConflictException;
import java.util.ArrayList;
import cn.com.iaspec.workflow.vo.db.WfExtField;
import cn.com.iaspec.workflow.WorkflowConstant;
import cn.com.iaspec.workflow.organize.business.WfOrgRoleDAOAgent;
import cn.com.iaspec.workflow.vo.workflow.WfCheckExistsResult;
import cn.com.iaspec.workflow.util.FlowWebKeys;
import cn.com.iaspec.workflow.vo.workflow.UserInfo;
/**
* <p>Title: 组织、用户维护action</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: IASPEC Technologies</p>
*
* @author xiesonglin
* @version 1.0
*/
public class OrgUserManageAction
extends BaseAction{
public OrgUserManageAction(){
}
/**
* 取得主页面信息
*/
public ActionForward queryMain(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception{
return mapping.findForward("query_main");
}
/**
* 获取人员转移目的组织
*/
public ActionForward selectAcceptOrg(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception{
return mapping.findForward("select_accept_user_org");
}
/**
* 人员转移
*/
public ActionForward transferUser(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception{
String originalOrgId = request.getParameter("original_org_id");
String destinationOrgId = request.getParameter("destination_org_id");
String userId = request.getParameter("user_id");
SysManageHelper helper = new SysManageHelper();
helper.transferUser(originalOrgId,destinationOrgId,userId);
return mapping.findForward("transfer_user_message");
}
/**
* 取得选择用户主页面
*/
public ActionForward selectUserToOrgMain(ActionMapping mapping,
ActionForm form,HttpServletRequest request,HttpServletResponse response)
throws Exception{
SysManageHelper helper=new SysManageHelper();
List userList=helper.queryFreeUser();
request.setAttribute("user_list",userList);
return mapping.findForward("select_user_to_org");
}
/**
* 查询详细信息
*/
public ActionForward queryDetail(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception{
String pathName="";
String infoType=request.getParameter("info_type");
String id=request.getParameter("id");
String userId=request.getParameter("userId");
SysManageHelper helper=new SysManageHelper();
Map extValueMap = new HashMap(); //扩展字段信息
if(infoType!=null&&infoType.equals("org")){
WfOrganization orgInfo = this.queryOrg(id,extValueMap);
if(orgInfo != null){
request.setAttribute("org_info",orgInfo);
request.setAttribute("ext_field_value_map",extValueMap);
}
//操作授权信息
Hashtable operationAuthorizationHashtable=helper.getOrgOperationAuthorization(id,userId);
request.setAttribute("operationAuthorizationHashtable",operationAuthorizationHashtable);
boolean isLoginUserCreateOrg =helper.isLoginUserCreateOrg(userId,id);
request.setAttribute("isLoginUserCreateOrg",Boolean.valueOf(isLoginUserCreateOrg).toString());
pathName="org_info";
}
else if(infoType!=null&&infoType.equals("user")){
WfUser userInfo = this.queryUser(id,extValueMap);
if(userInfo != null){
request.setAttribute("user_info",userInfo);
request.setAttribute("ext_field_value_map",extValueMap);
}
//操作授权信息
Hashtable managedUserOperationAuthorizationHashtable=helper.getManagedUserOperationAuthorization(id,userId);
request.setAttribute("managedUserOperationAuthorizationHashtable",managedUserOperationAuthorizationHashtable);
boolean isLoginUserCreateUser =helper.isLoginUserCreateUser(userId,id);
request.setAttribute("isLoginUserCreateUser",Boolean.valueOf(isLoginUserCreateUser).toString());
pathName="user_info";
}
return mapping.findForward(pathName);
}
/**
* 增加部门
*/
public ActionForward addOrg(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception{
String areaId=request.getParameter("area_id");
String upOrgId=request.getParameter("up_org_id")==null?"0":
request.getParameter("up_org_id");
SysManageHelper helper=new SysManageHelper();
WfOrganization org=new WfOrganization();
if(upOrgId!=null&&!upOrgId.equals("0")){
WfOrganization orgTemp=new WfOrganization();
orgTemp.setOrgId(upOrgId);
List list=helper.queryOrg(orgTemp);
if(list!=null&&list.size()>0){
orgTemp=(WfOrganization)list.get(0);
//取得父节点名称
org.setUpOrgName(orgTemp.getOrgName());
}
}
//设置行政区id
org.setAreaId(areaId);
org.setUpOrg(upOrgId);
org.setOrgOrder(0);
request.setAttribute("org_info",org);
return mapping.findForward("org_manage");
}
/**
* 修改部门
*/
public ActionForward modifyOrg(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception{
String orgId=request.getParameter("org_id")==null?"0":
request.getParameter("org_id");
Map extValueMap = new HashMap();
WfOrganization orgInfo = this.queryOrg(orgId,extValueMap);
request.setAttribute("org_info",orgInfo);
request.setAttribute("ext_field_value_map",extValueMap);
return mapping.findForward("org_manage");
}
/**
* 保存部门
*/
public ActionForward saveOrg(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception{
SysManageHelper helper=new SysManageHelper();
WfOrganization org=new WfOrganization();
String areaId=request.getParameter("area_id");
String orgId=request.getParameter("org_id");
String orgName=request.getParameter("org_name");
String orgCode=request.getParameter("org_code");
String orgOrder=request.getParameter("org_order");
String orgDesc=request.getParameter("org_desc");
String upOrg=request.getParameter("up_org");
String orgAddress=request.getParameter("org_address");
UserInfo userInfo = (UserInfo)request.getSession(false).getAttribute(FlowWebKeys.USER_SESSION);
String creator = userInfo.getUserId();
org.setAreaId(areaId);
org.setOrgName(orgName);
org.setOrgId(orgId);
org.setOrgCode(orgCode);
org.setOrgOrder(Long.parseLong(orgOrder));
org.setOrgDesc(orgDesc);
org.setUpOrg(upOrg);
org.setOrgAddress(orgAddress);
org.setCreator(creator);
//================扩充组织字段====================
List orgExtFieldList=helper.getExtFieldList("org");
fillInputValue(orgExtFieldList,request);
org.setExtFieldList(orgExtFieldList);
//================================================
//保存数据
helper.saveOrg(org);
return mapping.findForward("org_save_message");
}
private void fillInputValue(List extFieldList,HttpServletRequest request){
WfExtField field = null;
String inputName = "",inputValue = "";
if(extFieldList != null && extFieldList.size() > 0){
for(int i=0;i<extFieldList.size();i++){
field=(WfExtField)extFieldList.get(i);
inputName=field.getInputObjName();
if(field.isMultiValue()){ //如果是多值,则各值间以‘,’分隔
String[] multiValArray=request.getParameterValues(inputName);
if(multiValArray!=null&&multiValArray.length>0){
inputValue+=multiValArray[i]+",";
}
if(inputValue.length()>0){
inputValue=inputValue.substring(0,inputValue.length()-1);
}
}
else{
inputValue=request.getParameter(inputName);
}
field.setFieldValue(inputValue);
}
}
}
/**
* 删除部门
*/
public ActionForward deleteOrg(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception{
String orgId=request.getParameter("org_id");
WfOrganization org=new WfOrganization();
org.setOrgId(orgId);
//设置无效标志
org.setOrgState("0");
SysManageHelper helper=new SysManageHelper();
helper.saveOrg(org);
return mapping.findForward("org_delete_message");
}
/**
* 增加用户
*/
public ActionForward addUser(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -