📄 teachmngaction.java
字号:
{
aplcoms.close();
}
}
}
/****************************************************
*修改培训教师档案
****************************************************/
private ActionForward modTeacherArchive (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//得到输入参数
String operatorflag = ((TeachmngForm)form).getOperatorflag();
String teacherid =((TeachmngForm)form).getTeacherid();
String teachername = ((TeachmngForm)form).getTeachername();
String staffno = ((TeachmngForm)form).getStaffno();
String birthday = ((TeachmngForm)form).getBirthday();
String sex = ((TeachmngForm)form).getSex();
String edulevelid = ((TeachmngForm)form).getEdulevelid() ;
String graduatedate = ((TeachmngForm)form).getGraduatedate();
String major = ((TeachmngForm)form).getMajor();
String company = ((TeachmngForm)form).getCompany();
String duty = ((TeachmngForm)form).getDuty();
String note = ((TeachmngForm)form).getNote();
if (birthday != null)
{
birthday = birthday.replaceAll("-","");
}
if (graduatedate != null)
{
graduatedate = graduatedate.replaceAll("-","");
}
SysDbConn aplcoms = null;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedSP();
//获得参数
aplcoms.setString(1 ,teacherid);
aplcoms.setString(2 ,staffno);
aplcoms.setString(3 ,teachername);
aplcoms.setString(4 ,birthday);
aplcoms.setString(5 ,sex);
aplcoms.setString(6 ,edulevelid);
aplcoms.setString(7 ,graduatedate);
aplcoms.setString(8 ,major);
aplcoms.setString(9 ,company);
aplcoms.setString(10 ,duty);
aplcoms.setString(11 ,note);
//调用P_Agt_UpdateTeacherArchive修改记录
SysDataSet ds = aplcoms.csCommonSP("P_Agt_UpdateTeacherArchive");
SysRecord rc = ds.getParamSet();
if (rc!=null && rc.getInt(0) == 0)
{
/*
((TeachmngForm)form).setTeacherid(teacherid);
((TeachmngForm)form).setOperatorflag("TEACHMNG_QUERYDETAIL");
return queryTeacherArchive(mapping,form,req,res);
*/
req.setAttribute("successId",SuccessCode.TEACHMNG_MOD);
return (mapping.findForward("success"));
}else
{
req.setAttribute("errorId",ErrorCode.TEACHMNG_MOD);
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 delTeacherArchive(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
String operatorflag = ((TeachmngForm)form).getOperatorflag();
//得到待删除的eduidarray 数组
String idarray[] = ((TeachmngForm)form).getTeacheridarray();
//将数组中的每个字符串以#分割,赋给idstring
String idstring = "";
for (int i=0; i < idarray.length ;i++)
{
if (idstring =="")
{
idstring = idarray[i];
}
else
{
idstring = idstring + "#"+ idarray[i];
}
}
SysDbConn aplcoms = null;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedSP();
//获得输入参数
aplcoms.setString(1,idstring);
//if (调用存储过程 P_Agt_DelTeacherArchive 删除教师档案记录成功)
SysDataSet ds1 = aplcoms.csCommonSP("P_Agt_DelTeacherArchive");
SysRecord rc1 = ds1.getParamSet() ;
if(rc1!=null && rc1.getInt(0) == 0)
{
//调用 queryTeacherList 查询
return queryTeacherList(mapping,form,req,res);
}
else if(rc1!=null && rc1.getInt(0) == 2) //未完全删除
{
//定位到错误叶面错误码为 errorcode.TEACHMNG_DELUNCOMP
req.setAttribute("errorId",ErrorCode.TEACHMNG_DELUNCOMP);
return(mapping.findForward("error"));
}
else
{
// 定位到错误页面错误码为 errorcode.TEACHMNG_DEL
req.setAttribute("errorId",ErrorCode.TEACHMNG_DEL);
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 newTeachReward (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
//得到输入参数
String operatorflag = ((TeachmngForm)form).getOperatorflag();
String teacherid =((TeachmngForm)form).getTeacherid();
String teachername = ((TeachmngForm)form).getTeachername();
String duration = ((TeachmngForm)form).getDuration();
String reward = ((TeachmngForm)form).getReward();
String lessonid = ((TeachmngForm)form).getLessonid();
String begintime = ((TeachmngForm)form).getBegintime();
String endtime = ((TeachmngForm)form).getEndtime();
SysDbConn aplcoms = null;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedSP();
//获得参数
aplcoms.setString(1 ,teacherid);
aplcoms.setString(2 ,duration);
aplcoms.setString(3 ,reward);
aplcoms.setString(4 ,lessonid);
aplcoms.setString(5 ,begintime);
aplcoms.setString(6 ,endtime);
//调用P_Agt_AddTeachReward新增记录
SysDataSet ds = aplcoms.csCommonSP("P_Agt_AddTeachReward");
SysRecord rc = ds.getParamSet();
if (rc!=null && rc.getInt(0) == 0)
{
/*
((TeachmngForm)form).setTeacherid(teacherid);
((TeachmngForm)form).setOperatorflag("TEACHMNG_QUERYDETAIL");
return queryTeacherArchive(mapping,form,req,res);
*/
req.setAttribute("successId",SuccessCode.TEACHMNG_REWARDADD);
req.setAttribute("backURL","agt/teachmng/newteacher.jsp?firID=M01&secNo=4&thrNo=11&secCount=10&thrCount=2");
return (mapping.findForward("success"));
}else
{
req.setAttribute("errorId",ErrorCode.TEACHMNG_REWARDADD);
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 queryRewardList (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
String operatorflag = ((TeachmngForm) form).getOperatorflag();
String teacherid = ((TeachmngForm) form).getTeacherid();
String teachername = ((TeachmngForm) form).getTeachername();
String lessonid = ((TeachmngForm) form).getLessonid();
String searchbegintime = ((TeachmngForm) form).getSearchbegintime();
String searchendtime = ((TeachmngForm) form).getSearchendtime();
SysDbConn aplcoms = null ;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedSP();
//获得输入参数teacherid、teachername、staffno、teachermajor
aplcoms.setString(1,teacherid);
aplcoms.setString(2,lessonid);
aplcoms.setString(3,searchbegintime);
aplcoms.setString(4,searchendtime);
//调用P_Agt_TeacherSearch查询,得到数据集rs1
SysResultSet rs1 = aplcoms.csCommonSP("P_Agt_SearchTeachReward").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中 TEACHMNG-REWARDLIST
req.getSession().setAttribute("TEACHMNG-REWARDLIST",new ResUtil(rs2));
//将输入的查询条件传递给页面
req.setAttribute("teacherid",teacherid);
req.setAttribute("teachername",teachername);
req.setAttribute("lessonid",lessonid);
req.setAttribute("searchbegintime",searchbegintime);
req.setAttribute("searchendtime",searchendtime);
//定向到列表页面teacherlist
if (operatorflag.equalsIgnoreCase("TEACHMNG_QUERY_REWARDLIST"))
{
return (mapping.findForward("rewardlist"));
}
else if (operatorflag.equalsIgnoreCase("TEACHMNG_QUERY_MYREWARD"))
{
int totleduration = 0;
int totlereward = 0;
for( int i= 0; rs2.setRecord(i)&&(i<rs2.getMetaData().getRecordCount()); i++)
{
totleduration = totleduration + rs2.getInt(4);
totlereward = totlereward + rs2.getInt(5);
}
req.setAttribute("totleduration", String.valueOf(totleduration));
req.setAttribute("totlereward", String.valueOf(totlereward));
return (mapping.findForward("myrewardlist"));
}
else
{
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return(mapping.findForward("error"));
}
}
else
{
req.setAttribute("errorId",ErrorCode.TEACHMNG_SEARCHREWARDLIST);
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"));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -