📄 affairreqaction.java
字号:
OutputStream output = new FileOutputStream(dir + "/" + filepath);
byte[] b = new byte[10240];
int i = 0;
while ((i = input.read(b, 0, 10240)) != -1) {
output.write(b, 0, i);
}
} catch (FileNotFoundException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
affairReqForm.setSname(filename);
affairReqForm.setSpath(filepath);
}
}
//修改环节状态
affairdao.setread(rqid);
//// 审核通过并未完结该事务
if (type.equals("noEnd")){
//审核通过
flag = affairdao.affairPass("noend", request, affairReqForm);
}
//审核通过并完结该事务
if (type.equals("End")){
//先插入 实际完结时间 到 步骤表
flag = affairdao.affairPass("end", request, affairReqForm);
}
if (flag == true) {
out.print("<script>alert('处理事务成功'); ");
out.print("window.location.href='"+ request.getContextPath()+ "/affairReq.do?task=getReqList'");
out.print("</script>");
} else {
out.print("<script>alert('处理事务失败');" + "window.history.back()");
out.print("</script>");
return null;
}
} else {
out.print("<script>alert('登录时间过期,请重新登录');"
+ "window.top.location.href='" + request.getContextPath()
+ "/Jsp_file/login/login.jsp';");
out.print("</script>");
}
return null;
}
public ActionForward doaudit2(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
AffairReqForm affairReqForm = (AffairReqForm) form;
boolean flag = false;
PrintWriter out = null;
try {
out = response.getWriter();
} catch (IOException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
}
HttpSession httpsession = request.getSession();
Tuser user = (Tuser)httpsession.getAttribute("user");
if (user != null) {
request.setAttribute("userid",user.getUno());
String rqid = request.getParameter("rqid");
String type = request.getParameter("type");
FormFile file = affairReqForm.getFile();
if (file.getFileName() != null && !file.getFileName().equals("")) {
if (file.getFileSize() > 5 * 1024 * 1024) {
out.print("<script>alert('附件大小不能大于5M')</script>");
out.print("<script>window.history.back()</script>");
return null;
} else {
String dir = getServlet().getServletContext().getRealPath("/")+ "upload/affair";
String filename = file.getFileName();
String filepath = "";
InputStream input;
try {
input = file.getInputStream();
filepath = System.currentTimeMillis()+ filename.substring(filename.lastIndexOf("."), filename.length());
OutputStream output = new FileOutputStream(dir + "/" + filepath);
byte[] b = new byte[10240];
int i = 0;
while ((i = input.read(b, 0, 10240)) != -1) {
output.write(b, 0, i);
}
} catch (FileNotFoundException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
affairReqForm.setSname(filename);
affairReqForm.setSpath(filepath);
}
}
//修改环节状态
affairdao.setread(rqid);
//// 审核不通过返回上一环节
if (type.equals("back")){
//审核不通过
flag = affairdao.affairPass("back", request, affairReqForm);
}
//审核不通过并完结该事务
if (type.equals("nopass")){
//先插入 实际完结时间 到 步骤表
flag = affairdao.affairPass("nopass", request, affairReqForm);
}
if (flag == true) {
out.print("<script>alert('处理事务成功'); ");
out.print("window.location.href='"+ request.getContextPath()+ "/affairReq.do?task=showlList'");
out.print("</script>");
} else {
out.print("<script>alert('处理事务失败');" + "window.history.back()");
out.print("</script>");
return null;
}
} else {
out.print("<script>alert('登录时间过期,请重新登录');"
+ "window.top.location.href='" + request.getContextPath()
+ "/Jsp_file/login/login.jsp';");
out.print("</script>");
}
return null;
}
public ActionForward getmyaffair(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
AffairReqForm affairReqForm = (AffairReqForm) form;
request.setCharacterEncoding("GBK");
response.setCharacterEncoding("GBK");
HttpSession httpsession = request.getSession();
Tuser user = (Tuser)httpsession.getAttribute("user");
PrintWriter out = null;
try {
out = response.getWriter();
} catch (IOException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
}
if (user != null) {
int currentPage = 1;
try {
currentPage = Integer.parseInt(request.getParameter("currentPage"));
} catch (Exception e) {
currentPage = 1;
}
int count = 10;
String rgrade = request.getParameter("rgrade");
String starttime = request.getParameter("starttime");
String endtime = request.getParameter("endtime");
request.setAttribute("uno",user.getUno());
Transreq reqbean = new Transreq();
reqbean.setRstatus(rgrade);
reqbean.setRstarttime(starttime);
reqbean.setRendtime(endtime);
List reqList = affairdao.myarrairList(currentPage,count,reqbean,request);
String sql ="";
String centent = "";
String path = request.getContextPath()+"/affairReq.do?task=getmyaffair&";
sql ="select count(*) from transreq a left join transtype b on b.rtid = a.tno ";
sql =sql +" left join tuser c on c.uno = a.uno where c.uno = '"+user.getUno()+"'";
if(rgrade !=null && !rgrade.trim().equals("")){
centent=centent+" and a.rgrade ='"+rgrade.trim()+"'";
path = path+"rgrade="+rgrade+"&";
}
if(starttime!=null &&!starttime.trim().equals("")){
centent=centent+" and a.rlasttime between'"+starttime.trim()+"'";
centent=centent+" and '"+endtime.trim()+"'";
path = path+"starttime="+starttime+"&";
path = path+"endtime="+endtime+"&";
}
sql =sql +centent;
ReqPage reqpages = reqpage.getPage(currentPage,count,sql);
reqpages.setPath(path);
request.setAttribute("reqLists",reqList);
request.setAttribute("reqpage", reqpages);
request.setAttribute("flag", "2");
return mapping.findForward("getmyaffair");
} else {
out.print("<script>alert('登录时间过期,请重新登录');"
+ "window.top.location.href='" + request.getContextPath()
+ "/Jsp_file/login/login.jsp';");
out.print("</script>");
}
return null;
}
public ActionForward myaffair(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
AffairReqForm affairReqForm = (AffairReqForm) form;
request.setCharacterEncoding("GBK");
response.setCharacterEncoding("GBK");
HttpSession httpsession = request.getSession();
Tuser user = (Tuser)httpsession.getAttribute("user");
PrintWriter out = null;
try {
out = response.getWriter();
} catch (IOException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
}
if (user != null) {
int currentPage = 1;
try {
currentPage = Integer.parseInt(request.getParameter("currentPage"));
} catch (Exception e) {
currentPage = 1;
}
int count = 10;
String username = request.getParameter("reqUsername");
String rgrade = request.getParameter("rgrade");
String starttime = request.getParameter("starttime");
String endtime = request.getParameter("endtime");
request.setAttribute("uno",user.getUno());
Transreq reqbean = new Transreq();
reqbean.setReqUsername(username);
reqbean.setRstatus(rgrade);
reqbean.setRstarttime(starttime);
reqbean.setRendtime(endtime);
List reqList = affairdao.myreqList(currentPage,count,reqbean,request);
String sql ="";
String centent = "";
String path = request.getContextPath()+"/affairReq.do?task=myaffair&";
sql ="select count(*) from transstep a ";
sql =sql + " left join transreq b on a.rqid = b.rqid ";
sql =sql + " left join tuser c on b.uno = c.uno ";
sql =sql +" left join transtype d on d.rtid = b.tno where a.sstatus<>'0' and c.uno = '"+user.getUno()+"'";
if(username!=null&&!username.trim().equals("")){
centent=centent+" and c.utruename like '%"+username.trim()+"%'";
path = path+"reqUsername="+username+"&";
}
if(rgrade !=null && !rgrade.trim().equals("")){
centent=centent+" and b.rgrade ='"+rgrade.trim()+"'";
path = path+"rgrade="+rgrade+"&";
}
if(starttime!=null &&!starttime.trim().equals("")){
centent=centent+" and b.rlasttime between'"+starttime.trim()+"'";
centent=centent+" and '"+endtime.trim()+"'";
path = path+"starttime="+starttime+"&";
path = path+"endtime="+endtime+"&";
}
sql =sql +centent;
ReqPage reqpages = reqpage.getPage(currentPage,count,sql);
reqpages.setPath(path);
request.setAttribute("reqList",reqList);
request.setAttribute("reqpage", reqpages);
return mapping.findForward("getmyaffair");
} else {
out.print("<script>alert('登录时间过期,请重新登录');"
+ "window.top.location.href='" + request.getContextPath()
+ "/Jsp_file/login/login.jsp';");
out.print("</script>");
}
return null;
}
public ActionForward showmyaffair(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
AffairReqForm affairReqForm = (AffairReqForm) form;
String rqid = request.getParameter("rqid");
String currentid = request.getParameter("currentid");
PrintWriter out = null;
try {
out = response.getWriter();
} catch (IOException e1) {
// TODO 自动生成 catch 块
e1.printStackTrace();
}
HttpSession httpsession = request.getSession();
Tuser user = (Tuser)httpsession.getAttribute("user");
if (user != null) {
List auditlist = affairdao.getaudit(request);
request.setAttribute("audit", auditlist);
request.setAttribute("rqid",rqid);
request.setAttribute("currentid",currentid);
return new ActionForward("/Jsp_file/affair/affairdetail.jsp");
} else {
out.print("<script>alert('登录时间过期,请重新登录');"
+ "window.top.location.href='" + request.getContextPath()
+ "/Jsp_file/login/login.jsp';");
out.print("</script>");
}
return null;
}
public IAffair getAffairdao() {
return affairdao;
}
public void setAffairdao(IAffair affairdao) {
this.affairdao = affairdao;
}
public ReqPage getReqpage() {
return reqpage;
}
public void setReqpage(ReqPage reqpage) {
this.reqpage = reqpage;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -