📄 docauditaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.oa.document.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.oa.db.User;
import com.oa.db.UserDAO;
import com.oa.document.db.DocleaveDAO;
import com.oa.document.db.Docmove;
import com.oa.document.db.DocmoveDAO;
import com.oa.document.db.DocstaffDAO;
import com.oa.document.db.DoctaskDAO;
import com.oa.document.db.DocumentDAO;
import com.oa.document.form.DocAuditForm;
/**
* MyEclipse Struts
* Creation date: 08-24-2007
*
* XDoclet definition:
* @struts.action path="/docAudit" name="docAuditForm" scope="request" validate="true"
*/
public class DocAuditAction extends Action {
/*
* Generated Methods
*/
UserDAO udao;
DocmoveDAO movedao;
DocleaveDAO docleavedao;
DoctaskDAO doctaskdao;
DocstaffDAO docstaffdao;
DocumentDAO docdao;
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DocAuditForm docAuditForm = (DocAuditForm) form;// TODO Auto-generated method stub
try {
HttpSession session = request.getSession();
String username = (String)session.getAttribute("username");
if(username != null){
User uvo = null;
List list = udao.ByUsernameQueryUser(username);
if(list!=null&&list.size()!=0){
uvo=(User)list.get(0);
}
if(uvo != null){
//修改已审核人
movedao.updateYiAuditorById(Integer.parseInt(docAuditForm.getMid()), Integer.toString(uvo.getId()));
Docmove movevo = new Docmove();//公文下一步流动
movevo.setDocid(Integer.parseInt(docAuditForm.getDocid()));
movevo.setDoctype(docAuditForm.getDoctype());
movevo.setNextauditor(docAuditForm.getAuditor());
movevo.setOpinion(docAuditForm.getOpinion());
movevo.setAuditor(Integer.toString(uvo.getId()));
movevo.setState(docAuditForm.getState());
movevo.setYiauditor("");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
movevo.setDate(sdf.parse(sdf.format(new Date())));
movedao.save(movevo);
String nextauditor = docAuditForm.getAuditor();//修改公文表中的公文状态
String state = docAuditForm.getState();
String doctype = docAuditForm.getDoctype();
String docid = docAuditForm.getDocid();
if(nextauditor==null || nextauditor.equalsIgnoreCase("") ||
nextauditor.equalsIgnoreCase("null")){
if(state.equalsIgnoreCase("同意")){
if(doctype.equalsIgnoreCase("0"))
docdao.updateDocstate(Integer.parseInt(docid), "结束");
if(doctype.equalsIgnoreCase("1"))
docleavedao.updateDocstate(Integer.parseInt(docid), "结束");
if(doctype.equalsIgnoreCase("2"))
doctaskdao.updateDocstate(Integer.parseInt(docid), "结束");
if(doctype.equalsIgnoreCase("3"))
docstaffdao.updateDocstate(Integer.parseInt(docid), "结束");
}
if(state.equalsIgnoreCase("退回")){
if(doctype.equalsIgnoreCase("0"))
docdao.updateDocstate(Integer.parseInt(docid), "退回");
if(doctype.equalsIgnoreCase("1"))
docleavedao.updateDocstate(Integer.parseInt(docid), "退回");
if(doctype.equalsIgnoreCase("2"))
doctaskdao.updateDocstate(Integer.parseInt(docid), "退回");
if(doctype.equalsIgnoreCase("3"))
docstaffdao.updateDocstate(Integer.parseInt(docid), "退回");
}
}
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
PrintWriter out = response.getWriter();
out.print("<script>");
out.print("window.opener.location.href='document.do?docmode=1';");
out.print("window.close();");
out.print("</script>");
out.flush();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
return null;
}
public DocmoveDAO getMovedao() {
return movedao;
}
public void setMovedao(DocmoveDAO movedao) {
this.movedao = movedao;
}
public UserDAO getUdao() {
return udao;
}
public void setUdao(UserDAO udao) {
this.udao = udao;
}
public DocumentDAO getDocdao() {
return docdao;
}
public void setDocdao(DocumentDAO docdao) {
this.docdao = docdao;
}
public DocleaveDAO getDocleavedao() {
return docleavedao;
}
public void setDocleavedao(DocleaveDAO docleavedao) {
this.docleavedao = docleavedao;
}
public DoctaskDAO getDoctaskdao() {
return doctaskdao;
}
public void setDoctaskdao(DoctaskDAO doctaskdao) {
this.doctaskdao = doctaskdao;
}
public DocstaffDAO getDocstaffdao() {
return docstaffdao;
}
public void setDocstaffdao(DocstaffDAO docstaffdao) {
this.docstaffdao = docstaffdao;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -