⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getstaffaction.java

📁 培训考试系统代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.huawei.icd30.agt.util;

import javax.servlet.http.*;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import com.huawei.icd30.agt.util.*;
import com.huawei.icd30.common.db.*;
/**
 * <p> 查询出员工工号,组号,教师以便进行选择的类。</p>
 * <p> </p>
 * <p> </p>
 * @author 龙燕茜
 * @version 1.0
 */

public class GetStaffAction extends Action
{

    public ActionForward perform(ActionMapping mapping,
           ActionForm form, HttpServletRequest req,
           HttpServletResponse res)
    {
        //判断session是否超时
     //   ActionForward checkForword = Tools.checkSession(req,res);
     //   if(checkForword != null)
     //   {
     //        return checkForword;
     //   }

        //获取操作类型
        String opeType = req.getParameter("opeType");//从req中获取



        if(opeType.equalsIgnoreCase(OperatorFlagCode.GET_STAFFNO))
        {//增加考试安排
             return getStaffNo(mapping,form,req,res);
        }
        else if(opeType.equalsIgnoreCase(OperatorFlagCode.GET_GROUP))
        {//获取考试安排中的草稿、审查箱、审批箱列表
             return getGroup(mapping,form,req,res);
        }
        else if(opeType.equalsIgnoreCase(OperatorFlagCode.GET_TEACHER))
        {//修改考试安排
             return getTeacher(mapping,form,req,res);
        }
        else if(opeType.equalsIgnoreCase(OperatorFlagCode.GET_SKILL))
        {//修改考试安排
             return getSkill(mapping,form,req,res);
        }
        else if(opeType.equalsIgnoreCase(OperatorFlagCode.GET_EXAMCHECKER))
        {
            return getExamChecker(mapping,form,req,res);
        }
        else if(opeType.equalsIgnoreCase(OperatorFlagCode.GET_EXAMAPPROVER))
        {
            return getExamApprover(mapping,form,req,res);
        }
        else if(opeType.equalsIgnoreCase(OperatorFlagCode.GET_LESSONCHECKER))
        {
            return getLessonChecker(mapping,form,req,res);
        }
        else if(opeType.equalsIgnoreCase(OperatorFlagCode.GET_LESSONAPPROVER))
        {
           return getLessonApprover(mapping,form,req,res);
        }
        else if(opeType.equalsIgnoreCase(OperatorFlagCode.GET_DUTY))
        {
            return getDuty(mapping,form,req,res);
        }
        else
        {//操作类型错误,定向到错误页面,错误编码:UNKNOW_ERROR
             req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
             return (mapping.findForward("error"));
        }
    }

    /**
     * 获取员工工号信息
     */
    private ActionForward getStaffNo(ActionMapping mapping,
           ActionForm form, HttpServletRequest req,
           HttpServletResponse res)
    {
       //定义连接的实例
       SysDbConn aplcoms = null;
       try
       {

           //得到一个连接的实例
           aplcoms = SysConnPool.getInstance().getAplComs();

           //查询
           aplcoms.preparedQuery("");
           SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_GetStaffNo" ,"1" ,"-1").getResultSet();

           rs1.sort(0,true);
           //把结果集传到页面



           req.setAttribute("GET-STAFFNO-RESULTSET",rs1);

           //定向
           return (mapping.findForward("getstaffno"));
       }
       catch (SysDbException aple)
       {//捕获CommonService系统异常,定向到出错页面
           //输出异常信息
           aple.printStackTrace();
           req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
           return (mapping.findForward("error"));
       }
       catch(java.sql.SQLException sqle)
       {//捕获调用aplcoms异常,定向到出错页面
           // 输出异常信息
           sqle.printStackTrace();
           req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
           return (mapping.findForward("error"));
       }
       catch(Exception e)
       {//捕获未知异常,定向到出错页面
           //输出异常信息
           e.printStackTrace();
           req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
           return (mapping.findForward("error"));
       }
       finally
       {//关闭连接实例
           if(aplcoms != null)
           {
              aplcoms.close();
           }
       }
    }

   //dingjiangtao  2004-06-24
   //得到责任人工号

    private ActionForward getDuty(ActionMapping mapping,
           ActionForm form, HttpServletRequest req,
           HttpServletResponse res)
    {
       //定义连接的实例
       SysDbConn aplcoms = null;
       try
       {

           //得到一个连接的实例
           aplcoms = SysConnPool.getInstance().getAplComs();

           //查询
           aplcoms.preparedQuery("");
           SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_GetStaffNo" ,"1" ,"-1").getResultSet();

           rs1.sort(0,true);
           //把结果集传到页面



           req.setAttribute("GET-STAFFNO-RESULTSET",rs1);

           //定向
          
           return (mapping.findForward("getduty"));

       }
       catch (SysDbException aple)
       {//捕获CommonService系统异常,定向到出错页面
           //输出异常信息
           aple.printStackTrace();
           req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
           return (mapping.findForward("error"));
       }
       catch(java.sql.SQLException sqle)
       {//捕获调用aplcoms异常,定向到出错页面
           // 输出异常信息
           sqle.printStackTrace();
           req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
           return (mapping.findForward("error"));
       }
       catch(Exception e)
       {//捕获未知异常,定向到出错页面
           //输出异常信息
           e.printStackTrace();
           req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
           return (mapping.findForward("error"));
       }
       finally
       {//关闭连接实例
           if(aplcoms != null)
           {
              aplcoms.close();
           }
       }
    }

    //end dingjiangtao  2004-06-24


    /**
     * 获取员工工号信息
     */
    public static String getStaffNoStr()
    {
       //定义连接的实例
       SysDbConn aplcoms = null;
       try
       {
           //得到一个连接的实例
           aplcoms = SysConnPool.getInstance().getAplComs();

           //查询
           aplcoms.preparedQuery("");
           SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_GetStaffNo" ,"1" ,"-1").getResultSet();

           String staffNoStr = "";
           if(rs1 != null)
           {
              for(int i=0;rs1.setRecord(i)&&i<rs1.getMetaData().getRecordCount();i++)
              {
                 staffNoStr += rs1.getString(0) + ",";
              }
           }
           return staffNoStr;
       }
       catch (SysDbException aple)
       {//捕获CommonService系统异常,定向到出错页面
           //输出异常信息
           aple.printStackTrace();
           return "";
       }
       catch(java.sql.SQLException sqle)
       {//捕获调用aplcoms异常,定向到出错页面
           // 输出异常信息
           sqle.printStackTrace();
           return "";
       }
       catch(Exception e)
       {//捕获未知异常,定向到出错页面
           //输出异常信息
           e.printStackTrace();
           return "";
       }
       finally
       {//关闭连接实例
           if(aplcoms != null)
           {
              aplcoms.close();
           }
       }
    }


    /**
     * 获取组号信息
     */
    private ActionForward getGroup(ActionMapping mapping,
           ActionForm form, HttpServletRequest req,
           HttpServletResponse res)
    {
       //定义连接的实例
       SysDbConn aplcoms = null;
       try
       {
           //得到一个连接的实例
           aplcoms = SysConnPool.getInstance().getAplComs();

           //查询
           aplcoms.preparedQuery("");
           SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_GetGroup" ,"1" ,"-1").getResultSet();

           //把结果集存放到session中
           req.setAttribute("GET-GROUP-RESULTSET",rs1);

           //定向
           return (mapping.findForward("getgroup"));
       }
       catch (SysDbException aple)
       {//捕获CommonService系统异常,定向到出错页面
           //输出异常信息
           aple.printStackTrace();
           req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
           return (mapping.findForward("error"));
       }
       catch(java.sql.SQLException sqle)
       {//捕获调用aplcoms异常,定向到出错页面
           // 输出异常信息
           sqle.printStackTrace();
           req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
           return (mapping.findForward("error"));
       }
       catch(Exception e)
       {//捕获未知异常,定向到出错页面
           //输出异常信息
           e.printStackTrace();
           req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
           return (mapping.findForward("error"));
       }
       finally
       {//关闭连接实例
           if(aplcoms != null)
           {
              aplcoms.close();
           }
       }
    }

    /**
     * 获取组号信息
     */
    public static String getGroupStr()
    {
       //定义连接的实例
       SysDbConn aplcoms = null;
       try
       {
           //得到一个连接的实例
           aplcoms = SysConnPool.getInstance().getAplComs();

           //查询
           aplcoms.preparedQuery("");
           SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_GetGroup" ,"1" ,"-1").getResultSet();

           String groupStr = "";

           if(rs1 != null)
           {
              for(int i=0;rs1.setRecord(i)&&i<rs1.getMetaData().getRecordCount();i++)
              {
                 groupStr += rs1.getString(0) + ",";
              }
           }
           return groupStr;

       }
       catch (SysDbException aple)
       {//捕获CommonService系统异常,定向到出错页面
           //输出异常信息
           aple.printStackTrace();
           return "";
       }
       catch(java.sql.SQLException sqle)
       {//捕获调用aplcoms异常,定向到出错页面
           // 输出异常信息
           sqle.printStackTrace();
           return "";
       }
       catch(Exception e)
       {//捕获未知异常,定向到出错页面
           //输出异常信息
           e.printStackTrace();
           return "";
       }
       finally
       {//关闭连接实例
           if(aplcoms != null)
           {
              aplcoms.close();
           }
       }
    }


   /**
     * 获取教师信息
     */
    private ActionForward getTeacher(ActionMapping mapping,
           ActionForm form, HttpServletRequest req,
           HttpServletResponse res)
    {
       //定义连接的实例
       SysDbConn aplcoms = null;
       try
       {
           //得到一个连接的实例
           aplcoms = SysConnPool.getInstance().getAplComs();

           //查询
           aplcoms.preparedQuery("");
           SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_GetTeacher" ,"1" ,"-1").getResultSet();

           //把结果集存放到session中
           req.setAttribute("GET-TEACHER-RESULTSET",rs1);

           //定向
           return (mapping.findForward("getteacher"));
       }
       catch (SysDbException aple)
       {//捕获CommonService系统异常,定向到出错页面
           //输出异常信息
           aple.printStackTrace();
           req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
           return (mapping.findForward("error"));
       }
       catch(java.sql.SQLException sqle)
       {//捕获调用aplcoms异常,定向到出错页面
           // 输出异常信息
           sqle.printStackTrace();
           req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
           return (mapping.findForward("error"));
       }
       catch(Exception e)
       {//捕获未知异常,定向到出错页面
           //输出异常信息
           e.printStackTrace();
           req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
           return (mapping.findForward("error"));
       }
       finally
       {//关闭连接实例
           if(aplcoms != null)
           {
              aplcoms.close();
           }
       }
    }

   /**
     * 获取教师信息
     */
    public static String getTeacherStr()
    {
       //定义连接的实例
       SysDbConn aplcoms = null;
       try
       {
           //得到一个连接的实例
           aplcoms = SysConnPool.getInstance().getAplComs();

           //查询
           aplcoms.preparedQuery("");
           SysResultSet rs1 = aplcoms.csCommonQuery("SQL_Agt_GetTeacher" ,"1" ,"-1").getResultSet();

           String teacherStr = "";

           for(int i=0;rs1.setRecord(i)&&i<rs1.getMetaData().getRecordCount();i++)
           {
              teacherStr += rs1.getString(0) + ",";
           }
           return teacherStr;
       }
       catch (SysDbException aple)
       {//捕获CommonService系统异常,定向到出错页面
           //输出异常信息
           aple.printStackTrace();
           return "";
       }
       catch(java.sql.SQLException sqle)
       {//捕获调用aplcoms异常,定向到出错页面
           // 输出异常信息
           sqle.printStackTrace();
           return "";
       }
       catch(Exception e)
       {//捕获未知异常,定向到出错页面
           //输出异常信息
           e.printStackTrace();
           return "";
       }
       finally
       {//关闭连接实例
           if(aplcoms != null)
           {
              aplcoms.close();
           }
       }
    }


   /**
     * 获取技能信息
     */
    private ActionForward getSkill(ActionMapping mapping,
           ActionForm form, HttpServletRequest req,
           HttpServletResponse res)
    {
       //定义连接的实例
       SysDbConn aplcoms = null;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -