`
microsystems
  • 浏览: 7390 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

SelectReaderAction

阅读更多
/*

* All rights reserved.
*
* $Id: SelectReaderAction.java,v 1.14 2004/06/10 15:06:48 guoq Exp $
*/

package cn.com.detech.deinfo.mission.web;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.StringTokenizer;

import cn.com.detech.deinfo.mission.model.ReaderBean;
import cn.com.detech.deinfo.platform.DeInfoConstant;
import cn.com.detech.deinfo.users.BeanDepartment;
import cn.com.detech.deinfo.users.BeanGroup;
import cn.com.detech.deinfo.users.BeanPosition;
import cn.com.detech.deinfo.users.BeanUser;
import cn.com.detech.deinfo.users.CacheDepartments;
import cn.com.detech.deinfo.users.CacheGroups;
import cn.com.detech.deinfo.users.CacheObjects;
import cn.com.detech.deinfo.users.CachePositions;
import cn.com.detech.deinfo.users.CacheUsers;
import cn.com.detech.deinfo.users.User;
import cn.com.detech.struts.action.DEBaseAction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;



/**
* 传阅人名单选择ActionBean类
* NOTE: This source is automatically generated please do not modify this file.  Either subclass or
*       remove the record in src/records/definitions.
* @author 曾刚
*/
public class SelectReaderAction extends DEBaseAction
{
public SelectReaderAction(){
FUNCTION_POINT = "";
}

protected static Class getClassName(){
return SelectReaderAction.class;
}

    //------------------------------------------------------ Local Forwards
    static final String FORWARD_success = "success";
    static final String FORWARD_failure = "failure";
static final String FORWARD_Select = "Select";
static final String FORWARD_Select2 = "Select2";//add by weij;
static final String FORWARD_Back = "Back";//add by weij;
    static final String FORWARD_ChangeDept = "ChangeDept";
    static final String FORWARD_ChangeGroup = "ChangeGroup";
    static final String FORWARD_Save = "Save";
    /*static final*/ String DEFAULT_POSITION = "待定";

    //------------------------------------------------------ Action Methods

/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an ActionForward instance describing where and how
* control should be forwarded, or null if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param aform The optional ActionForm bean for this request (if any)
* @param request 待处理的HTTP请求
* @param response 生成的HTTP回应
* @return 页面迁移
* @throws Exception
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm myform,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception
{try{
        SelectReaderForm form = (SelectReaderForm)myform;
        String action = form.getAction();
        if ( action == null ) {
            action = "Select";
        }
        log.debug("enter sel people ,action is:"+action);
       
DEFAULT_POSITION=getMessage("mission.selectreader.tobe");
       
if(action.equalsIgnoreCase("Select")){
return doSelect(mapping, form, request, response, user);
}
//      add by weij;
if(action.equalsIgnoreCase("Select2")){
return doSelect2(mapping, form, request, response, user);
}
       
        if(action.equalsIgnoreCase("ChangeDept")){
            return doChangeDept(mapping, form, request, response, user);
        }
       
        if(action.equalsIgnoreCase("ChangeGroup")){
            return doChangeGroup(mapping, form, request, response, user);
        }

        if(action.equalsIgnoreCase("Save")){
            return doSave(mapping, form, request, response, user);
        }
       
        if(action.equalsIgnoreCase("Cancel")){
            return doCancel(mapping, form, request, response, user);
        }
//      add by weij;
if(action.equalsIgnoreCase("Save2")){
return doSave2(mapping, form, request, response, user);
}
        }catch(Exception e){e.printStackTrace();
        }


        return mapping.findForward(FORWARD_Select);
}

/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSelect(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {

// Add your logic code here
form.reset();
HttpSession session = request.getSession();
CacheObjects objCacheObjects = (CacheObjects)session.getServletContext().getAttribute(DeInfoConstant.PLATFORM_CONTEXT);
CacheUsers users = objCacheObjects.getUsers();
CacheDepartments departments = objCacheObjects.getDepartments();
        CacheGroups groups = objCacheObjects.getGroups();

form.reset();
ArrayList deptList = departments.getDepartments();
BeanDepartment nbd = new BeanDepartment();
nbd.setDeptID(9998);
nbd.setDepartmentName(getMessage("mission.selectreader.sel_dept"));
deptList.add(0, nbd);
form.setDeptList(deptList);               
form.setSelDeptID("9998");
       
        //加用户组
        Iterator it = groups.getIterator0();
        ArrayList groupList = new ArrayList();
        while (it.hasNext()) {
            BeanGroup nbg = (BeanGroup) it.next();
            groupList.add(nbg);
        }
        BeanGroup nbg = new BeanGroup();
        nbg.setGroupID(9998);
        nbg.setGroupName(getMessage("mission.selectreader.sel_group"));
        groupList.add(0, nbg);
        form.setGroupList(groupList);
        form.setSelGroupID("9998");
      
form.setEmpList(new ArrayList());
               
ArrayList readerList = new ArrayList();
session.removeAttribute("ReaderIDs");//add by weij;      
/*ArrayList readerIDList = (ArrayList)session.getAttribute("ReaderIDs");
if (readerIDList == null)
readerIDList = new ArrayList();
session.setAttribute("readerIDList", readerIDList);     //生成副本
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
           
ArrayList readerNameList = new ArrayList();
session.removeAttribute("ReaderNames");//add by weij;
String tmpStr = (String)session.getAttribute("ReaderNames");
if (tmpStr == null)
tmpStr = new String("");
session.setAttribute("readerNameStr", tmpStr);      //生成副本
if (tmpStr != null && !tmpStr.equals("")) {
StringTokenizer st = new StringTokenizer(tmpStr, "#");
while(st.hasMoreTokens()) {
readerNameList.add((String)st.nextElement());
}
}
Iterator ier = readerNameList.iterator();
                       
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
int userID = Integer.parseInt((String)ior.next());
String readerStr = (String)ier.next();
               
StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
if(st.hasMoreTokens()) {
nrb.setUserName((String)st.nextElement());
nrb.setDeptName((String)st.nextElement());
}
StringTokenizer st1 = new StringTokenizer((String)st.nextElement(), "&&");
if(st1.hasMoreTokens()) {
nrb.setPositionName((String)st1.nextElement());
}
               
nrb.setUserID(userID);
readerList.add(nrb);
}
form.setReaderList(readerList);
String[] as = new String[1];
as[0] = "";
form.setSelectedIDStr(as);
}
else*/
form.setReaderList(readerList);
                               
return (mapping.findForward(FORWARD_Select));
}
   
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSelect2(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {

// Add your logic code here
form.reset();
HttpSession session = request.getSession();
CacheObjects objCacheObjects = (CacheObjects)session.getServletContext().getAttribute(DeInfoConstant.PLATFORM_CONTEXT);
CacheUsers users = objCacheObjects.getUsers();
CacheDepartments departments = objCacheObjects.getDepartments();
        CacheGroups groups = objCacheObjects.getGroups();

form.reset();
ArrayList deptList = departments.getDepartments();
BeanDepartment nbd = new BeanDepartment();
nbd.setDeptID(9998);
nbd.setDepartmentName(getMessage("mission.selectreader.sel_dept"));
deptList.add(0, nbd);
form.setDeptList(deptList);               
form.setSelDeptID("9998");
               
        //加用户组
        Iterator it = groups.getIterator0();
        ArrayList groupList = new ArrayList();
        while (it.hasNext()) {
            BeanGroup nbg = (BeanGroup) it.next();
            groupList.add(nbg);
        }
        BeanGroup nbg = new BeanGroup();
        nbg.setGroupID(9998);
        nbg.setGroupName(getMessage("mission.selectreader.sel_group"));
        groupList.add(0, nbg);
        form.setGroupList(groupList);
        form.setSelGroupID("9998");
       
form.setEmpList(new ArrayList());
               
ArrayList readerList = new ArrayList();
session.removeAttribute("ReaderIDs2");//add by weij;      
/*ArrayList readerIDList = (ArrayList)session.getAttribute("ReaderIDs2");
if (readerIDList == null)
readerIDList = new ArrayList();
session.setAttribute("readerIDList", readerIDList);     //生成副本
if (readerIDList != null && readerIDList.size() > 0) {
Iterator ior = readerIDList.iterator();
           
ArrayList readerNameList = new ArrayList();
session.removeAttribute("ReaderNames");//add by weij;
String tmpStr = (String)session.getAttribute("ReaderNames");
if (tmpStr == null)
tmpStr = new String("");
session.setAttribute("readerNameStr", tmpStr);      //生成副本
if (tmpStr != null && !tmpStr.equals("")) {
StringTokenizer st = new StringTokenizer(tmpStr, "#");
while(st.hasMoreTokens()) {
readerNameList.add((String)st.nextElement());
}
}
Iterator ier = readerNameList.iterator();
                       
while (ior.hasNext()) {
ReaderBean nrb = new ReaderBean();
int userID = Integer.parseInt((String)ior.next());
String readerStr = (String)ier.next();
               
StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
if(st.hasMoreTokens()) {
nrb.setUserName((String)st.nextElement());
nrb.setDeptName((String)st.nextElement());
}
StringTokenizer st1 = new StringTokenizer((String)st.nextElement(), "&&");
if(st1.hasMoreTokens()) {
nrb.setPositionName((String)st1.nextElement());
}
               
nrb.setUserID(userID);
readerList.add(nrb);
}
form.setReaderList(readerList);
String[] as = new String[1];
as[0] = "";
form.setSelectedIDStr(as);
}
else*/
form.setReaderList(readerList);
                               
return (mapping.findForward(FORWARD_Select2));
}
   
    /**
     *
     * @param mapping
     * @param form
     * @param request
     * @throws Exception
     * @return ActionForward
     */
    public ActionForward doChangeDept(ActionMapping mapping,
                              SelectReaderForm form,
                              HttpServletRequest request,
                              HttpServletResponse response,
                              User user)
        throws Exception {

      // Add your logic code here
        HttpSession session = request.getSession();
        CacheObjects objCacheObjects = (CacheObjects)session.getServletContext().getAttribute(DeInfoConstant.PLATFORM_CONTEXT);
        CacheUsers users = objCacheObjects.getUsers();
        CachePositions positions = objCacheObjects.getPositions();
        CacheDepartments departments = objCacheObjects.getDepartments();

        String selDeptID = form.getSelDeptID();
        String readerNameStr = form.getReaderNameStr();
        session.setAttribute("readerNameStr", readerNameStr);
        String[] tmpIDArray = form.getSelectedIDStr();
        if(tmpIDArray!=null)
        log.debug("tmpIDArray.length == "+tmpIDArray.length);

        form.reset2();

        ArrayList readerIDList = new ArrayList();
        if (tmpIDArray != null) {
            for (int i = 0; i < tmpIDArray.length; i ++) {
                readerIDList.add(tmpIDArray[i]);
            }
            session.setAttribute("readerIDList", readerIDList);
        }
       
        ArrayList tmpList = new ArrayList();
        ArrayList empList = new ArrayList();

        if (selDeptID == null || selDeptID.equals("") || selDeptID.equals("0")) {
            form.setAction("Select");
            return (mapping.findForward(FORWARD_Select));
        }
       
        if (selDeptID.equals("9998")) {
            form.setEmpList(empList);
        }
        else {
            int deptID = Integer.parseInt(selDeptID);
            String departmentName = ((BeanDepartment)departments.getDeptByID(deptID)).getDepartmentName();
            tmpList = users.getUsersByDeptID(deptID);
           
            Iterator it = tmpList.iterator();
            while(it.hasNext()) {
                BeanUser nbu = (BeanUser)it.next();
               
                int userID = nbu.getUserID();
                int positionID = 0;
                if (userID == 1) { //如果是系统管理员
                    positionID = 1; //直接设置其职务为待定
                } else {
                    positionID = users.getUserPosition(userID, deptID);
                }
                //int positionID = users.getUserPosition(userID, deptID);
                BeanPosition beanp = (BeanPosition) positions.getPositionByID(positionID);
                String positionName = getMessage("mission.selectreader.tobe");
                if(beanp!=null) positionName = beanp.getPosition();
                String userName = "";
                BeanUser buser = (BeanUser) users.getUserByID(userID);
                if (buser != null) {
                    userName = buser.getUserName();
                }
                //String userName = ((BeanUser)users.getUserByID(userID)).getUserName();
               
                ReaderBean rb = new ReaderBean();
                rb.setUserID(userID);
                rb.setUserName(userName);
                rb.setDeptID(deptID);
                rb.setDeptName(departmentName);
                rb.setPositionID(positionID);
                rb.setPositionName(positionName);
               
                empList.add(rb);
            }
        }

        form.setEmpList(empList);
        form.setSelDeptID(selDeptID);
        form.setSelGroupID("9998");
       
        ArrayList readerList = new ArrayList();
        readerIDList = (ArrayList) session.getAttribute("readerIDList");
        if (readerIDList != null && readerIDList.size() > 0) {
            Iterator ior = readerIDList.iterator();

            while (ior.hasNext()) {
                ReaderBean nrb = new ReaderBean();
                String ids = (String) ior.next();
                StringTokenizer st = new StringTokenizer(ids, "#");
                int i = 0;
                int userID = 0;
                int deptID = 0;
                int positionID = 0;
                while (st.hasMoreTokens()) {
                    if (i == 0)
                        userID = Integer.parseInt((String) st.nextElement());
                    else if (i == 1)
                        deptID = Integer.parseInt((String) st.nextElement());
                    else if (i == 2)
                        positionID =
                            Integer.parseInt((String) st.nextElement());
                    ;
                    i++;
                }

                String userName =
                    ((BeanUser) users.getUserByID(userID)).getUserName();
                String deptName =
                    ((BeanDepartment) departments.getDeptByID(deptID))
                        .getDepartmentName();
                String positionName = getPosition(positions, positionID);

                nrb.setUserID(userID);
                nrb.setUserName(userName);
                nrb.setDeptID(deptID);
                nrb.setDeptName(deptName);
                nrb.setPositionID(positionID);
                nrb.setPositionName(positionName);
                readerList.add(nrb);
            }
        /*ArrayList readerList = new ArrayList();
        readerIDList = (ArrayList)session.getAttribute("readerIDList");
        if (readerIDList != null && readerIDList.size() > 0) {
            Iterator ior = readerIDList.iterator();
           

            ArrayList readerNameList = new ArrayList();
            String tmpStr = (String)session.getAttribute("readerNameStr");
            if (tmpStr != null && !tmpStr.equals("")) {
                StringTokenizer st = new StringTokenizer(tmpStr, "#");
                while(st.hasMoreTokens()) {
                    readerNameList.add((String)st.nextElement());
                }
            }
            Iterator ier = readerNameList.iterator();
                       
            while (ior.hasNext()) {
                ReaderBean nrb = new ReaderBean();
                int userID = Integer.parseInt((String)ior.next());
                String readerStr = "";
                if(ier.hasNext())
                readerStr = (String)ier.next();
               
                StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
                if(st.hasMoreTokens()) {
                    nrb.setUserName((String)st.nextElement());
                    nrb.setDeptName((String)st.nextElement());
                }
                String ststr = "";
                if(st.hasMoreElements()) ststr = (String)st.nextElement();
               
                StringTokenizer st1 = new StringTokenizer(ststr, "&&");
                if(st1.hasMoreTokens()) {
                    nrb.setPositionName((String)st1.nextElement());
                }
               
               
                nrb.setUserID(userID);
                readerList.add(nrb);
            }*/
            form.setReaderList(readerList);
            form.setSelectedIDStr(null);
        }
        else
            form.setReaderList(readerList);
           

        return (mapping.findForward(FORWARD_Select));
    }   
   
    /**
     *
     * @param mapping
     * @param form
     * @param request
     * @throws Exception
     * @return ActionForward
     */
    public ActionForward doChangeGroup(ActionMapping mapping,
                              SelectReaderForm form,
                              HttpServletRequest request,
                              HttpServletResponse response,
                              User user)
        throws Exception {

            // Add your logic code here
            HttpSession session = request.getSession();
            CacheObjects objCacheObjects =
                (CacheObjects) session.getServletContext().getAttribute(
                    DeInfoConstant.PLATFORM_CONTEXT);
            CacheUsers users = objCacheObjects.getUsers();
            CacheDepartments departments = objCacheObjects.getDepartments();
            CachePositions positions = objCacheObjects.getPositions();
            CacheGroups groups = objCacheObjects.getGroups();

            String selGroupID = form.getSelGroupID();
            String readerNameStr = form.getReaderNameStr();
            //session.removeAttribute("readerNameStr");
            session.setAttribute("readerNameStr", readerNameStr);
            String[] tmpIDArray = form.getSelectedIDStr();

            form.reset();

            ArrayList readerIDList = new ArrayList();
            if (tmpIDArray != null) {
                for (int i = 0; i < tmpIDArray.length; i++) {
                    readerIDList.add(tmpIDArray[i]);
                }
            }
            //session.removeAttribute("readerIDList");
            session.setAttribute("readerIDList", readerIDList);

            ArrayList empList = new ArrayList();
            ArrayList tmpList = new ArrayList();
            HashMap hm = new HashMap();

            if (selGroupID == null
                || selGroupID.equals("")
                || selGroupID.equals("0")) {
                form.setAction("Select");
                return (mapping.findForward(FORWARD_Select));
            }

            if (selGroupID.equals("9998")) {
                form.setEmpList(empList);
            } else {
                tmpList = users.getUsersByGroupID(Integer.parseInt(selGroupID));

                Iterator it = tmpList.iterator();
                while (it.hasNext()) {
                    BeanGroup bg = (BeanGroup) it.next();
                    int userID = bg.getUserID();
                    int deptID = bg.getDeptID();
                    //要排除用户组中用户重复的情况
                    if (userID == 0 && deptID == 0) { //所有用户都属于该用户组
                        ArrayList alist = users.getUsers();
                        Iterator ior = alist.iterator();
                        while (ior.hasNext()) {
                            BeanUser bu = (BeanUser) ior.next();
                            int uid = bu.getUserID();
                            String userName = users.getUserByID(uid).getUserName();
                            int did =
                                ((BeanDepartment) (users
                                    .getDeptsByUserID(uid)
                                    .get(0)))
                                    .getDeptID();
                            String departmentName =
                                ((BeanDepartment) (users
                                    .getDeptsByUserID(uid)
                                    .get(0)))
                                    .getDepartmentName();
                            int pid = users.getUserPosition(uid, did);
                            String positionName = getPosition(positions, pid);

                            ReaderBean rb = new ReaderBean();
                            rb.setUserID(uid);
                            rb.setUserName(userName);
                            rb.setDeptID(did);
                            rb.setDeptName(departmentName);
                            rb.setPositionID(pid);
                            rb.setPositionName(positionName);

                            hm.put(new Integer(uid), rb);
                        }
                    } else if (userID == 0 && deptID != 0) { //某部门下的所有用户属于该用户组
                        ArrayList alist = users.getUsersByDeptID(deptID);
                        Iterator irr = alist.iterator();
                        while (irr.hasNext()) {
                            BeanUser bu = (BeanUser) irr.next();
                            int uid = bu.getUserID();
                            String userName = users.getUserByID(uid).getUserName();
                            String departmentName =
                                ((BeanDepartment) departments.getDeptByID(deptID))
                                    .getDepartmentName();
                            int pid = users.getUserPosition(uid, deptID);
                            String positionName = getPosition(positions, pid);

                            ReaderBean rb = new ReaderBean();
                            rb.setUserID(uid);
                            rb.setUserName(userName);
                            rb.setDeptID(deptID);
                            rb.setDeptName(departmentName);
                            rb.setPositionID(pid);
                            rb.setPositionName(positionName);

                            hm.put(new Integer(uid), rb);
                        }
                    } else if (userID != 0) {
                        String userName = users.getUserByID(userID).getUserName();
                        String departmentName =
                            ((BeanDepartment) departments.getDeptByID(deptID))
                                .getDepartmentName();

                        //log.error("开始取userID:" + userID + ",deptID:" + deptID + " 对应的positionID的值。");
                        int positionID = 0;
                        if (userID == 1) { //如果是系统管理员
                            positionID = 1; //直接设置其职务为代定
                        } else {
                            positionID = users.getUserPosition(userID, deptID);
                        }
                        //log.error("positionID:####" + positionID + "####");
                        String positionName = getPosition(positions, positionID);

                        ReaderBean rb = new ReaderBean();
                        rb.setUserID(userID);
                        rb.setUserName(userName);
                        rb.setDeptID(deptID);
                        rb.setDeptName(departmentName);
                        rb.setPositionID(positionID);
                        rb.setPositionName(positionName);

                        hm.put(new Integer(userID), rb);
                    }
                }
            }

            empList.addAll(hm.values());

            form.setEmpList(empList);
            form.setSelGroupID(selGroupID);
            form.setSelDeptID("9998");

            ArrayList readerList = new ArrayList();
            readerIDList = (ArrayList) session.getAttribute("readerIDList");
            if (readerIDList != null && readerIDList.size() > 0) {
                Iterator ior = readerIDList.iterator();

                while (ior.hasNext()) {
                    ReaderBean nrb = new ReaderBean();
                    String ids = (String) ior.next();
                    StringTokenizer st = new StringTokenizer(ids, "#");
                    int i = 0;
                    int userID = 0;
                    int deptID = 0;
                    int positionID = 0;
                    while (st.hasMoreTokens()) {
                        if (i == 0)
                            userID = Integer.parseInt((String) st.nextElement());
                        else if (i == 1)
                            deptID = Integer.parseInt((String) st.nextElement());
                        else if (i == 2)
                            positionID =
                                Integer.parseInt((String) st.nextElement());
                        i++;
                    }

                    String userName =
                        ((BeanUser) users.getUserByID(userID)).getUserName();
                    String deptName =
                        ((BeanDepartment) departments.getDeptByID(deptID))
                            .getDepartmentName();
                    String positionName = getPosition(positions, positionID);

                    nrb.setUserID(userID);
                    nrb.setUserName(userName);
                    nrb.setDeptID(deptID);
                    nrb.setDeptName(deptName);
                    nrb.setPositionID(positionID);
                    nrb.setPositionName(positionName);
                    readerList.add(nrb);
                }

                /*ArrayList readerNameList = new ArrayList();
                String tmpStr = (String)session.getAttribute("readerNameStr");
                if (tmpStr != null && !tmpStr.equals("")) {
                    StringTokenizer st = new StringTokenizer(tmpStr, "#");
                    while(st.hasMoreTokens()) {
                        readerNameList.add((String)st.nextElement());
                    }
                }
                Iterator ier = readerNameList.iterator();
                       
                while (ior.hasNext()) {
                    ReaderBean nrb = new ReaderBean();
                    int userID = Integer.parseInt((String)ior.next());
                    String readerStr = (String)ier.next();
               
                    StringTokenizer st = new StringTokenizer(readerStr, "&&&&&&&&");
                    if(st.hasMoreTokens()) {
                        nrb.setUserName((String)st.nextElement());
                        nrb.setDeptName((String)st.nextElement());
                    }
                    StringTokenizer st1 = new StringTokenizer((String)st.nextElement(), "&&");
                    if(st1.hasMoreTokens()) {
                        nrb.setPositionName((String)st1.nextElement());
                    }
               
                    nrb.setUserID(userID);
                    readerList.add(nrb);
                }*/
                form.setReaderList(readerList);
                form.setSelectedIDStr(null);
            } else {
                form.setReaderList(readerList);
                form.setSelectedIDStr(null);
            }

            return (mapping.findForward(FORWARD_Select));
    }
   
    /**
     *
     * @param mapping
     * @param form
     * @param request
     * @throws Exception
     * @return ActionForward
     */
    public ActionForward doSave(ActionMapping mapping,
                                SelectReaderForm form,
                                HttpServletRequest request,
                                HttpServletResponse response,
                                User user)
        throws Exception {

        // Add your logic code here
        HttpSession session = request.getSession();
        String readerNameStr = form.getReaderNameStr();
        session.removeAttribute("readerNameStr");
       
        setReaderID("ReaderIDs",mapping,form,request,response,user);
            session.removeAttribute("readerIDList");
        //}
       
        return (mapping.findForward(FORWARD_Back));
    }
     
    /**
     *
     * @param mapping
     * @param form
     * @param request
     * @throws Exception
     * @return ActionForward
     */
    public ActionForward doCancel(ActionMapping mapping,
                                SelectReaderForm form,
                                HttpServletRequest request,
                                HttpServletResponse response,
                                User user)
        throws Exception {

log.debug("enter save:");
        // Add your logic code here
        HttpSession session = request.getSession();
        String readerNameStr = form.getReaderNameStr();
        session.removeAttribute("readerNameStr");
       
        session.removeAttribute("readerIDList");
        form.reset();
       
       
        return (mapping.findForward(FORWARD_Back));
    }
     
//  add by weij; 
/**
*
* @param mapping
* @param form
* @param request
* @throws Exception
* @return ActionForward
*/
public ActionForward doSave2(ActionMapping mapping,
SelectReaderForm form,
HttpServletRequest request,
HttpServletResponse response,
User user)
throws Exception {

// Add your logic code here
HttpSession session = request.getSession();
String readerNameStr = form.getReaderNameStr();
session.removeAttribute("readerNameStr");
       
        setReaderID("ReaderIDs2",mapping,form,request,response,user);
        session.removeAttribute("readerIDList");
//}
       
return (mapping.findForward(FORWARD_Back));
}
       
    private String getPosition(CachePositions posts, int pid) {
        String position = DEFAULT_POSITION;
        BeanPosition bpost0 = (BeanPosition) posts.getPositionByID(pid);
        if (bpost0 != null) {
            position = bpost0.getPosition();
        }

        return position;
    }
   
    private boolean setReaderID(String attrName,
                                  ActionMapping mapping,
                                  SelectReaderForm form,
                                  HttpServletRequest request,
                                  HttpServletResponse response,
                                  User user)
    {
        String[] tmpIDArray = form.getSelectedIDStr();
      

        ArrayList readerIDList = new ArrayList();
        if (tmpIDArray != null) {
            for (int i = 0; i < tmpIDArray.length; i ++) {
                readerIDList.add(tmpIDArray[i]);
                log.debug("tmpIDArray[i]:"+tmpIDArray[i]);
            }
        }
       
        if (readerIDList != null && readerIDList.size() > 0) {
            ArrayList readerList = new ArrayList();
            Iterator ior = readerIDList.iterator();

            while (ior.hasNext()) {
                ReaderBean nrb = new ReaderBean();
                String ids = (String) ior.next();
                log.debug("ids: "+ids);
                StringTokenizer st = new StringTokenizer(ids, "#");
                log.debug("StringTokenizer:"+st.toString());
                int i = 0;
                int userID = 0;
                int deptID = 0;
                int positionID = 0;
                while (st.hasMoreTokens()) {
                    if (i == 0)
                        userID = Integer.parseInt((String) st.nextElement());
                    else if (i == 1)
                        deptID = Integer.parseInt((String) st.nextElement());
                    else if (i == 2)
                        positionID =
                            Integer.parseInt((String) st.nextElement());
                    ;
                    i++;
                }
                log.debug("userid:"+userID);
                readerList.add((new Integer(userID)).toString());

            }
            System.out.println("arrname:"+attrName);
            HttpSession session = request.getSession();
            session.setAttribute(attrName,readerList);
            if(readerList!=null)
System.out.println("readerList.size:"+readerList.size());
            else
System.out.println("readerList is null!!!");

        }
       
        return true;
       
    }


}
分享到:
评论

相关推荐

    OFDM、OOK、PPM、QAM 的误码率模拟【绘制不同调制方案的误码率曲线】附Matlab代码.rar

    1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。

    8c71b76fb2ec10cf50fc6b0308d3dcfc_9545878e2b97a84b2e089ece58da9e82.png

    8c71b76fb2ec10cf50fc6b0308d3dcfc_9545878e2b97a84b2e089ece58da9e82

    Android SO逆向-对象的拷贝构造函数.pdf

    Android逆向过程学习

    基于S7-200 PLC的糖果包装控制系统设计与实现

    内容概要:本文详细介绍了基于西门子S7-200 PLC的糖果包装控制系统的设计与实现。首先阐述了PLC在工业自动化领域的优势及其在糖果包装生产线中的重要性。接着深入探讨了系统的硬件连接方式,包括传感器、执行机构与PLC的具体接口配置。随后展示了关键的编程实现部分,如糖果计数、包装执行、送膜控制、称重判断以及热封温度控制等具体梯形图代码片段。此外,还分享了一些实用的经验技巧,如防止信号抖动、PID参数优化、故障诊断方法等。最后总结了该系统的优势,强调其对提高生产效率和产品质量的重要作用。 适合人群:从事工业自动化控制、PLC编程的技术人员,尤其是对小型PLC系统感兴趣的工程师。 使用场景及目标:适用于糖果制造企业,旨在提升包装生产线的自动化程度,确保高效稳定的生产过程,同时降低维护成本并提高产品一致性。 其他说明:文中不仅提供了详细的理论讲解和技术指导,还结合实际案例进行了经验分享,有助于读者更好地理解和掌握相关知识。

    PLC与WinCC实现三部十层电梯协同控制及优化技巧

    内容概要:本文详细介绍了参与西门子杯比赛中关于三部十层电梯系统的博图V15.1程序设计及其WinCC画面展示的内容。文中不仅展示了电梯系统的基本架构,如抢单逻辑、方向决策、状态机管理等核心算法(采用SCL语言编写),还分享了许多实际调试过程中遇到的问题及解决方案,例如未初始化变量导致的异常行为、状态机遗漏空闲状态、WinCC画面动态显示的挑战以及通信配置中的ASCII码解析错误等问题。此外,作者还特别提到一些创意性的设计,如电梯同时到达同一层时楼层显示器变为闪烁爱心的效果,以及节能模式下电梯自动停靠中间楼层的功能。 适合人群:对PLC编程、工业自动化控制、电梯调度算法感兴趣的工程技术人员,尤其是准备参加类似竞赛的学生和技术爱好者。 使用场景及目标:适用于希望深入了解PLC编程实践、掌握电梯群控系统的设计思路和技术要点的人士。通过学习本文可以更好地理解如何利用PLC进行复杂的机电一体化项目的开发,提高解决实际问题的能力。 其他说明:文章风格幽默诙谐,将严肃的技术话题融入轻松的生活化比喻之中,使得原本枯燥的专业知识变得生动有趣。同时,文中提供的经验教训对于从事相关领域的工作者来说非常宝贵,能够帮助他们少走弯路并激发更多创新思维。

    慧荣量产工具合集.zip

    慧荣量产工具合集.zip

    永磁同步电机FOC控制与SVPWM算法仿真模型解析

    内容概要:本文详细介绍了永磁同步电机(PMSM)的FOC(磁场定向控制)和SVPWM(空间矢量脉宽调制)算法的仿真模型。首先解释了FOC的基本原理及其核心的坐标变换(Clark变换和Park变换),并给出了相应的Python代码实现。接下来探讨了SVPWM算法的工作机制,包括扇区判断和占空比计算的方法。此外,文章还讨论了电机的PI双闭环控制结构,即速度环和电流环的设计与实现。文中不仅提供了详细的理论背景,还分享了一些实用的编程技巧和注意事项,帮助读者更好地理解和应用这些算法。 适合人群:电气工程专业学生、从事电机控制系统开发的技术人员以及对永磁同步电机控制感兴趣的科研人员。 使用场景及目标:① 学习和掌握永磁同步电机的FOC控制和SVPWM算法的具体实现;② 提供丰富的代码示例和实践经验,便于快速搭建和调试仿真模型;③ 探讨不同参数设置对电机性能的影响,提高系统的稳定性和效率。 其他说明:文章强调了在实际应用中需要注意的一些细节问题,如坐标变换中的系数选择、SVPWM算法中的扇区判断优化以及PI控制器的参数调整等。同时,鼓励读者通过动手实验来加深对各个模块的理解。

    spring-ai-qianfan-1.0.0-M5.jar中文文档.zip

    # 压缩文件中包含: 中文文档 jar包下载地址 Maven依赖 Gradle依赖 源代码下载地址 # 本文件关键字: jar中文文档.zip,java,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,中文API文档,手册,开发手册,使用手册,参考手册 # 使用方法: 解压最外层zip,再解压其中的zip包,双击 【index.html】 文件,即可用浏览器打开、进行查看。 # 特殊说明: ·本文档为人性化翻译,精心制作,请放心使用。 ·只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等; ·不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。 # 温馨提示: (1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地); (2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件;

    Android安全之旅系列博客导读.pdf

    Android逆向过程学习

    【图像处理】基于双目视觉的物体体积测量算法研究附Matlab代码.rar

    1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。

    3dmax插件按面积分离.ms

    3dmax插件

    spring-ai-autoconfigure-vector-store-qdrant-1.0.0-M7.jar中文文档.zip

    # 【spring-ai-autoconfigure-vector-store-qdrant-1.0.0-M7.jar中文文档.zip】 中包含: 中文文档:【spring-ai-autoconfigure-vector-store-qdrant-1.0.0-M7-javadoc-API文档-中文(简体)版.zip】 jar包下载地址:【spring-ai-autoconfigure-vector-store-qdrant-1.0.0-M7.jar下载地址(官方地址+国内镜像地址).txt】 Maven依赖:【spring-ai-autoconfigure-vector-store-qdrant-1.0.0-M7.jar Maven依赖信息(可用于项目pom.xml).txt】 Gradle依赖:【spring-ai-autoconfigure-vector-store-qdrant-1.0.0-M7.jar Gradle依赖信息(可用于项目build.gradle).txt】 源代码下载地址:【spring-ai-autoconfigure-vector-store-qdrant-1.0.0-M7-sources.jar下载地址(官方地址+国内镜像地址).txt】 # 本文件关键字: spring-ai-autoconfigure-vector-store-qdrant-1.0.0-M7.jar中文文档.zip,java,spring-ai-autoconfigure-vector-store-qdrant-1.0.0-M7.jar,org.springframework.ai,spring-ai-autoconfigure-vector-store-qdrant,1.0.0-M7,org.springframework.ai.vectorstore.qdr

    【ARIMA-WOA-LSTM】差分自回归移动平均方法-鲸鱼优化算法-LSTM预测研究附python代码.rar

    1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。

    永磁同步电机控制系统中平方根容积卡尔曼滤波(SRCKF)的应用及优化

    内容概要:本文详细介绍了平方根容积卡尔曼滤波(SRCKF)在永磁同步电机(PMSM)控制系统中的应用及其相对于传统CKF的优势。文章首先指出传统CKF在处理协方差矩阵时存在的数值不稳定性和非正定问题,导致系统性能下降。接着,作者通过引入SRCKF,利用Cholesky分解和QR分解来确保协方差矩阵的正定性,从而提高状态估计的精度和稳定性。文中展示了具体的电机模型和状态方程,并提供了详细的代码实现,包括状态预测、容积点生成以及观测更新等关键步骤。此外,文章还分享了实际调试过程中遇到的问题及解决方案,如选择合适的矩阵分解库和处理电机参数敏感性。最终,通过实验数据对比,证明了SRCKF在突加负载情况下的优越表现。 适合人群:从事永磁同步电机控制研究的技术人员、研究生及以上学历的研究者。 使用场景及目标:适用于需要高精度状态估计的永磁同步电机控制系统的设计与优化,特别是在处理非线性问题和提高数值稳定性方面。 其他说明:文章引用了相关领域的权威文献,如Arasaratnam的TAC论文和Zhong的《PMSM无传感器控制综述》,并强调了实际工程实践中代码调试的重要性。

    tokenizers-0.31.1.jar中文文档.zip

    # 【tokenizers-***.jar***文档.zip】 中包含: ***文档:【tokenizers-***-javadoc-API文档-中文(简体)版.zip】 jar包下载地址:【tokenizers-***.jar下载地址(官方地址+国内镜像地址).txt】 Maven依赖:【tokenizers-***.jar Maven依赖信息(可用于项目pom.xml).txt】 Gradle依赖:【tokenizers-***.jar Gradle依赖信息(可用于项目build.gradle).txt】 源代码下载地址:【tokenizers-***-sources.jar下载地址(官方地址+国内镜像地址).txt】 # 本文件关键字: tokenizers-***.jar***文档.zip,java,tokenizers-***.jar,ai.djl.huggingface,tokenizers,***,ai.djl.engine.rust,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,djl,huggingface,中文API文档,手册,开发手册,使用手册,参考手册 # 使用方法: 解压 【tokenizers-***.jar***文档.zip】,再解压其中的 【tokenizers-***-javadoc-API文档-中文(简体)版.zip】,双击 【index.html】 文件,即可用浏览器打开、进行查看。 # 特殊说明: ·本文档为人性化翻译,精心制作,请放心使用。 ·只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等; ·不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。 # 温馨提示: (1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地); (2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件; # Maven依赖: ``` <dependency> <groupId>ai.djl.huggingface</groupId> <artifactId>tokenizers</artifactId> <version>***</version> </dependency> ``` # Gradle依赖: ``` Gradle: implementation group: 'ai.djl.huggingface', name: 'tokenizers', version: '***' Gradle (Short): implementation 'ai.djl.huggingface:tokenizers:***' Gradle (Kotlin): implementation("ai.djl.huggingface:tokenizers:***") ``` # 含有的 Java package(包): ``` ai.djl.engine.rust ai.djl.engine.rust.zoo ai.djl.huggingface.tokenizers ai.djl.huggingface.tokenizers.jni ai.djl.huggingface.translator ai.djl.huggingface.zoo ``` # 含有的 Java class(类): ``` ai.djl.engine.rust.RsEngine ai.djl.engine.rust.RsEngineProvider ai.djl.engine.rust.RsModel ai.djl.engine.rust.RsNDArray ai.djl.engine.rust.RsNDArrayEx ai.djl.engine.rust.RsNDArrayIndexer ai.djl.engine.rust.RsNDManager ai.djl.engine.rust.RsSymbolBlock ai.djl.engine.rust.RustLibrary ai.djl.engine.rust.zoo.RsModelZoo ai.djl.engine.rust.zoo.RsZooProvider ai.djl.huggingface.tokenizers.Encoding ai.djl.huggingface.tokenizers.HuggingFaceTokenizer ai.djl.huggingface.tokenizers.HuggingFaceTokenizer.Builder ai.djl.hu

    3.png

    3

    pchook源码纯源码不是dll

    pchook源码纯源码不是dll

    spring-ai-azure-store-1.0.0-M7.jar中文-英文对照文档.zip

    # 【spring-ai-azure-store-1.0.0-M7.jar中文-英文对照文档.zip】 中包含: 中文-英文对照文档:【spring-ai-azure-store-1.0.0-M7-javadoc-API文档-中文(简体)-英语-对照版.zip】 jar包下载地址:【spring-ai-azure-store-1.0.0-M7.jar下载地址(官方地址+国内镜像地址).txt】 Maven依赖:【spring-ai-azure-store-1.0.0-M7.jar Maven依赖信息(可用于项目pom.xml).txt】 Gradle依赖:【spring-ai-azure-store-1.0.0-M7.jar Gradle依赖信息(可用于项目build.gradle).txt】 源代码下载地址:【spring-ai-azure-store-1.0.0-M7-sources.jar下载地址(官方地址+国内镜像地址).txt】 # 本文件关键字: spring-ai-azure-store-1.0.0-M7.jar中文-英文对照文档.zip,java,spring-ai-azure-store-1.0.0-M7.jar,org.springframework.ai,spring-ai-azure-store,1.0.0-M7,org.springframework.ai.vectorstore.azure,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,springframework,spring,ai,azure,store,中文-英文对照API文档,手册,开发手册,使用手册,参考手册 # 使用方法: 解压 【spring-ai-azure-store-1.0.0-M7.jar中文-英文对照文档.zip】,再解

    ### XD/XL系列可编程控制器用户手册硬件篇总结. **手册概述

    内容概要:本文档是关于信捷电气XD、XL系列可编程序控制器的用户手册(硬件篇)。手册详细介绍了该系列PLC的硬件特性,包括产品概述、本体规格参数、系统构成、电源及输入输出规格、运行调试与维护、软元件切换等内容。此外,还提供了丰富的附录信息,如特殊软元件地址及功能、指令一览表、PLC功能配置表和常见问题解答。手册强调了安全操作的重要性,列出了多个安全注意事项,确保用户在正确环境下安装和使用设备,避免潜在风险。 适合人群:具备一定电气知识的专业人士,尤其是从事自动化控制系统设计、安装、调试及维护的技术人员。 使用场景及目标:①帮助用户了解XD、XL系列PLC的硬件特性和规格参数;②指导用户正确安装、接线、调试和维护设备;③提供详细的故障排查指南和技术支持信息,确保设备稳定运行;④为用户提供编程和指令使用的参考资料。 其他说明:手册不仅涵盖了硬件方面的内容,还涉及到了一些基础的软件编程概念,但更深入的编程指导请参考相关软件篇手册。用户在使用过程中遇到问题可以通过提供的联系方式获得技术支持。手册中的内容会定期更新,以适应产品改进和技术发展的需求。

    spring-ai-bedrock-converse-1.0.0-M7.jar中文文档.zip

    # 【spring-ai-bedrock-converse-1.0.0-M7.jar中文文档.zip】 中包含: 中文文档:【spring-ai-bedrock-converse-1.0.0-M7-javadoc-API文档-中文(简体)版.zip】 jar包下载地址:【spring-ai-bedrock-converse-1.0.0-M7.jar下载地址(官方地址+国内镜像地址).txt】 Maven依赖:【spring-ai-bedrock-converse-1.0.0-M7.jar Maven依赖信息(可用于项目pom.xml).txt】 Gradle依赖:【spring-ai-bedrock-converse-1.0.0-M7.jar Gradle依赖信息(可用于项目build.gradle).txt】 源代码下载地址:【spring-ai-bedrock-converse-1.0.0-M7-sources.jar下载地址(官方地址+国内镜像地址).txt】 # 本文件关键字: spring-ai-bedrock-converse-1.0.0-M7.jar中文文档.zip,java,spring-ai-bedrock-converse-1.0.0-M7.jar,org.springframework.ai,spring-ai-bedrock-converse,1.0.0-M7,org.springframework.ai.bedrock.converse,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,springframework,spring,ai,bedrock,converse,中文API文档,手册,开发手册,使用手册,参考手册 # 使用方法: 解压 【spring-ai-bedrock-converse-1

Global site tag (gtag.js) - Google Analytics