📄 trnmngaction.java
字号:
return (mapping.findForward("lessondetaillist1"));
}
else if (operatorflag.equalsIgnoreCase("TRNMNG_QUERYLESSONDETAIL"))
{
return (mapping.findForward("lessondetaillist"));
}
else
{
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return(mapping.findForward("error"));
}
}
else
{
req.setAttribute("errorId",ErrorCode.TRNMNG_SEARCHTRN);
return(mapping.findForward("error"));
}
}
else
{
req.setAttribute("errorId",ErrorCode.TRNMNG_SEARCHTRN);
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 queryTestArchive (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
String staffno = ((TrnmngForm) form).getStaffno();
String operatorflag = ((TrnmngForm) form).getOperatorflag();
SysDbConn aplcoms = null ;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedQuery("");
//设置查询参数
aplcoms.setString(1,staffno);
//调用 SQL_AGT_QueryUnArchive 查询,得到数据集rs
SysResultSet rs1 = new ResUtil(aplcoms.csCommonQuery("SQL_AGT_QueryInYW","1","-1").getResultSet());
//定位到第一条记录
if (rs1 != null&& rs1.getMetaData().getRecordCount()!=0)
{
rs1.next();
String stafforga = "";
if ((rs1.getString(2)!= null) && !(rs1.getString(2).equals("")))
{
aplcoms.preparedQuery("");
//获得输入参数staffno
aplcoms.setString(1,rs1.getString(2));
//调用SQL_AGT_QueryOrga查询得到此业务代表的部门信息
SysResultSet rs9 = aplcoms.csCommonQuery("SQL_AGT_QueryOrga","1","-1").getResultSet();
rs9.next();
stafforga = rs9.getString(0);
}
//查询业务代表技能
aplcoms.preparedQuery("");
//获得输入参数staffno
aplcoms.setString(1,staffno);
//调用SQL_AGT_QueryTRNArchive查询得到此业务代表的培训档案列表
SysResultSet rs3 = aplcoms.csCommonQuery("SQL_AGT_QueryAgentSkill","1","-1").getResultSet();
//查询业务代表班组
aplcoms.preparedQuery("");
//获得输入参数staffno
aplcoms.setString(1,staffno);
//调用SQL_AGT_QueryAgentGroup查询,得到数据集rs3
SysResultSet rs4 = new ResUtil(aplcoms.csCommonQuery("SQL_AGT_QueryAgentGroups","1","-1").getResultSet());
aplcoms.preparedQuery("");
//获得输入参数staffno
aplcoms.setString(1,staffno);
//调用SQL_AGT_QueryTRNArchive查询得到此业务代表的培训档案列表
SysResultSet rs2 = aplcoms.csCommonQuery("SQL_AGT_QueryTestArchive","1","-1").getResultSet();
//if (rs 不为空)
//if ((rs2 != null)&& rs2.getMetaData().getRecordCount()!=0)
if (rs2 != null)
{
//按培训档案ID排序
// rs2.sort(3,true);
//将结果集放到session中 TRNMNG-TRNLIST
req.getSession().setAttribute("TRNMNG-TESTLIST",new ResUtil(rs2));
req.setAttribute("staffno",rs1.getString(0));
req.setAttribute("staffname",rs1.getString(1));
req.setAttribute("department",stafforga);
//业务代表所属组
String agentgroups = "";
for (int i=0; i < rs4.getMetaData().getRecordCount();i++)
{
rs4.setRecord(i);
if (i==0)
{
agentgroups = rs4.getString(0);
}
else
{
agentgroups = agentgroups + "," +rs4.getString(0);
}
}
req.setAttribute("group",agentgroups);
String rsSkill = "";
if ( rs3 != null && rs3.getMetaData().getRecordCount()!=0)
{
for(int i = 0; i < rs3.getMetaData().getRecordCount(); i++)
{
rs3.setRecord(i);
if (rsSkill == "")
{
rsSkill = rs3.getString(0);
}
else
{
rsSkill = rsSkill + "," + rs3.getString(0);
}
}
}
req.setAttribute("skill",rsSkill);
//定向到列表页面
if (operatorflag.equalsIgnoreCase("TRNMNG_QUERYTESTDETAIL1"))
{
return (mapping.findForward("testdetaillist1"));
}
else if (operatorflag.equalsIgnoreCase("TRNMNG_QUERYTESTDETAIL"))
{
return (mapping.findForward("testdetaillist"));
}
else
{
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return(mapping.findForward("error"));
}
}
else
{
req.setAttribute("errorId",ErrorCode.TRNMNG_SEARCHTRN);
return(mapping.findForward("error"));
}
}
else
{
req.setAttribute("errorId",ErrorCode.TRNMNG_SEARCHTRN);
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 queryALesson (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
String lessonid = ((TrnmngForm) form).getLessonid();
String staffno = ((TrnmngForm) form).getStaffno();
String operatorflag = ((TrnmngForm) form).getOperatorflag();
SysDbConn aplcoms = null ;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedQuery("");
//设置查询参数
aplcoms.setString(1,lessonid);
aplcoms.setString(2,staffno);
//调用 SQL_AGT_QueryALesson 查询,得到数据集rs
SysResultSet rs1 = new ResUtil(aplcoms.csCommonQuery("SQL_AGT_QueryALesson","1","-1").getResultSet());
//定位到第一条记录
rs1.next();
if (rs1 != null)
{
//将查询结果传递给页面
req.setAttribute("staffno",rs1.getString(0));
req.setAttribute("lessontitle",rs1.getString(1));
if (rs1.getString(2) != "")
{
req.setAttribute("lessondate",
rs1.getString(2).substring(0,4)+"-"+rs1.getString(2).substring(4,6)+"-"+rs1.getString(2).substring(6,8));
}
else
{
req.setAttribute("lessondate", "");
}
req.setAttribute("duration",rs1.getString(3));
req.setAttribute("lessonid",rs1.getString(4));
//修改培训档案
if (operatorflag.equalsIgnoreCase("TRNMNG_QUERYALESSON"))
{
return (mapping.findForward("lessonmodify"));
}
else if (operatorflag.equalsIgnoreCase("TRNMNG_QUERYATRN_VIEW"))
{
return (mapping.findForward("trnview"));
}
else
{
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return(mapping.findForward("error"));
}
}
else
{
req.setAttribute("errorId",ErrorCode.TRNMNG_LOCATEATRN);
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
req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
return (mapping.findForward("error"));
}
catch(Exception e)
{
//捕获未知异常,定向到出错页面,错误码为ErrorCode.UNKNOW_ERROR
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
finally
//关闭连接实例
{
if(aplcoms != null)
{
aplcoms.close();
}
}
}
/****************************************************
*根据培训档案ID查询个人考试档案详细信息
****************************************************/
private ActionForward queryATest (ActionMapping mapping,
ActionForm form, HttpServletRequest req,
HttpServletResponse res)
{
String testid = ((TrnmngForm) form).getTestid();
String staffno = ((TrnmngForm) form).getStaffno();
String operatorflag = ((TrnmngForm) form).getOperatorflag();
SysDbConn aplcoms = null ;
try
{
//连接数据源
aplcoms = SysConnPool.getInstance().getAplComs();
aplcoms.preparedQuery("");
//设置查询参数
aplcoms.setString(1,testid);
aplcoms.setString(2,staffno);
//调用 SQL_AGT_QueryUnArchive 查询,得到数据集rs
SysResultSet rs1 = new ResUtil(aplcoms.csCommonQuery("SQL_AGT_QueryATest","1","-1").getResultSet());
//定位到第一条记录
rs1.next();
if (rs1 != null)
{
//将查询结果传递给页面
req.setAttribute("staffno",rs1.getString(0));
req.setAttribute("testtitle",rs1.getString(1));
req.setAttribute("testtype",rs1.getString(2));
if (rs1.getString(3) != "")
{
req.setAttribute("testtime",
rs1.getString(3).substring(0,4)+"-"+rs1.getString(3).substring(4,6)+"-"+rs1.getString(3).substring(6,8));
}
else
{
req.setAttribute("testtime", "");
}
req.setAttribute("testscore",rs1.getString(4));
req.setAttribute("ispass",rs1.getString(5));
req.setAttribute("testid",rs1.getString(6));
req.setAttribute("totalscore",rs1.getString(7));
//修改培训档案
if (operatorflag.equalsIgnoreCase("TRNMNG_QUERYATEST"))
{
return (mapping.findForward("testmodify"));
}
else if (operatorflag.equalsIgnoreCase("TRNMNG_QUERYATRN_VIEW"))
{
return (mapping.findForward("trnview"));
}
else
{
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return(mapping.findForward("error"));
}
}
else
{
req.setAttribute("errorId",ErrorCode.TRNMNG_LOCATEATRN);
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
req.setAttribute("errorId",ErrorCode.DATABASE_ERROR);
return (mapping.findForward("error"));
}
catch(Exception e)
{
//捕获未知异常,定向到出错页面,错误码为ErrorCode.UNKNOW_ERROR
req.setAttribute("errorId",ErrorCode.UNKNOW_ERROR);
return (mapping.findForward("error"));
}
finally
//关闭连接实例
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -