功能设计:
-
公文拟制:创建新的电子公文,对创建的电子公文进行上传操作。
-
签收公文:当接收方接收公文后,会给发送方发回执信息,确认公文已经收到。
-
浏览公文(已签收的公文):
1) 选择日期段。
2) 通过“查询”功能,显示该时间段内已通过审签的正式公文。
3) 点击公文标题,将会显示出该公文的具体信息。
-
修改公文:对拟制好的的电子公文进行格式化处理操作,套用公文样例。
-
公文流转:按照公文流转流程设定公文接收用户。
-
删除公文:如果该公文没有通过审核或审签,需要删除可以利用“删除”功能。确定后,系统提示公文删除成功,删除的公文将在“被删除公文”模块中的显示。
-
公文发送:操作员要根据单位管理员选择的公文的流程进行公文的流转发送,实现待发公文和已发送公文的管理
-
审核公文(修改并签意见):签署审核意见和修改意见,并将退回办公室。
-
有审签公文(修改并签意见):签署审前意见和修改意见,若同意,则生成正式公文并交由办公室转发。
-
浏览已发所有公文:按日期查看所有已发公文,点击标题可查看具体信息。
-
公文查询:是查询由公文交换系统处理过的公文,并且建立或检查公文详尽的索引信息。可以根据发送机构、接收机构、公文种类和其它开放信息进行公文数据查询。
-
系统管理:
-
角色配置管理
-
用户权限维护功能:实现对用户的角色管理。
-
角色维护功能:实现对角色权限的管理,主要有编辑、增加和删除操作。
-
-
用户管理:查看用户、新开用户、暂停用户、用户信息修改、删除用户
-
单位管理员设置功能:每个单位的操作员实现修改密码、修改个人信息。
-
我的程序大多都没有实现,自认为只完成了不到十分之一,基本为录入和登录功能。
package dao; //对数据库的操作 import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import entity.Course; import util.DBUtil; /** * 课程Dao * Dao层操作数据 * @author Zheng * */ public class CourseDao { /** * 添加 增 * @param course * @return */ public boolean add(Course course) { String sql = "insert into course(title, workname, man) values('" + course.getTitle() + "','" + course.getWorkname() + "','" + course.getMan() + "')"; Connection conn = DBUtil.getConn(); Statement state = null; boolean f = false; int a = 0; try { state = conn.createStatement(); state.executeUpdate(sql); } catch (Exception e) { e.printStackTrace(); } finally { DBUtil.close(state, conn); } if (a > 0) { f = true; } return f; } public boolean title(String title) { boolean flag = false; String sql = "select name from course where name = '" + title + "'"; Connection conn = DBUtil.getConn(); Statement state = null; ResultSet rs = null; try { state = conn.createStatement(); rs = state.executeQuery(sql); while (rs.next()) { flag = true; } } catch (SQLException e) { e.printStackTrace(); } finally { DBUtil.close(rs, state, conn); } return flag; } }
package entity; public class Course { private String title; private String workname; private String man; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getWorkname() { return workname; } public void setWorkname(String workname) { this.workname = workname; } public String getMan() { return man; } public void setMan(String man) { this.man = man; } public Course() {} //*构造方法 public Course(String title, String workname, String man) { this.title = title; this.workname = workname; this.man = man; } }
package service; import java.util.List; import dao.CourseDao; import entity.Course; /** * CourseService * 服务层 * @author Zheng * */ @SuppressWarnings("unused") public class CourseService { CourseDao cDao = new CourseDao(); /** * 添加 * @param course * @return */ public boolean add(Course course) { boolean f = false; if(!cDao.title(course.getTitle())) { cDao.add(course); f = true; } return f; }}
package servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import entity.Course; import service.CourseService; @SuppressWarnings("unused") @WebServlet("/CourseServlet") public class CourseServlet extends HttpServlet { private static final long serialVersionUID = 1L; CourseService service = new CourseService(); /** * 方法选择 */ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); String method = req.getParameter("method"); if ("add".equals(method)) { add(req, resp); } } /** * 添加 * @param req * @param resp * @throws IOException * @throws ServletException */ private void add(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { req.setCharacterEncoding("utf-8"); String title = req.getParameter("title"); String workname = req.getParameter("workname"); String man = req.getParameter("man"); Course course = new Course(title,workname,man); //添加后消息显示 if(service.add(course)) { req.setAttribute("message", "添加成功"); req.getRequestDispatcher("add.jsp").forward(req,resp); } else { req.setAttribute("message", "课程名称重复,请重新录入"); req.getRequestDispatcher("add.jsp").forward(req,resp); } }}
package util; //数据库连接 import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; /** * 数据库连接工具 * @author Zheng * */ public class DBUtil { public static String db_url = "jdbc:mysql://localhost:3306/test?useSSL=false"; public static String db_user = "root"; public static String db_pass = "root"; public static Connection getConn () { Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver");//加载驱动 conn = DriverManager.getConnection(db_url, db_user, db_pass); } catch (Exception e) { e.printStackTrace(); } return conn; } /** * 关闭连接 * @param state * @param conn */ public static void close (Statement state, Connection conn) { if (state != null) { try { state.close(); } catch (SQLException e) { e.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } public static void close (ResultSet rs, Statement state, Connection conn) { if (rs != null) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } } if (state != null) { try { state.close(); } catch (SQLException e) { e.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } }
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <style> .a{ margin-top: 20px; } .b{ font-size: 20px; 160px; color: white; background-color: greenyellow; } </style> </head> <body> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <h1 style="color: red;">公文录入</h1> <a href="index.jsp">返回主页</a> <form action="CourseServlet?method=add" method="post" onsubmit="return check()"> <div class="a"> 公文标题<input type="text" id="title" name="title"/> </div> <div class="a"> 部门名称<input type="text" id="workname" name="workname" /> </div> <div class="a"> 起草人<input type="text" id="man" name="man" /> </div> <div class="a"> <button type="submit" class="b">保 存</button> </div> </form> </div> <script type="text/javascript"> function check() { var title = document.getElementById("title");; var workname = document.getElementById("workname"); var man = document.getElementById("man"); //非空 if(title.value == '') { alert('公文为空'); name.focus(); return false; } if(workname.value == '') { alert('部门为空'); teacher.focus(); return false; } if(man.value == '') { alert('起草人'); classroom.focus(); return false; } } </script> </body> </html>
<%@ page import="java.sql.*" language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>登录界面</title>
</head>
<body>
<center>
<h1 style="color:red">登录</h1>
<form id="indexform" name="indexForm" action="logincheck.jsp" method="post">
<table border="0">
<tr>
<td>账号:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="password">
</td>
</tr>
</table>
<br>
<input type="submit" value="登录" style="color:#BC8F8F">
</form>
<form action="zhuce.jsp">
<input type="submit" value="注册" style="color:#BC8F8F">
</form>
</center>
</body>
</html>
<%@ page import="java.sql.*" language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <jsp:useBean id="db" class="Bean.DBBean" scope="page" /> <% request.setCharacterEncoding("UTF-8"); String username=(String)request.getParameter("username"); String password=(String)request.getParameter("password");//取出login.jsp的值 //下面是数据库操作 String sql="select * from login where username="+"'"+username+"'";//定义一个查询语句 ResultSet rs=db.executeQuery(sql);//运行上面的语句 if(rs.next()) { /* if(password.equals(rs.getString(2))) { } */ if(password.equals(rs.getObject("password"))){ response.sendRedirect("loginsuccess.jsp"); } else{ out.print("<script language='javaScript'> alert('密码错误');</script>"); response.setHeader("refresh", "0;url=login.jsp"); } } else { out.print("<script language='javaScript'> alert('账号错误——else');</script>"); response.setHeader("refresh", "0;url=login.jsp"); } %> </body> </html>
<%@ page import="java.sql.*" language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>登陆成功</h1>
</body>
</html>