📄 passassauditaction.java
字号:
/**
*
*/
package cn.bway.admin.action;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.Session;
import cn.bway.admin.staff.form.StaffinfoForm;
import cn.bway.common.BwayHibernateException;
import cn.bway.common.LoginConstants;
import cn.bway.common.WebConstant;
import cn.bway.common.action.BaseAction;
import cn.bway.common.dao.HibernateSessionFactory;
/**
* @author Kson
*
*/
public class PassAssauditAction extends BaseAction {
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
StaffinfoForm pForm = (StaffinfoForm) form;
ActionErrors errors = new ActionErrors();
String returnStr = WebConstant.FORWARD_SUCCESS;
Session sess=null;
String sql = "";
try {
HttpSession session = request.getSession();
sess=HibernateSessionFactory.currentSession();
String userId = (String)session.getAttribute(LoginConstants.GLOBLE_STAFF_ID);
String userName = (String)session.getAttribute(LoginConstants.GLOBLE_STAFF_NAME);
//已经审核档案
int filework=0;
sql="select COUNT(*) as nums from filework f ,publicaudit p where " +
" f.staffname=p.staffname and f.autoid=p.typevalue and p.isaudit='2' " +
" and f.staffname='"+userName+"'";
System.out.println(" 已经审核档案 sql: "+sql+"\n");
filework = countPress(sess,sql);
request.setAttribute("filework",String.valueOf(filework));
returnStr=WebConstant.FORWARD_INITPAGE;
} catch (Exception e) {
returnStr=WebConstant.FORWARD_FAIL;
errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("edu.system.excption",e.getMessage()));
this.saveErrors(request,errors);
e.printStackTrace();
}finally{
HibernateSessionFactory.closeSession();
}
return mapping.findForward(returnStr);
}
//等待审核的数量
private int countPress(Session sess,String sql) throws BwayHibernateException {
int counts = 0;
PreparedStatement stat = null;
ResultSet rs = null;
try{
stat = sess.connection().prepareStatement(sql);
rs= stat.executeQuery();
if(rs.next()){
counts = rs.getInt("nums");
}
}catch (Exception e) {
e.printStackTrace();
}
return counts;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -