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

📄 planmngaction.java

📁 培训考试系统代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
       String staffno = req.getSession().getAttribute("staffno").toString();
       SysDbConn aplcoms = null ;
       try
       {
           //连接数据源
           aplcoms = SysConnPool.getInstance().getAplComs();
           aplcoms.preparedQuery("");
           aplcoms.setString(1,itemid);
           SysResultSet rs2 = new ResUtil(aplcoms.csCommonQuery("SQL_AGT_QueryPlanDetail","1","-1").getResultSet());
           rs2.next();
           if ( rs2!= null )
           {
             req.setAttribute("itemid",rs2.getString(0));
             req.setAttribute("senderid",rs2.getString(1));
             req.setAttribute("recieverid",rs2.getString(2));
             req.setAttribute("title",rs2.getString(3));
             req.setAttribute("discription",rs2.getString(4));
             if (rs2.getString(5) != "")
             {
                 req.setAttribute("startdate",
                    rs2.getString(5).substring(0,4)+"-"+rs2.getString(5).substring(4,6)+"-"+rs2.getString(5).substring(6,8));
             }
             else
             {
                 req.setAttribute("startdate", "");
             }

             if (rs2.getString(6) != "")
             {
                 req.setAttribute("enddate",
                    rs2.getString(6).substring(0,4)+"-"+rs2.getString(6).substring(4,6)+"-"+rs2.getString(6).substring(6,8));
             }
             else
             {
                 req.setAttribute("enddate", "");
             }
             req.setAttribute("courseid",rs2.getString(7));
             req.setAttribute("cstarget",rs2.getString(8));
             req.setAttribute("cscontent",rs2.getString(9));
             req.setAttribute("testid",rs2.getString(10));
             req.setAttribute("tstarget",rs2.getString(11));
             req.setAttribute("tscontent",rs2.getString(12));
             req.setAttribute("feedback",rs2.getString(13));
             req.setAttribute("fbcontent",rs2.getString(14));
             req.setAttribute("status",rs2.getString(15));
             req.setAttribute("planhistory",rs2.getString(16));
             if ( operatorflag.equalsIgnoreCase("PLANMNG_QUERY_DETAIL_NEXTMOD"))
             {
               if (rs2.getString(15).equalsIgnoreCase("0"))
               {
                 return (mapping.findForward("planmod"));
               }
               else if  (rs2.getString(15).equalsIgnoreCase("1") && rs2.getString(2).equalsIgnoreCase(staffno))
               {
                 return (mapping.findForward("planmngFB"));
               }
               else if (rs2.getString(15).equalsIgnoreCase("2") && rs2.getString(1).equalsIgnoreCase(staffno))
               {
                 return (mapping.findForward("planmngBeFB"));
               }
               else
               {
                  req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
                 return(mapping.findForward("error"));
               }
              }
             else if(operatorflag.equalsIgnoreCase("PLANMNG_QUERY_DETAIL_NEXTVIEW"))
             {
               if (rs2.getString(15).equalsIgnoreCase("0")||rs2.getString(15).equalsIgnoreCase("1"))
               {
                 return (mapping.findForward("planmngview"));
               }
               else if  (rs2.getString(15).equalsIgnoreCase("2") || rs2.getString(15).equalsIgnoreCase("3")||
                         rs2.getString(15).equalsIgnoreCase("4"))
               {
                 return (mapping.findForward("planmngviewfb"));
               }
               else
               {
                 req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
                 return(mapping.findForward("error"));
               }
             }
            //定向到列表显示页面
            return (mapping.findForward("planmngsynlist"));
           }
           else
           {
             req.setAttribute("errorId",ErrorCode.PLANMNG_LOCATEA);
             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 newPlan (ActionMapping mapping,
       ActionForm form, HttpServletRequest req,
        HttpServletResponse res)
    {
      //得到输入参数
       String operatorflag = ((PlanmngForm) form).getOperatorflag();
       String senderid = ((PlanmngForm) form).getSenderid();
       String recieverid = ((PlanmngForm) form).getRecieverid();
       String title = ((PlanmngForm) form).getTitle();
       String discription = ((PlanmngForm) form).getDiscription();
       String startdate = ((PlanmngForm) form).getStartdate();
       String enddate = ((PlanmngForm) form).getEnddate();
       String courseid = ((PlanmngForm) form).getCourseid();
       String cstarget = ((PlanmngForm) form).getCstarget();
       String cscontent = ((PlanmngForm) form).getCscontent();
       String testid = ((PlanmngForm) form).getTestid();
       String tstarget = ((PlanmngForm) form).getTstarget();
       String tscontent = ((PlanmngForm) form).getTscontent();
       String status = ((PlanmngForm) form).getStatus();
       String staffno = req.getSession().getAttribute("staffno").toString();
       String groupIds = ((PlanmngForm) form).GetGroupIds();
       String staffIds = ((PlanmngForm) form).GetStaffIds();
       if (startdate != null)
       {
            startdate = startdate.replaceAll("-","");
       }
       if (enddate != null)
       {
           enddate = enddate.replaceAll("-","");
       }
      if (staffIds != null)
      {
          staffIds = staffIds.replaceAll(",","#");
      }
      if (groupIds != null)
      {
          groupIds = groupIds.replaceAll(",","#");
      }
       SysDbConn aplcoms = null ;
       try
       {
           //连接数据源
           aplcoms = SysConnPool.getInstance().getAplComs();

           if (groupIds != null && !(groupIds.equals("")))
           {
             aplcoms.preparedSP();
             aplcoms.setString(1,groupIds);
             SysDataSet ds1 = aplcoms.csCommonSP("P_agt_GroupToStaff");
             SysRecord rc1 = ds1.getParamSet() ;
             if (rc1!=null && rc1.getInt(0) == 0 && !(rc1.getString(1).equals("")))
             {
               if ( staffIds == null || staffIds.equals(""))
                {
                    staffIds = rc1.getString(1);
                }
                else
                {
                    staffIds = staffIds + "#" + rc1.getString(1);
                }
             }
             else return(mapping.findForward("error"));
           }

           aplcoms.preparedSP();
           //获得输入参数
           aplcoms.setString(1,staffno);
           aplcoms.setString(2,staffIds);
           aplcoms.setString(3,title);
           aplcoms.setString(4,discription);
           aplcoms.setString(5,startdate);
           aplcoms.setString(6,enddate);
           aplcoms.setString(7,courseid);
           aplcoms.setString(8,cstarget);
           aplcoms.setString(9,cscontent);
           aplcoms.setString(10,testid);
           aplcoms.setString(11,tstarget);
           aplcoms.setString(12,tscontent);
           aplcoms.setString(13,status);
           aplcoms.setInt(14,Initor.systemConfig.getInt("agt/planNotify",3));
           SysDataSet ds = aplcoms.csCommonSP("P_Agt_AddPlan");
           SysRecord rc = ds.getParamSet();
           if (rc!=null && rc.getInt(0) == 0)
           {
            if (status.equalsIgnoreCase("1"))
            {
                req.setAttribute("successId",SuccessCode.PLANMNG_RELEASE);
            }
            else
            {
                req.setAttribute("successId",SuccessCode.PLANMNG_ADD);
            }
            req.setAttribute("backURL","agt/planmng/newplan.jsp?firID=M04&secNo=2&thrNo=3&secCount=10&thrCount=5");
            return(mapping.findForward("success"));
           }
           else
           {
            req.setAttribute("errorId",ErrorCode.PLANMNG_ADD);
            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 modPlan (ActionMapping mapping,
       ActionForm form, HttpServletRequest req,
        HttpServletResponse res)
    {
      //得到输入参数
       String operatorflag = ((PlanmngForm) form).getOperatorflag();
       String itemid = ((PlanmngForm)form).getItemid();
       String senderid = ((PlanmngForm) form).getSenderid();
       String recieverid = ((PlanmngForm) form).getRecieverid();
       String title = ((PlanmngForm) form).getTitle();
       String discription = ((PlanmngForm) form).getDiscription();
       String startdate = ((PlanmngForm) form).getStartdate();
       String enddate = ((PlanmngForm) form).getEnddate();
       String courseid = ((PlanmngForm) form).getCourseid();
       String cstarget = ((PlanmngForm) form).getCstarget();
       String cscontent = ((PlanmngForm) form).getCscontent();
       String testid = ((PlanmngForm) form).getTestid();
       String tstarget = ((PlanmngForm) form).getTstarget();
       String tscontent = ((PlanmngForm) form).getTscontent();
       String status = ((PlanmngForm) form).getStatus();
       if (startdate != null)
       {
            startdate = startdate.replaceAll("-","");
       }
       if (enddate != null)
       {
            enddate = enddate.replaceAll("-","");
       }
       SysDbConn aplcoms = null ;
       try
       {
           //连接数据源
           aplcoms = SysConnPool.getInstance().getAplComs();
           aplcoms.preparedSP();
           //获得输入参数
           aplcoms.setString(1,senderid);
           aplcoms.setString(2,recieverid);
           aplcoms.setString(3,title);
           aplcoms.setString(4,discription);
           aplcoms.setString(5,startdate);
           aplcoms.setString(6,enddate);
           aplcoms.setString(7,courseid);
           aplcoms.setString(8,cstarget);
           aplcoms.setString(9,cscontent);
           aplcoms.setString(10,testid);
           aplcoms.setString(11,tstarget);
           aplcoms.setString(12,tscontent);
           aplcoms.setString(13,status);
           aplcoms.setString(14,itemid);
           aplcoms.setInt(15,Initor.systemConfig.getInt("agt/planNotify",4));
           SysDataSet ds = aplcoms.csCommonSP("P_Agt_UpdatePlan");
           SysRecord rc = ds.getParamSet();
           if (rc!=null && rc.getInt(0) == 0)
           {
            if (status.equalsIgnoreCase("1"))
            {
                req.setAttribute("successId",SuccessCode.PLANMNG_RELEASE);
            }
            else
            {
                req.setAttribute("successId",SuccessCode.PLANMNG_MOD);
            }
            return(mapping.findForward("success"));
           }
           else
           {
            req.setAttribute("errorId",ErrorCode.PLANMNG_MOD);
            return(mapping.findForward("error"));
           }
        }
      catch (SysDbException aple)
      {
        //捕获CommonService系统异常,定向到出错页面,错误码为ErrorCode.COMMONSERVICE_ERROR

⌨️ 快捷键说明

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