📄 teachmngaction.java
字号:
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 checkMyReward (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
String sstaffno = req.getSession().getAttribute("staffno").toString();
SysDbConn aplcoms = null ;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedQuery("");
//获得输入参数
aplcoms.setString(1,sstaffno);
//调用SQL_AGT_QueryStaffTeacher查询,得到数据集rs1
SysResultSet rs1 = aplcoms.csCommonQuery("SQL_AGT_QueryStaffTeacher","1","-1").getResultSet();
if ((rs1 != null)&&(rs1.getMetaData().getRecordCount() != 0))
{
rs1.next();
if ((rs1.getString(0) != null) && (!(rs1.getString(0).equals(""))))
{
req.setAttribute("teacherid",rs1.getString(0));
req.setAttribute("teachername",rs1.getString(1));
//定向到列表页面querymyreward
return (mapping.findForward("querymyreward"));
}
else
{
req.setAttribute("errorId",ErrorCode.TEACHMNG_CHECKMYREWARD);
return(mapping.findForward("error"));
}
}
else
{
req.setAttribute("errorId",ErrorCode.TEACHMNG_CHECKMYREWARD);
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 modTeachReward (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();
String trewardid = ((TeachmngForm)form).getTrewardid();
SysDbConn aplcoms = null;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedSP();
//获得参数
aplcoms.setString(1 ,trewardid);
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_UpdateTeachReward");
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_REWARDMOD);
return (mapping.findForward("success"));
}else
{
req.setAttribute("errorId",ErrorCode.TEACHMNG_REWARDMOD);
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();
}
}
}
/****************************************************
*根据培训课酬ID查询培训课酬档案详细信息
****************************************************/
private ActionForward locateAReward (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
String trewardid = ((TeachmngForm) form).getTrewardid();
String teachername = ((TeachmngForm) form).getTeachername();
SysDbConn aplcoms = null ;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedQuery("");
//设置查询参数
aplcoms.setString(1,trewardid);
//调用SQL_AGT_QueryATReward查询得到此ID的档案详细信息
SysResultSet rs = new ResUtil(aplcoms.csCommonQuery("SQL_AGT_QueryATReward","1","-1").getResultSet());
//if (rs 不为空)
if (rs != null)
{
rs.next();
//将查询结果传递给页面
req.setAttribute("teachername",teachername);
req.setAttribute("trewardid",rs.getString(0));
req.setAttribute("teacherid",rs.getString(1));
req.setAttribute("duration",rs.getString(2));
req.setAttribute("reward",rs.getString(3));
req.setAttribute("lessonid",rs.getString(4));
if (rs.getString(5) != "")
{
req.setAttribute("begintime", rs.getString(5).substring(0,16));
}
else
{
req.setAttribute("begintime", "");
}
if (rs.getString(6) != "")
{
req.setAttribute("endtime", rs.getString(6).substring(0,16));
}
else
{
req.setAttribute("endtime", "");
}
//定向到列表页面teachermodify
return (mapping.findForward("modreward"));
}
else
{
req.setAttribute("errorId",ErrorCode.TEACHMNG_LOCATER);
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 delAReward(ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
String operatorflag = ((TeachmngForm)form).getOperatorflag();
String teacherid = ((TeachmngForm)form).getTeacherid();
String teachername = ((TeachmngForm)form).getTeachername();
//得到待删除的eduidarray 数组
String idarray[] = ((TeachmngForm)form).getTrewardidarray();
//将数组中的每个字符串以#分割,赋给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_DelTeachReward");
SysRecord rc1 = ds1.getParamSet() ;
if(rc1!=null && rc1.getInt(0) == 0)
{
//调用 queryRewardList 查询
((TeachmngForm) form).setOperatorflag("TEACHMNG_QUERY_REWARDLIST");
((TeachmngForm) form).setTeacherid(teacherid);
((TeachmngForm) form).setTeachername(teachername);
return queryRewardList(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();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -