JavaWeb project-library management system

Table of contents

1. Design task and purpose……………………………………………….4
2. Design idea……………………………… ……………………………………4
3. Outline design…………………………………………………………………5
4. Detailed design ………………………………………………………………5
5. Software requirements……………………………………… ………………………8
6. Feasibility study…………………………………………………………………………………………………………
10 ………………………………………………………………11
8. References………………………………………………………… ……….11

Preface
1. Purpose of curriculum design
1. Master the popular information system development methods2
. Improve the ability to comprehensively use the knowledge you have learned to develop information systems
3. Improve the ability to use Java language programming
4. Improve students' ability to use database technology to solve practical problems
5. Combine Java and SQL to improve everyone's ability to carry out comprehensive development .
2. Curriculum design form
The instructor teaches online, and the students complete the code typing online and send screenshots of successful functions to the QQ group for the teacher's acceptance and inspection, and complete the homework assigned by the teacher every day. Finally, the project is completed in the form of writing an internship report and a defense. Actively communicate with the teacher in the classroom. The teacher will do part of what he said and accept it. If you continue to encounter problems through self-thinking, you can ask the teacher for practical answers, so that we can understand the realization process of the project and practice the project independently. .
1. Design task and purpose
Design a Java book management system to enable students to complete the test questions assigned by the teacher online.
Basic framework construction
Functional requirements
(1) Add, delete, modify and check the system after login
(2) Use the main page to provide user login, including user name and password, administrators can "log in" and "modify" account name, password login
( 3) Administrator system management, basic management, reader management, book query management, borrowing and return management (
4) Ordinary users: book query management, personal information modification, password, borrowing and return management

2. Design ideas
2.1 Technical route
First, develop and design the library management system so that we can complete each module according to the design, adopting the idea of ​​separating front and back ends, front end + back end + database, and the back end adopts the classic Java MVC three Layer architecture is designed to reduce code redundancy, which is convenient for us to maintain it later, and write interactive functions in categories. Functional codes can be written according to the following software architecture design, that is, functions such as connecting to databases and CRUD, to achieve front-end execution Corresponding operations, the database can change in real time.
Use IDEA to complete the production of the front-end page, and connect to the database and operate the database. The database uses MYSQL, and uses Navicat Premium database visualization software to operate the data and view the changes in the database after the front-end operation.
2.2 Software architecture design
2.2.1 Functional structure
According to the demand research results, it is determined that the system mainly includes the following functional modules, as shown in Figure 3.1.
insert image description here

Figure 2-1 System function module diagram

2.2.2 JAVA classic MVC three-tier architecture

insert image description here

Figure 2-2 JAVA classic MVC three-tier architecture diagram

3. Outline design of
Java book management system:

3.1 Design of system structure diagram

insert image description here

Figure 3-1 System structure and function diagram

3.2 Development tools and operating environment
The software environment required for the operation of the library management system is as follows.
(1) Operating system:
Application server: Windows NT Server 2008 or above
PC for readers: Windows XP and above
(2) Database management system:
MySQL 8.0.27
(3) Web browser:
Application server: Google Chrome
PC for readers Machine: Google Chrome or Firefox
(4) Development environment:
IDEA
(5) Database management tool:
Navicat Premium 11.2
(6) Operating environment:
Tomcat 9.0 + Apache

4. Detailed Design
4.1 System User Use Case Diagram
System User
insert image description here

4-1 System user use case diagram

4.2 User login use case diagram
User login
insert image description here

4-2 User login use case diagram

4.3 Business Flowchart
insert image description here

4-3 Business Flowchart

4.4 Data flow diagram
Top-level diagram:
insert image description here

4-4 Data flow diagram - top-level diagram

1 layer map
insert image description here

4-5 Data Flow Diagram - Layer 1 Diagram

2 layer map
insert image description here

4-6 Data Flow Diagram - 2-Layer Diagram

insert image description here

4-7 Data Flow Diagram - 2-Layer Diagram

4.5 Data dictionary
There are 4 tables
admin table:
insert image description here

Figure 4-8 admin table

Book table:
insert image description here

Figure 4-9 admin table

booktype table:
insert image description here

Figure 4-10 booktype table

history table:
insert image description here

Figure 4-11 history table

4.6 Database introduction
The database uses MYSQL 8.0.27 version, and the database visualization software Navicat Premium is used to display the database. There are four tables in the database, namely admin, book, booktype and history.
admin (user table): This table contains information such as account numbers, passwords, phone numbers, and email addresses of readers and administrators. The account is distinguished as a reader or an administrator by the value of status.
book (book table): This table has information such as name, id, category, author, and quantity.
booktype (book classification table): This table contains id, name and other information.
History (historical information table): This table stores the specific information of the book, the date of borrowing, the date of return, and the specific reader who borrowed it.
4.7 ER Entity Diagram Design

insert image description here

Figure 4-12 ER entity design diagram

5. Software requirements
5.1 System login module
insert image description here

Figure 5-1 Login flow chart

The specific running effect is shown in Figure 5-2.
insert image description here

Figure 5-2 Login interface

insert image description here

Figure 5-3 Interface after login

The key program code of its code is as follows:

AdiminDao.class
    public boolean Login_verify(String username, String password) {
    
    
    Connection  conn=DBUtil.getConnectDb();
    String sql="select * from admin where username='"+username+"'and password='"+password+"'";
        PreparedStatement stm=null;
        ResultSet rs=null;
        try {
    
    
           stm =conn.prepareStatement(sql);
           rs= stm.executeQuery();
           if (rs.next()){
    
    
               return  true;
           }
        }catch (SQLException e){
    
    
            e.printStackTrace();
        }finally {
    
    
            DBUtil.CloseDB(rs,stm,conn);
        }
        return false;
    }
    //获取Admin的用户名和密码
    public AdminBean getAdminInfo(String username, String password) {
    
    
        AdminBean adminBean=new AdminBean();
        Connection  conn=DBUtil.getConnectDb();
        String sql="select * from admin where username='"+username+"'and password='"+password+"'";
        PreparedStatement stm=null;
        ResultSet rs=null;
        try {
    
    
            stm =conn.prepareStatement(sql);
            rs= stm.executeQuery();
            if (rs.next()){
    
    
                adminBean.setAid(rs.getInt("aid"));
                adminBean.setUsername(rs.getString("username"));
                adminBean.setName(rs.getString("name"));
                adminBean.setPassword(rs.getString("password"));
                adminBean.setEmail(rs.getString("email"));
                adminBean.setPhone(rs.getString("phone"));
                adminBean.setStatus(rs.getInt("status"));
                adminBean.setLend_num(rs.getInt("lend_mun"));
                adminBean.setMax_num(rs.getInt("max_num"));
            }
        }catch (SQLException e){
    
    
            e.printStackTrace();
        }finally {
    
    
            DBUtil.CloseDB(rs,stm,conn);
        }
        return adminBean;
    }
    //获取Admin的标识号
    public AdminBean get_AidInfo2(String aid) {
    
    
        AdminBean adminBean=new AdminBean();
        Connection  conn=DBUtil.getConnectDb();
        String sql="select * from admin where aid="+aid;
        PreparedStatement stm=null;
        ResultSet rs=null;
        try {
    
    
            stm =conn.prepareStatement(sql);
            rs= stm.executeQuery();
            if (rs.next()){
    
    
                adminBean.setAid(rs.getInt("aid"));
                adminBean.setUsername(rs.getString("username"));
                adminBean.setName(rs.getString("name"));
                adminBean.setPassword(rs.getString("password"));
                adminBean.setEmail(rs.getString("email"));
                adminBean.setPhone(rs.getString("phone"));
                adminBean.setStatus(rs.getInt("status"));
                adminBean.setLend_num(rs.getInt("lend_mun"));
                adminBean.setMax_num(rs.getInt("max_num"));
            }
        }catch (SQLException e){
    
    
            e.printStackTrace();
        }finally {
    
    
            DBUtil.CloseDB(rs,stm,conn);
        }
        return adminBean;
    }
LoginServlet.class
@WebServlet("/LoginServlet")
public class LoginServlet extends HttpServlet {
    
    
    private static final long serialVersionUID = 1L;
    public LoginServlet() {
    
    
    }
    Protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
    
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
    

        //登录的判断
        PrintWriter out = response.getWriter();
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");

        //获取账号和密码
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        AdminDao userDao = new AdminDao();
        //对账号和密码进行判断
        boolean result = userDao.Login_verify(username, password);
        HttpSession session = request.getSession();
        //判断输入正确
        if (result) {
    
    
            AdminBean adminBean = new AdminBean();
            AdminDao adminDao = new AdminDao();
            //更加账号和密码查找出读者的信息
            adminBean = adminDao.getAdminInfo(username, password);
            //将aid存入session中
            session.setAttribute("aid", "" + adminBean.getAid());
            //设置session的失效时间
            session.setMaxInactiveInterval(6000);
            //根据status的值来判断是管理员,还是读者,status=1为读者
            if (adminBean.getStatus() == 1) {
    
    
                response.sendRedirect("/index2.jsp");
            } else {
    
    
                response.sendRedirect("/admin.jsp");
            }

        } else {
    
    
            //没有找到对应的账号和密码,返回重新登录
            session.setAttribute("state", "密码错误");
            response.sendRedirect("/login.jsp");
        }
    }
}
  1. 2 Add book information module
    insert image description here
Figure 5-4 Adding information

insert image description here

Figure 5-5 The result map after adding

insert image description here

Figure 5-6 Database change diagram

The key program code of its code is as follows:

BookDao.class
public static void addBook(String card, String name, String type, String autho, String press, int num) {
    
    
        Connection conn = DBUtil.getConnectDb();
        String sql="insert into  book(card,name,type,autho,press,num) values(?,?,?,?,?,?)";
        int rs = 0;
        PreparedStatement stm = null;
        try {
    
    
            stm = conn.prepareStatement(sql);
            stm.setString(1,card);
            stm.setString(2,name);
            stm.setString(3,type);
            stm.setString(4,autho);
            stm.setString(5,press);
            stm.setInt(6,num);
            rs = stm.executeUpdate();
        } catch (SQLException e) {
    
    
            e.printStackTrace();
        }
    }
AddBookServlet.class
@WebServlet("/AddBookServlet")
//添加图书
public class AddBookServlet extends HttpServlet {
    
    
    private  static  final  long serialVersionUID =1L;
    public AddBookServlet() {
    
    
    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
    
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
    
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        String card = request.getParameter("card");
        String name = request.getParameter("name");
        String type = request.getParameter("type");
        String autho = request.getParameter("autho");
        String press = request.getParameter("press");
        int num=Integer.parseInt(request.getParameter("num"));
        BookDao bookdao = new BookDao();
        BookDao.addBook(card,name, type,autho,press,num);
        response.sendRedirect("admin_book.jsp");
    }
} 

  1. 3 View the book borrowing record module
    insert image description here
Figure 5-7 Reader borrowing records

insert image description here

Figure 5-8 Admin borrowing records

insert image description here

Figure 5-9 Database - borrowing information

The key program code of its code is as follows:

get_HistoryListInfo(BookDao.class
public ArrayList<HistoryBean> get_HistoryListInfo(int status, String aid) {
    
    
        ArrayList<HistoryBean> tag_Array = new ArrayList<HistoryBean>();
        Connection conn = DBUtil.getConnectDb();
        String sql = "select * from history where aid='" + aid + "' and status='"+ status +"'";
        PreparedStatement stm = null;
        ResultSet rs = null;
        try {
    
    
            stm = conn.prepareStatement(sql);
            rs = stm.executeQuery();
            while (rs.next()) {
    
    
                HistoryBean tag = new HistoryBean();
                tag.setHid(rs.getInt("hid"));
                tag.setAid(rs.getInt("aid"));
                tag.setCard(rs.getString("bid"));
                tag.setBookname(rs.getString("bookname"));
                tag.setAdminname(rs.getString("adminname"));
                tag.setUsername(rs.getString("username"));
                tag.setBegintime(rs.getString("begintime"));
                tag.setEndtime(rs.getString("endtime"));
                tag.setStatus(rs.getInt("status"));
                tag_Array.add(tag);
            }
        } catch (SQLException e) {
    
    
            e.printStackTrace();

        } finally {
    
    
            DBUtil.CloseDB(rs, stm, conn);
            return tag_Array;

        }
    }

get_HistoryListInfo2(BookDao.class
public ArrayList<HistoryBean> get_HistoryListInfo2(int status) {
    
    
        ArrayList<HistoryBean> tag_Array=new ArrayList<HistoryBean>();
        Connection conn = DBUtil.getConnectDb();
        String sql = "select * from history where status='"+status+"'";
        PreparedStatement stm = null;
        ResultSet rs = null;
        try {
    
    
            stm = conn.prepareStatement(sql);
            rs = stm.executeQuery();
            while (rs.next()) {
    
    
                HistoryBean tag = new HistoryBean();
                tag.setHid(rs.getInt("hid"));
                tag.setAid(rs.getInt("aid"));
                tag.setBid(rs.getInt("bid"));
                tag.setCard(rs.getString("card"));
                tag.setBookname(rs.getString("bookname"));
                tag.setAdminname(rs.getString("adminname"));
                tag.setUsername(rs.getString("username"));
                tag.setBegintime(rs.getString("begintime"));
                tag.setEndtime(rs.getString("endtime"));
                tag.setStatus(rs.getInt("status"));
                tag_Array.add(tag);
            }
        }catch(SQLException e){
    
    
            e.printStackTrace();
        }finally {
    
    
            DBUtil.CloseDB(rs, stm, conn);
        }return tag_Array;
    }
borrowServlet.class
@WebServlet("/borrowServlet")
public class borrowServlet extends HttpServlet {
    
    
    private static final long serialVersionUID = 1L;

    public borrowServlet() {
    
    
    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
    
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        BookDao bookDao=new BookDao();
        int tip=Integer.parseInt(request.getParameter("tip"));
        //管理员
        if (tip==2) {
    
    
            int hid=Integer.parseInt(request.getParameter("hid"));
            int show=Integer.parseInt(request.getParameter("show")) ;
            bookDao.borrowBook2(hid);
            if (show==2){
    
    
                response.sendRedirect("admin_borrow.jsp");
            }else{
    
    
                response.sendRedirect("borrow.jsp");
            }
        }else{
    
    
            //读者
            int bid=Integer.parseInt(request.getParameter("bid"));
            HttpSession session=request.getSession();
            String aid=(String) session.getAttribute("aid");
            AdminDao adminDao=new AdminDao();
            AdminBean admin =new AdminBean();
            admin=adminDao.get_AidInfo2(aid);
            bookDao.borrowBook(bid,admin);
            response.sendRedirect("select.jsp");
        }
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
    
    }
}

6. Feasibility study
(1) Economic feasibility
Since the library management system has fewer developers and maintenance personnel, the cost is lower, and the economic investment is very small. After the system is completed, it will provide great benefits for future library management. It is convenient to estimate the development cost of the new system and the future operation and maintenance costs, estimate the benefits that the new system will obtain, and compare the costs with the benefits, which is very beneficial for future use.
(2) Technical feasibility
Technical feasibility should consider whether the existing technical conditions can successfully complete the development work, whether the software and hardware configuration can meet the development requirements, etc. The book management system uses the JAVA development language, the debugging is relatively simple, and the current computer hardware configuration can fully meet the development requirements, so it is absolutely feasible technically. Software: Since the current stand-alone mode is relatively mature, the software development platform is mature and feasible. They have fast speed, large capacity, high reliability and low price, which can fully meet the needs of the system.
(3) Operational Feasibility
The website can be quickly accepted by librarians, students and staff. The PCs installed in the library are used by librarians. They send information such as modifying, deleting, and updating books to the server through the PC. The server responds in time, and the database immediately modifies the corresponding information. Readers can also enter the website to borrow books and view related information.
Only one computer and one programmer are needed to develop this project, and there are sufficient resources on the Internet for utilization, which is highly operable and convenient.

7. Experience and experience
The two-week javaweb book management system internship is over. In this short period of two weeks, I followed the teacher to develop the project. The teacher really taught us by hand and was very enthusiastic. I am very happy You can meet such a teacher. Looking back on the work and efforts I have made in the past two weeks, I feel that I have gained a lot. In addition to the content of the internship itself, it also includes many things beyond the meaning of the internship itself.
Although the class is taught online, the roommates are also by my side. We will discuss many issues together, research every step of the project, make sure that I understand what I have learned, and even help others solve problems. Teamwork skills and independent thinking and problem-solving skills have been greatly improved.
In my previous study projects, it was not as systematic and complete as this time. At most, I designed some small programs, but this internship is different. It can be said that I think the biggest help the internship has brought me is to make me understand the course. With more interests and improved programming skills, sometimes I wonder why I suddenly became obsessed with programming, almost obsessive love, and I used to throw away the books after class , but since I learned java, I have been looking forward to the final internship. I can independently design a system and other programs, so I am full of passion in class, and sometimes I like to fiddle with the computer after class. program, to do some little research. From the previous "fear" class to the current "expectation" class, the content of our internship this time is to develop a library management system based on the database application system of java and MYSQL, and design the specific functions of the library management system according to the needs of the library management system Then write the code. But the only difference is that the development of the library management system was led by the teacher to develop with us, and we learned about every process of the project.
In this way, in the last time of the internship, I finally completed my own library management system. When I saw the library management system I designed was successfully compiled and running, the joy and incomparable sense of accomplishment in my heart were simply "unparalleled". . Sometimes I find that the role of internship is really irreplaceable. I have been saying that it is really a correct decision for the school to arrange internships every semester. Sometimes we even have a feeling, that is, The knowledge we have learned in the internship in the last few weeks is even more than what we usually learn in class, because usually what we learn is only limited to books or the teacher's lectures, and during the internship, our actual operation process will be more difficult. All kinds of problems encountered may not be involved in the classroom. Another obvious gain is that we may usually just input the ready-made code directly when we study in class, so there is no particularly big gain. But the difference is that with the deepening of the internship, we gradually get to know the codes that we usually can't understand. Gradually, we don't need books or notes, and we can type out the codes by ourselves. , and later we can study the codes required to implement some functions that we haven't talked about usually. It can be said that this is really a bit "unbelievable". Without this internship, we might not be able to find out where these problems are, so just learning theoretical things will only put us on the shelf. Through this internship, the most important thing is to let us learn to find problems. Learn to solve problems by yourself in the process of solving problems, and finally solve the problems obtained, including the joy after success, will be our own things, become our valuable wealth and experience, and a potential source of energy , benefit endlessly.
8. References
[1] Java technology and digital library [J]. Wang Lihua, Sun Jiaomei. Modern Library and Information Technology. 1999 (04) [2] Application of
Java technology in the field of image processing [J]. An Guoyan . Electronic Technology and Software Engineering. 2021(23)
[3] Application of Java Programming Language in Big Data Development [J]. Wang Ruwei. Electronic Technology. 2022(01)
[4] Design and implementation of Java-based financial consumer complaint audit assistant [J]. Wang Chunshan, Sun Xin. Financial Technology Era. 2022 (02) [5]
"Java Programming" teaching resources for software development practice ability Construction [J]. Yang Xin. China New Communications. 2021(24)
[6] Design and Implementation of Java-based Enterprise Human Resource Management System [J]. Zhang Jun. China Information Technology. 2022(03)
[7] JAVA Application of Combining with Artificial Intelligence in Network Teaching [J]. Chen Yanping. Heilongjiang Science. 2021(03)
[8] Analysis of Java Programming Language Based on Computer Software Development [J]. Wang Hongjuan. Computer Knowledge and Technology. 2021(05 )
[9] Online Examination and Practice System for Java Programming [J]. Chen Min, Tang Huiyi. Journal of Jishou University (Natural Science Edition). 2020 (05) [10] Employment Analysis of Java Industry Based on
Web Crawler [J] ]. Wu Xuekai, Liu Tianbo, Hu Wenxin. Science and Technology Information. 2021(02)
[11]Design and Implementation of UML and Java-Based Library Management System[J]. Qi Yan. Electronic Technology and Software Engineering. 2020(20)
[12] Application of multimedia interactive technology in library management system [J]. Yu Hang, Wang Haotian. Computer programming skills and maintenance. 2020 (02) [13] Design and implementation of mobile library management system in colleges and universities [J]. Wei Lifang
. Electronic Technology and Software Engineering. 2020(02)
[14] Modeling and Implementation of Library Management System Based on UML and Java [J]. Wang Qi. Computer Products and Circulation. 2019(07) [15] Books Based on
UML and Java Modeling and Implementation of Management System[J]. Zhang Zheng, Jiang Yonghui. Computer Knowledge and Technology. 2019(01)

Guess you like

Origin blog.csdn.net/weixin_47725255/article/details/125858260