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

📄 planmngaction.java

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

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.*;
import com.huawei.icd30.common.systemconfig.*;

/**
 * <p> 本类的功能描述信息</p>
 * <p> (这家伙很懒,什么都没有写)</p>
 * <p> </p>
 * <p> </p>
 * @author unascribed
 * @version 1.0
 */

public class PlanmngAction extends Action
{
      public ActionForward perform(ActionMapping mapping,
       ActionForm form, HttpServletRequest req,
        HttpServletResponse res)
    {
        // 检查session是否超时
  //       ActionForward checkForword = Tools.checkSession(req,res);
 //        得到操作标识operatorflag
        String operatorflag = ((PlanmngForm) form).getOperatorflag();
        String staffno = req.getSession().getAttribute("staffno").toString();
        //根据查询条件查询学习计划列表,定位到多种类型的计划显示页面
       if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_SYNLIST1"))
        {
             //查询当前登录业务代表的发出计划;
             ((PlanmngForm)form).setSenderid(staffno);
             return queryPlanList(mapping, form, req, res);
        }
       else if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_SYNLIST2"))
        {
             //查询当前登录业务代表的接收计划;
             ((PlanmngForm)form).setRecieverid(staffno);
             return queryPlanList(mapping, form, req, res);
        }
       else if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_SYNLIST"))
        {
             return queryPlanList(mapping, form, req, res);
        }
       //根据查询条件查询学习计划列表,定位到单类型的计划显示页面
        else if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_LIST"))
        {
             ((PlanmngForm)form).setSenderid(staffno);
             return queryPlanList(mapping,form,req,res);
        }
        //查询当前登录用户为责任人的学习计划列表,定位到多种类型的计划显示页面
        else if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_RESPONSELIST"))
        {
             return queryPlanResponseList(mapping, form, req, res);
        }
        //根据计划ID查询学习计划详细信息
        else if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_DETAIL_NEXTMOD"))
        {
             return queryPlanDetail(mapping, form, req, res);
        }
       //根据教师ID删除教师档案
        else if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_DETAIL_NEXTVIEW"))
        {
             return queryPlanDetail(mapping, form, req, res);
        }
        //新增学习计划
        else if (operatorflag.equalsIgnoreCase("PLANMNG_ADD"))
        {
             return  newPlan(mapping, form, req, res);
        }
        //修改学习计划
        else if (operatorflag.equalsIgnoreCase("PLANMNG_MOD"))
        {
             return modPlan(mapping, form, req, res);
        }
       //删除学习计划
        else if (operatorflag.equalsIgnoreCase("PLANMNG_DEL")
          ||operatorflag.equalsIgnoreCase("PLANMNG_DEL_RESPONSE"))
        {
             return delPlan(mapping, form, req, res);
        }
        /*//直接下发学习计划
        else if (operatorflag.equalsIgnoreCase("PLANMNG_RELEASED"))
        {
             return releasePland(mapping, form, req, res);
        }
        */
        else if (operatorflag.equalsIgnoreCase("PLANMNG_RELEASE"))
        {
             return releasePlan(mapping, form, req, res);
        }

       //反馈学习计划
        else if (operatorflag.equalsIgnoreCase("PLANMNG_FEEDBACK"))
        {
             return feedbackPlan(mapping, form, req, res);
        }
        //取消学习计划
        else if (operatorflag.equalsIgnoreCase("PLANMNG_CANCEL"))
        {
             return  cancelPlan(mapping, form, req, res);
        }
        //归档学习计划
        else if (operatorflag.equalsIgnoreCase("PLANMNG_BACKUP"))
        {
             return  backupPlan(mapping, form, req, res);
        }
        //再下发学习计划
        else if (operatorflag.equalsIgnoreCase("PLANMNG_RRELEASE"))
        {
             return  rReleasePlan(mapping, form, req, res);
        }

        //转到错误页面,错误码 ErrorCode.unKnownError;
          else
        {
             req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
            return(mapping.findForward("error"));
        }

    }
        /****************************************************
         * 根据查询条件查询学习计划表得到结果集,并根据查询条件显示页面
         ****************************************************/
       private ActionForward queryPlanList (ActionMapping mapping,
       ActionForm form, HttpServletRequest req,
        HttpServletResponse res)
    {
      //得到输入参数
       String operatorflag = ((PlanmngForm) form).getOperatorflag();
       String itemid = ((PlanmngForm) form).getItemid();
       String recieverid = ((PlanmngForm) form).getRecieverid();
       String senderid = ((PlanmngForm) form).getSenderid();
       String responseid = ((PlanmngForm) form).getResponseid();
       String courseid = ((PlanmngForm) form).getCourseid();
       String testid = ((PlanmngForm) form).getTestid();
       String status = ((PlanmngForm) form).getStatus();
       String feedback = ((PlanmngForm) form).getFeedback();
       String title = ((PlanmngForm) form).getTitle();
       SysDbConn aplcoms = null ;
       try
       {
           //连接数据源
           aplcoms = SysConnPool.getInstance().getAplComs();
           aplcoms.preparedSP();

           //获得输入参数
           aplcoms.setString(1,recieverid);
           aplcoms.setString(2,senderid);
           aplcoms.setString(3,responseid);
           aplcoms.setString(4,courseid);
           aplcoms.setString(5,testid);
           aplcoms.setString(6,status);
           aplcoms.setString(7,feedback);
           aplcoms.setString(8,title);

           //调用P_Agt_PlanSearch查询,得到数据集rs1
           SysResultSet rs1 = aplcoms.csCommonSP("P_Agt_PlanSearch").getResultSet();
           rs1.next();
           aplcoms.preparedQuery(rs1.getString(1));
           SysResultSet rs2 = aplcoms.csCommonQuery("SELFSQL","1","-1").getResultSet();
           //if (rs 不为空)
           if (rs2 != null)
           {
            //按ID排序
            rs2.sort(0,true);
            //将结果集放到session中 PLANMNG-LIST
            req.getSession().setAttribute("PLANMNG-LIST",new ResUtil(rs2));
           //将输入的查询条件传递给页面
            req.setAttribute("recieverid",recieverid);
            req.setAttribute("senderid",senderid);
            req.setAttribute("responseid",responseid);
            req.setAttribute("courseid",courseid);
            req.setAttribute("testid",testid);
            req.setAttribute("status",status);
            req.setAttribute("feedback",feedback);

            //定向到列表显示页面
            if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_SYNLIST1"))
            {
              return (mapping.findForward("planmngsynlist"));
            }
            else if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_SYNLIST2"))
            {
              return (mapping.findForward("planmngsynlist"));
            }
            else if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_SYNLIST"))
            {
              return (mapping.findForward("planmngsynlist"));
            }
            else if (operatorflag.equalsIgnoreCase("PLANMNG_QUERY_LIST"))
            {
              return(mapping.findForward("planmnglist"));
            }
            else
            {
               req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
              return(mapping.findForward("error"));
            }
           }
           else
           {
             req.setAttribute("errorId",ErrorCode.PLANMNG_SEARCHLIST);
             return(mapping.findForward("error"));
           }
        }
      catch (SysDbException aple)
      {
        //捕获CommonService系统异常,定向到出错页面,错误码为ErrorCode.COMMONSERVICE_ERROR
          aple.printStackTrace();
          req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
          return (mapping.findForward("error"));
       }
      catch(java.sql.SQLException sqle)
      {
        //捕获调用aplcoms异常,定向到出错页面,错误码为ErrorCode.DATABASE_ERROR
          sqle.printStackTrace();
          req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
          return (mapping.findForward("error"));
       }
      catch(Exception e)
      {
        //捕获未知异常,定向到出错页面,错误码为ErrorCode.UNKNOW_ERROR
          e.printStackTrace();
          req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
          return (mapping.findForward("error"));
       }
      finally
        //关闭连接实例
        {
          if(aplcoms != null)
          {
             aplcoms.close();
          }
        }
    }

        /****************************************************
         * 根据当前责任人查询计划列表
         ****************************************************/
       private ActionForward queryPlanResponseList (ActionMapping mapping,
       ActionForm form, HttpServletRequest req,
        HttpServletResponse res)
    {
      //得到输入参数
       String operatorflag = ((PlanmngForm) form).getOperatorflag();
       String staffno = req.getSession().getAttribute("staffno").toString();

       SysDbConn aplcoms = null ;
       try
       {
           //连接数据源
           aplcoms = SysConnPool.getInstance().getAplComs();
           aplcoms.preparedSP();

           //获得输入参数
           aplcoms.setString(1,"");
           aplcoms.setString(2,"");
           aplcoms.setString(3,staffno);
           aplcoms.setString(4,"");
           aplcoms.setString(5,"");
           aplcoms.setString(6,"");
           aplcoms.setString(7,"");

           //调用P_Agt_PlanSearch查询,得到数据集rs1
           SysResultSet rs1 = aplcoms.csCommonSP("P_Agt_PlanSearch").getResultSet();
           rs1.next();
           aplcoms.preparedQuery(rs1.getString(1));
           SysResultSet rs2 = aplcoms.csCommonQuery("SELFSQL","1","-1").getResultSet();
           //if (rs 不为空)
           if (rs2 != null)
           {
            //按业务代表ID排序
            rs2.sort(0,true);
            //将结果集放到session中 PLANMNG-LIST
            req.getSession().setAttribute("PLANMNG-LIST",new ResUtil(rs2));

            //将输入的查询条件传递给页面
            req.setAttribute("responseid",staffno);

            //定向到列表显示页面
            return (mapping.findForward("planmngsynlist"));
           }
           else
           {
               req.setAttribute("errorId",ErrorCode.PLANMNG_RESPONSELIST);
               return(mapping.findForward("error"));
           }
        }
      catch (SysDbException aple)
      {
        //捕获CommonService系统异常,定向到出错页面,错误码为ErrorCode.COMMONSERVICE_ERROR
          aple.printStackTrace();
          req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
          return (mapping.findForward("error"));
       }
      catch(java.sql.SQLException sqle)
      {
        //捕获调用aplcoms异常,定向到出错页面,错误码为ErrorCode.DATABASE_ERROR
          sqle.printStackTrace();
          req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
          return (mapping.findForward("error"));
       }
      catch(Exception e)
      {
        //捕获未知异常,定向到出错页面,错误码为ErrorCode.UNKNOW_ERROR
          e.printStackTrace();
          req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
          return (mapping.findForward("error"));
       }
      finally
        //关闭连接实例
        {
          if(aplcoms != null)
          {
             aplcoms.close();
          }
        }
    }
        /****************************************************
         * 查询计划详细信息
         ****************************************************/
       private ActionForward queryPlanDetail (ActionMapping mapping,
       ActionForm form, HttpServletRequest req,
        HttpServletResponse res)
    {
      //得到输入参数
       String operatorflag = ((PlanmngForm) form).getOperatorflag();
       String itemid = ((PlanmngForm) form).getItemid();

⌨️ 快捷键说明

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