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

📄 lessonoperatoraction.java

📁 培训考试系统代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:

            con.setString(19,form.getEndhm());
             log("form.getEndhm()"+form.getEndhm());

            con.setString(20,form.getStartymd());
             log("form.getStartymd()"+form.getStartymd());

            con.setString(21,form.getEndymd());
            log("form.getEndymd()"+form.getEndymd());

            con.setString(22,form.getSite());
            log("form.getSite()"+form.getSite());

            con.setString(23,form.getStaffIds());
            log("form.getStaffIds()"+form.getStaffIds());

            con.setString(24,form.getGroupIds());
            log("form.getGroupIds()"+form.getGroupIds());

            con.setInt(25,form.getState());
            log("form.getState()"+form.getState());

            con.setInt(26,form.getScope());


             SysRecord res = con.csCommonSP("p_agt_lessonadd").getParamSet();
            if( res.getInt(0) !=0)
            {
                req.setAttribute("errorId",ErrorCode.LESSON_ADD);
                return servlet.findForward("error");
            }

        }
        catch(SysDbException e)
        {
            e.printStackTrace();
            req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
            return servlet.findForward("error");
        }
        catch(java.sql.SQLException e)
        {
            e.printStackTrace();
            req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
            return servlet.findForward("error");
        }
        finally
        {
            con.close();
        }
        req.setAttribute("successId",SuccessCode.LESSON_ADD);

        req.setAttribute("backURL","agt/lessonmng/LessonAdd.jsp?firID=M06&secNo=2&thrNo=3&secCount=10&thrCount=6");
        return servlet.findForward("success");
    }

    /**
     * 得到详细信息,该方法可以被审查,审核,修改调用
     * @param mapping
     * @param form
     * @param req
     * @return
     */
    private void getDetail(SysDbConn con,
                           LessonMngOperatorForm    form,
                           HttpServletRequest req) throws SysDbException ,
    SQLException
    {
        con.preparedSP();
        log( form.getLessonid()[0]);

        con.setString(1,form.getLessonid()[0]);
        SysResultSet res = con.csCommonSP("P_Agt_LessonDetail").getResultSet();
        req.setAttribute("LESSON_DETAIL_RES",new ResUtil(res));

           //获取参加的工号
           con.preparedQuery("");
           con.setString(1 ,form.getLessonid()[0]);
           SysResultSet rs2 = con.csCommonQuery("SQL_Agt_LessonPartStaffNo" ,"1" ,"-1").getResultSet();

           //获取参加的组号
           con.preparedQuery("");
           con.setString(1 ,form.getLessonid()[0]);
           SysResultSet rs3 = con.csCommonQuery("SQL_Agt_LessonPartGroup" ,"1" ,"-1").getResultSet();

           req.setAttribute("LESSON-PARTSTAFFNO",new ResUtil(rs2));
           req.setAttribute("LESSON-PARTGROUP",new ResUtil(rs3));
    }

    /**
     * 进入修改页面
     * @param mapping
     * @param form
     * @param req
     * @return
     */
    private ActionForward modify(ActionMapping mapping,
                                 LessonMngOperatorForm    form,
                                 HttpServletRequest req)
    {
        log("modify now ....");
        SysConnPool cspool = null;
        SysDbConn con = null;
        try
        {
            cspool = SysConnPool.getInstance();
            con = cspool.getAplComs();
            getDetail(con,form,req);
        }
        catch(SysDbException e)
        {
            e.printStackTrace();
            req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
            return servlet.findForward("error");
        }
        catch(java.sql.SQLException e)
        {
            e.printStackTrace();
            req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
            return servlet.findForward("error");
        }
        finally
        {
            con.close();
        }
        return mapping.findForward("modify");
    }

    /**
     * 进入浏览叶面
     * @param mapping
     * @param form
     * @param req
     * @return
     */
    private ActionForward view(ActionMapping mapping,
                                     LessonMngOperatorForm    form,
                                     HttpServletRequest req)
        {
            log("view now ....");
            SysConnPool cspool = null;
            SysDbConn con = null;
            try
            {
                cspool = SysConnPool.getInstance();
                con = cspool.getAplComs();
                getDetail(con,form,req);

                if(form.getOperatorFlag().equals( OperatorFlagCode.LESSON_VIEWSTUDY))
                {//增加点击次数
                    String staffno = req.getSession().getAttribute("staffno").toString();
                    con.preparedSP();

                    con.setString(1,form.getLessonid()[0]);
                    con.setString(2,staffno);
                    SysRecord res = con.csCommonSP("p_agt_lessonstudy").getParamSet();
                }

            }
            catch(SysDbException e)
            {
                e.printStackTrace();
                req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
                return servlet.findForward("error");
            }
            catch(java.sql.SQLException e)
            {
                e.printStackTrace();
                req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
                return servlet.findForward("error");
            }
            finally
            {
                con.close();
            }
            //System.out.println(mapping.findForward("view").getPath());
            //System.out.println(mapping.findForward("view").getName());
            return mapping.findForward("view");
        }

    /**
     * 进入审查页面
     * @param mapping
     * @param form
     * @param req
     * @return
     */
    private ActionForward check(ActionMapping mapping,
                                LessonMngOperatorForm    form,
                                HttpServletRequest req)
    {
        SysConnPool cspool = null;
        SysDbConn con = null;
        try
        {
            log("check now...");
            cspool = SysConnPool.getInstance();
            con = cspool.getAplComs();
            getDetail(con,form,req);
        }
        catch(SysDbException e)
        {
            e.printStackTrace();
            req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
            return servlet.findForward("error");
        }
        catch(java.sql.SQLException e)
        {
            e.printStackTrace();
            req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
            return servlet.findForward("error");
        }
        finally
        {
            con.close();
        }
        return mapping.findForward("check");
    }

    /**
     * 修改保存方法
     * @param mapping
     * @param form
     * @param req
     * @return
     */
    private ActionForward save(ActionMapping mapping,
                               LessonMngOperatorForm    form,
                               HttpServletRequest req)
    {
        log("add method ....");
        SysConnPool cspool = null;
        SysDbConn con = null;

        java.text.SimpleDateFormat date = new java.text.SimpleDateFormat("yyyy-MM-dd");
        Date endtime   = null;
        try
        {
            if(form.getEndtime() != null && !("".equalsIgnoreCase(form.getEndtime())))
            {
               endtime  = date.parse(form.getEndtime().trim());
            }

        }
        catch(Exception e)
        {

            e.printStackTrace();
            req.setAttribute("errorId",ErrorCode.DATAFORMAT_ERROR);
            return servlet.findForward("error");
        }

        //处理前端传递过来的资料,格式是11~12~13
        String matid[] = form.getMatid();
        String matids ="";
        if( matid != null)
        {

            for( int i=0; i < matid.length -1; i++)
            {
                matids += matid[i] +"~";
            }
            matids    = matids +matid[matid.length-1];
        }
        String paperid[] = form.getPaperID();
        String paperids  = "";

        if( paperid != null)
        {
            //处理前端传递过来的试题格式是111~111
            for( int i=0; i < paperid.length -1; i++)
            {
                paperids  += paperid[i] +"~";
            }
            paperids   = paperids +paperid[paperid.length-1];
        }
        //前端传递过来的用户跟组格式如下
        //aaa~0 bb~1;0表示用户,1表示组
        String[] partyname   = form.getParticipants();
        String part        ="";
        String parttype    = "";
        if( partyname != null)
        {
            for( int i=0; i < partyname.length -1 ;i++)
            {
                String[] temp = partyname[i].split("~");
                part         += temp[0] +"~";
                parttype     += temp[1] +"~";
            }
            String temp[]  = partyname[partyname.length-1].split("~");
            part         = part + temp[0];
            parttype      = parttype +temp[1];
        }

        try
        {
            cspool = SysConnPool.getInstance();
            con = cspool.getAplComs();
            con.preparedSP();
            con.setString(1,form.getDegree());
            log("form.getDegree()" +form.getDegree());
            con.setString(2,form.getClassId());
            log("form.getClassid()"+form.getClassId());
            con.setInt(3,form.getMode());
            log("form.getMode()"+form.getMode());
            con.setString(4,form.getLessonGoal());
            log("form.getLessonGoal()"+form.getLessonGoal());
            con.setString(5,form.getTeacherid());
            log("form.getTeacherid()"+form.getTeacherid());
            con.setString(6,form.getLessonName());
            log("form.getLessonName()"+form.getLessonName());
            con.setString(7,form.getCityid());
            log("form.getCityid()"+form.getCityid());
            con.setString(8,form.getOrganiger());
            log("form.getOrganiger()"+form.getOrganiger());
            con.setDate(9,endtime);
            log("endtime"+endtime);
            con.setInt(10,form.getDuration());
            log("form.getDuration()" +form.getDuration());
            con.setString(11,matids);
            log("matids" + matids);
            con.setString(12,paperids);
            log("paperids" +paperids);
            con.setString(13,form.getNote());
            log("form.getNote()"+form.getNote());
            con.setString(14,form.getStaffIds());
            con.setString(15,form.getGroupIds());
            con.setString(16,form.getStarthm());
            //log("starthm"+starthm);
            con.setString(17,form.getEndhm());
            //log("endhm"+endhm);
            con.setString(18,form.getSchoolTime());
            log("form.getSchoolTime()"+form.getSchoolTime());
            con.setInt(19,form.getState());
            log("form.getState()"+form.getState());
//            con.setString(20,"ssd");
            con.setInt(20,form.getType());
            log("form.getType()"+form.getType());
            con.setString(21,form.getSite());
            log("form.getSite()"+form.getSite());
            con.setString(22,form.getLessonid()[0]);  //longyanqian modify
            //con.setString(22,"");
            log("form.getLessonid()[0]"+form.getLessonid()[0]);
            con.setString(23,form.getCalendarID());
            log(form.getCalendarID());
            con.setString(24,form.getHandleid());
            con.setInt(25,form.getScope());
            con.setString(26,form.getStartymd());
            log("form.getStartymd()"+form.getStartymd());
            con.setString(27,form.getEndymd());
            log("form.getEndymd()"+form.getEndymd());
            SysRecord res = con.csCommonSP("P_Agt_LessonMod").getParamSet();
            if( res.getInt(0) !=0)
            {
                //System.out.println("error");
                req.setAttribute("errorId",ErrorCode.LESSON_MOD);
                return servlet.findForward("error");
            }

        }
        catch(SysDbException e)
        {
            e.printStackTrace();
            req.setAttribute("errorId",ErrorCode.COMMONSERVICE_ERROR);
            return servlet.findForward("error");

⌨️ 快捷键说明

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