zoukankan      html  css  js  c++  java
  • 公文流转系统初尝试1

      今天第一次接触这类项目,但切实的反应出很多问题,自身的逻辑思路不佳,基础网页的构建速度过慢等等..

    先看一下大致题目

    1、项目需求:

    河北金力集团是我省机械加工的龙头企业,主要从事矿山机械制造及各种机械零部件加工。企业有3个厂区,主厂区位于省高新技术开发区,3个分厂分别在保定、邢台和唐山。为增加企业的核心竞争力和加强管理的科学程度,近期企业将在全集团实行ERP管理,建立网页版公文流转系统。具体部门:主厂区、一分厂、二分厂、三分厂、销售部门、财务部门、办公室;领导:三位副厂长(分别管理生产、销售、财务)、一位厂长。

    公文流转的流程:

    2. 板块功能需求

    1)、页面要求

    ① 能适应800*600或1024*768分辨率;

    ② 布局合理、结构清晰、页面完整;

    ③ 有效页面数在8页以上;

    ④ 分页与主页风格统一;

    ⑤ 首页(登录页):用户登录页(共有十位用户帐号,帐号、密码可预设)。不同用户登录后,进入的功能页不相同,要求密码在数据库中加密。

    ⑥ 部门(不含办公室)功能页:有公文拟制、签收公文、浏览公文(已签收的公文)三个模块

    ⑦ 办公室功能页:有修改公文、公文流转、删除公文、公文发送等功能。

    ⑧ 副厂长功能页:有审核公文(修改并签意见)、浏览已发所有公文、查询公文三个模块。

    ⑨ 厂长功能页:有审签公文(修改并签意见)、浏览已发所有公文、查询公文三个模块。

    ⑩ 系统管理功能页:有用户管理、角色管理、公文流转流程管理。

    2)、功能设计:

    1. 公文拟制创建新的电子公文,对创建的电子公文进行上传操作。
    2. 签收公文:当接收方接收公文后,会给发送方发回执信息,确认公文已经收到。
    3. 浏览公文(已签收的公文):

    1) 选择日期段。

    2) 通过“查询”功能,显示该时间段内已通过审签正式公文。

    3) 点击公文标题,将会显示出该公文的具体信息。

    1. 修改公文:拟制好的的电子公文进行格式化处理操作,套用公文样例。
    2. 公文流转:按照公文流转流程设定公文接收用户
    3. 删除公文:如果该公文没有通过审核或审签,需要删除可以利用删除”功能。确定后,系统提示公文删除成功,删除的公文将在“被删除公文”模块中的显示。
    4. 公文发送:操作员要根据单位管理员选择的公文的流程进行公文的流转发送实现待发公文和已发送公文的管理
    5. 审核公文(修改并签意见):签署审核意见和修改意见,并将退回办公室。
    6. 有审签公文(修改并签意见):签署审前意见和修改意见,若同意,则生成正式公文并交由办公室转发。
    7. 浏览已发所有公文:按日期查看所有已发公文,点击标题可查看具体信息。
    8. 公文查询是查询由公文交换系统处理过的公文,并且建立或检查公文详尽的索引信息。可以根据发送机构、接收机构、公文种类和其它开放信息进行公文数据查询
    9. 系统管理

    a)  角色配置管理

    1. 用户权限维护功能:实现对用户的角色管理。
    2. 角色维护功能:实现对角色权限的管理,主要有编辑、增加和删除操作。

    b) 用户管理:查看用户、新开用户、暂停用户、用户信息修改、删除用户

    c) 单位管理员设置功能:每个单位的操作员实现修改密码、修改个人信息。

      个人看到这个题目是很懵的状态,毕竟觉得资历尚浅,但相较于其他刻苦的同学,也感到十分惭愧。在一点一点的尝试一下,大致有了一定思路,但目前尚未完成。并没有着急处理复杂的工作流程,我先开始了基础的登录的界面,通过permission值(自己定义的)来确定登录身份(用户还是管理员),从而跳转到不同的操作页面,采用的是最基础的JDBC连接数据库,然后开始分析流程,这也是整个项目最难的地方,因为本人尚未实现各个流转的关系图,也没能完成各个页面,所以只能提供简单的登录代码,但个人认为,给定充分时间,可独立完成简单的公文流转页面。目前敲码仍不熟练,构建体系的思维还很弱,是导致完成时间长的主要原因,近期一定加强训练,争取早日3个半小时之内完成。

      在本次3个小时中,完成了基础的登录界面,可实现权限管理,不同权限操作的不同状态。在实践中也出现了很多问题,调取参数的空指针问题,页面间跳转问题(有时有弹出框)。以下代码将弹出框部分删除了

    <%@ page 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">
    </head>
    <body>
    <table border="1px" cellpadding="10px" cellspacing="0px"style=" 30%;margin:auto;background:rgb(195,195,195)"  bordercolor="blue" >
    <h1 align="center" style="font-weight: blue;font-size:230%;">注册页面</h1>
    <form action="sev?method=getin" method="post">
    <tr>
    <th>用户名</th>
    <td><input type="text" name="username"></td>
    </tr>
    <tr>
    <th>密码</th>
    <td><input type="text" name="password"></td>
    </tr>
    <tr>
    <th>身份为</th>
    <td>普通用户<input type="radio" name="permission" value="1"></td>
    <td>管理员<input type="radio" name="permission" value="0"></td>
    </tr>
    <tr>
                        <th colspan="2">
                            <input type="submit" value="注册">&nbsp;&nbsp;&nbsp;&nbsp;
                        </th>
                    </tr>
    
    </form>
    </table>
    </body>
    </html>

    这个是注册

    <%@ page 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">
    </head>
    <body>
    <table border="1px" cellpadding="10px" cellspacing="0px"style=" 30%;margin:auto;background:rgb(195,195,195)"  bordercolor="blue" >
    <h1 align="center" style="font-weight: blue;font-size:230%;">登录页面</h1>
    <form action="sev?method=in" method="post">
    <tr>
    <th>用户名</th>
    <td><input type="text" name="username"></td>
    </tr>
    <tr>
    <th>密码</th>
    <td><input type="text" name="password"></td>
    <a align="center" style="font-weight: blue;font-size:230%;"href="http://localhost:8080/turn/getkey.jsp">注册</a>
    <tr>
                        <th colspan="2">
                            <input type="submit" value="登录">&nbsp;&nbsp;&nbsp;&nbsp;
                        </th>
                    </tr>
    </tr>
    </form>
    </table>
    </body>
    </html>

    这个是登录

    package servlet;
    
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import java.util.List;
    
    import dbu.dbutil;
    import user.User;
    import dao.Dao;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    
    @WebServlet("/sev")
    public class sev extends HttpServlet {
        private static final long serialVersionUID = 1L;
           
        /**
         * @see HttpServlet#HttpServlet()
         */
        public sev() {
            super();
            // TODO Auto-generated constructor stub
        }
    
        /**
         * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
         */
        protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
            // TODO Auto-generated method stub
            //response.getWriter().append("Served at: ").append(request.getContextPath());
            req.setCharacterEncoding("UTF-8");
            resp.setCharacterEncoding("utf-8");
            String method=req.getParameter("method");
            if("in".equals(method))
            {
                in(req,resp);
            }
            if("getin".equals(method))
            {
                getin(req,resp);
            }
        }
    
        /**
         * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
         */
        protected static void in(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
            // TODO Auto-generated method stub
            req.setCharacterEncoding("UTF-8");
            resp.setCharacterEncoding("utf-8");
            String username=req.getParameter("username");
            String password=req.getParameter("passerword");
            Dao dao=new Dao();
            User user3=new User(username,password);
            boolean f=dao.in(user3);
            if(f) {
                req.setAttribute("message", "登录成功!");
                req.getRequestDispatcher("www.4399.com").forward(req,resp);
            } else {
                req.setAttribute("message", "注册失败!");
                req.getRequestDispatcher("keyin.jsp").forward(req,resp);
            }
        }
        protected static void getin(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
        {
            req.setCharacterEncoding("UTF-8");
            resp.setCharacterEncoding("utf-8");
            String username=req.getParameter("username");
            String password=req.getParameter("password");
            String permission=req.getParameter("permission");
            User user3=new User(username,password,permission);
            Dao DAO=new Dao();
            boolean f=DAO.adding(user3);
            if(f) {
                req.setAttribute("message", "注册成功!");
                req.getRequestDispatcher("keyin.jsp").forward(req,resp);
            } else {
                req.setAttribute("message", "注册失败!");
                req.getRequestDispatcher("keyin.jsp").forward(req,resp);
            }
        }
    
    }

    servlet

    package dbu;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    
    
    public class dbutil {
    
        public static String db_url = "jdbc:mysql://localhost:3306/shuju";
        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();
                }
            }
        }
    
        public static void main(String[] args) throws SQLException {
            Connection conn = getConn();
            PreparedStatement pstmt = null;
            ResultSet rs = null;
            String sql ="select * from userin";
            pstmt = conn.prepareStatement(sql);
            rs = pstmt.executeQuery();
            if(rs.next()){
                System.out.println("空");
            }else{
                System.out.println("非空");
            }
        }
        
    
    }

    dbu

    package dao;
    
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.Statement;
    
    import dbu.dbutil;
    import user.User;
    public class Dao{
    public boolean adding(User user3)
    {
        String sql = "insert into userin(username,password,permission)values('"+ user3.getUsername()+"','"+ user3.getPassword()+"','"+ user3.getPermission()+"')";
        Connection conn = dbutil.getConn();
        Statement state = null;
        boolean f = false;
        int a = 0;
        try {
            state = conn.createStatement();
            a=state.executeUpdate(sql);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            dbutil.close(state, conn);
        }
        if (a>0) {
            f = true;
        }
        return f;
    }
    public boolean in(User user3)
    {
        String sql="select *from userin";
        Connection conn = dbutil.getConn();
        Statement state = null;
        boolean f = false;
        int a = 0;
        try {
            ResultSet rs = state.executeQuery(sql);    
            state = conn.createStatement();
            a=state.executeUpdate(sql);
            
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            dbutil.close(state, conn);
        }
        return f;
    }
    }

    dao

    总的来说,本次实践暴露出很多问题,之前赖以复制的代码(dbu,servlet等),一旦自己手敲还是需要想想,没能做到熟练,这也是最大的问题,导致了时间久等,但亲身实践一次以后还是有了很大的收获,很多地方需要弥补,一定尽快改进。

  • 相关阅读:
    Django-(二).模型层
    firewalld
    2.Python爬虫入门二之爬虫基础了解
    1.Python爬虫入门一之综述
    wxpython 安装教程
    使用Pycharm 安装三方库
    Selenium中的webdriver定位元素失败的常见原因
    Linux 配置selenium + webdriver 环境
    类属性、实例属性
    linux 安装mysql数据库
  • 原文地址:https://www.cnblogs.com/2506236179zhw/p/12012446.html
Copyright © 2011-2022 走看看