Document Flow System Simulation

feature design:

        1. Document fiction : to create a new electronic documents, electronic documents created upload operation.

        2. Sign documents: when the recipient receives the document, the sender will send a receipt message confirming document has been received.

        3. Browse documents (the documents have been received):

          1) Select the date segments.

          2) the "Query" function displays the time period has passed Shenqian of official documents.

          3) Click the document title, it will show the specific information of the document.

        4. Review documents: for fiction good electronic document for formatting operation , apply the sample document.

        5. Document Flow: receiving a user document setting process according to the document flow .

        6. Delete documents: If the document is not approved or Shenqian , you need to delete can use the " delete " function. OK, the system prompts documents deleted successfully, delete the document will "be deleted documents Display" module.

        7. Send document: Operator To send a document flow process unit according to the administrator of the selected document , implement and outgoing documents have been sent document management

        8. Audit documents (revised and signed opinion): to sign audit opinions and amendments, and return the office.

        9. There Shenqian document (revised and signed opinion): the signing of pre-trial comments and amendments, if agreed, generate official documents and handed over office forwarded.

        10. Browse all the documents have been issued: View all sent documents by date, click on the title to view details.

        11. Document query : query processing by the document exchange system over the documents, and to establish or check the documents detailed index information. The transmission mechanism may be, receiving means, the type of documents and other information open document data query .

        12. System Management :

          1.  Configuration management role

            1. User permissions maintenance functions: user management roles.

            2. Role maintenance functions: management role permissions, mainly to edit, add, and delete operations.

          2. User Management: View user opened a new user, Suspend user, modify user information, delete users

          3. Unit Administrator to set function: the operator for each unit to achieve change passwords, modify personal information.

 Most of my programs are not implemented, since that only completed less than one-tenth of the basic features for the entry and log in.

Package DAO;
 // database operations 
Import the java.sql.Connection;
 Import the java.sql.ResultSet;
 Import java.sql.SQLException;
 Import the java.sql.Statement;

import entity.Course;
import util.DBUtil;

/**
 * Courses Dao
 * Dao operation data layer
* @author Zheng
 *
 */
public class CourseDao {

/**
    * Adding increase
* @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, () {}
     // * constructor


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
 * Service Layer
* @author Zheng
 *
 */
@SuppressWarnings("unused")
public class CourseService {

CourseDao cDao = new CourseDao();

    /**
    * Add to
* @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();

    /**
    * Methods
*/
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);
    }
    }

/**
    * Add to
* @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);

    // After the addition message 
IF (service.add (Course)) {
    req.setAttribute ( "the Message", "added successfully" );
req.getRequestDispatcher("add.jsp").forward(req,resp);
    } else {
    req.setAttribute ( "the Message", "repeat the course name, please re-enter" );
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;

/**
 * Database Connectivity Tools
* @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;
    }

    /**
    * Close the connection
* @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;
    width: 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;"> document entry </ h1>
    <a href="index.jsp"> Back Home </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">保&nbsp;&nbsp;&nbsp;存</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 ( 'empty document' );
name.focus();
    return false;
    }
    if(workname.value == '') {
    Alert ( 'empty sector' );
teacher.focus();
    return false;
    }
    if(man.value == '') {
    Alert ( 'drafter' );
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> login page </ title>
</head>
<body>
 <center>
 <h1 style="color:red">登录</h1>
 <form id="indexform" name="indexForm" action="logincheck.jsp" method="post">
 <table border="0">
 <tr>
 <Td> Account: </ td>
 <td><input type="text" name="username"></td>
 </tr>
 <tr>
 <Td> Password: </ 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");
 Password String ; = (String) request.getParameter ( "password") // the value is taken login.jsp

// The following is a database operation 
String = SQL "SELECT * WHERE Login from username =" + " '" + username + "'"; // definition of a query 
the ResultSet db.ExecuteQuery RS = (SQL); // run the above statement 
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 ( 'error code'); </ 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> successful landing </ h1>
</body>
</html>

 

Guess you like

Origin www.cnblogs.com/zql-42/p/12012389.html