Java Jsp MVC+mysql实现的物资租赁管理系统(管理员管理 客户管理 建材管理 租赁管理 财务管理)

本文主要是介绍Java Jsp MVC+mysql实现的物资租赁管理系统(管理员管理 客户管理 建材管理 租赁管理 财务管理),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

博客目录

  • 物资租赁管理系统
    • 功能截图
    • 技术点介绍
    • 系统流程图
    • 源码
    • 写在最后

物资租赁管理系统

背景:
物资租赁站长期大量出租各型钢管、扣件、塔吊等建筑施工设备。针对租赁器材品种繁多,租赁搭配麻烦,费用计算复杂。这些问题难题导致公司运营盈利管理不清晰,以及人工负担重,租赁过程中容易出错等问题,急切需要一款满足自身需求的管理软件,以提高办公效率。

功能截图

主要实现的功能点:
管理员管理
客户管理
建材管理
租赁管理
财务管理

登录页面:
在这里插入图片描述
主页面:
在这里插入图片描述
客户列表界面:
在这里插入图片描述
添加客户页面:
在这里插入图片描述

技术点介绍

JDK:1.7
开发工具:MyEclipse
运行环境:Tomcat
数据库:MySQL

系统流程图

在这里插入图片描述

源码

1、Dao类:GoodsDao.java

package dao;import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;import bean.Bean;public class GoodsDAO extends DB {private Connection conn = null;private PreparedStatement pstmt = null;private ResultSet rs = null;public int add(Bean bean){try{conn = this.getConn();String sql = "insert into goods(name,money,num,description) " +"values(?,?,?,?) ";pstmt = conn.prepareStatement(sql);pstmt.setString(1, bean.getName());pstmt.setInt(2, bean.getMoney());pstmt.setInt(3, bean.getNum());pstmt.setString(4, bean.getDescription());return pstmt.executeUpdate();} catch (Exception e){// TODO Auto-generated catch blocke.printStackTrace();return 0;}finally{this.closeAll(conn, pstmt, rs);}}public int update(Bean bean,int id){try{conn = this.getConn();String sql = "update goods set name=?,money=?,num=?,description=?  where id=?";pstmt = conn.prepareStatement(sql);pstmt.setString(1, bean.getName());pstmt.setInt(2, bean.getMoney());pstmt.setInt(3, bean.getNum());pstmt.setString(4, bean.getDescription());pstmt.setInt(5, id);return pstmt.executeUpdate();} catch (Exception e){// TODO Auto-generated catch blocke.printStackTrace();return 0;}finally{this.closeAll(conn, pstmt, rs);}}public int updatenumj(int id){try{conn = this.getConn();String sql = "update goods set num = num-1  where id=?";pstmt = conn.prepareStatement(sql);pstmt.setInt(1, id);return pstmt.executeUpdate();} catch (Exception e){// TODO Auto-generated catch blocke.printStackTrace();return 0;}finally{this.closeAll(conn, pstmt, rs);}}public int updatenuma(int id){try{conn = this.getConn();String sql = "update goods set num = num+1  where id=?";pstmt = conn.prepareStatement(sql);pstmt.setInt(1, id);return pstmt.executeUpdate();} catch (Exception e){// TODO Auto-generated catch blocke.printStackTrace();return 0;}finally{this.closeAll(conn, pstmt, rs);}}public List<Bean> list(){List<Bean> list = new ArrayList<Bean>();	Bean bean = null;							try{conn = this.getConn();					String sql = "select * from goods ";pstmt = conn.prepareStatement(sql);		rs =  pstmt.executeQuery();				while (rs.next()){bean= new Bean();					bean.setId(rs.getInt("id"));bean.setName(rs.getString("name"));bean.setMoney(rs.getInt("money"));bean.setNum(rs.getInt("num"));bean.setDescription(rs.getString("description"));list.add(bean);}return list;		} catch (Exception e){e.printStackTrace();return null;	}finally{this.closeAll(conn, pstmt, rs);	}}public List<Bean> listit0(){List<Bean> list = new ArrayList<Bean>();	Bean bean = null;							try{conn = this.getConn();					String sql = "select * from goods where num > 0";pstmt = conn.prepareStatement(sql);		rs =  pstmt.executeQuery();				while (rs.next()){bean= new Bean();					bean.setId(rs.getInt("id"));bean.setName(rs.getString("name"));bean.setMoney(rs.getInt("money"));bean.setNum(rs.getInt("num"));bean.setDescription(rs.getString("description"));list.add(bean);}return list;		} catch (Exception e){e.printStackTrace();return null;	}finally{this.closeAll(conn, pstmt, rs);	}}public Bean edit(int id){Bean bean = null;							try{conn = this.getConn();					String sql = "select * from goods where id='"+ id +"' ";pstmt = conn.prepareStatement(sql);		rs =  pstmt.executeQuery();				while (rs.next()){bean= new Bean();					bean.setId(rs.getInt("id"));bean.setName(rs.getString("name"));bean.setMoney(rs.getInt("money"));bean.setNum(rs.getInt("num"));bean.setDescription(rs.getString("description"));}return bean;		} catch (Exception e){e.printStackTrace();return null;	}finally{this.closeAll(conn, pstmt, rs);	}}public List<Bean> search(String id){List<Bean> list = new ArrayList<Bean>();	Bean bean = null;							try{conn = this.getConn();					String sql = "select * from client where id= '"+ id +"'";pstmt = conn.prepareStatement(sql);		rs =  pstmt.executeQuery();				while (rs.next()){bean= new Bean();					bean.setId(rs.getInt("id"));bean.setName(rs.getString("name"));bean.setPhone(rs.getString("phone"));bean.setMail(rs.getString("mail"));bean.setScore(rs.getString("score"));bean.setType(rs.getString("type"));bean.setState(rs.getString("state"));bean.setDecision(rs.getString("decision"));list.add(bean);}return list;		} catch (Exception e){e.printStackTrace();return null;	}finally{this.closeAll(conn, pstmt, rs);	}}public int delete(int id){int i = 0;try{conn = this.getConn();String sql = "delete from goods where id = ?";pstmt = conn.prepareStatement(sql);pstmt.setInt(1, id);i = pstmt.executeUpdate();this.closeAll(conn, pstmt, rs);} catch (Exception e){e.printStackTrace();}return i;}}

ComplainDAO.java

package dao;import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;import bean.Bean;public class ComplainDAO extends DB {private Connection conn = null;private PreparedStatement pstmt = null;private ResultSet rs = null;public int add(Bean bean){try{conn = this.getConn();String sql = "insert into complain(name,content,time,phone) " +"values(?,?,?,?) ";pstmt = conn.prepareStatement(sql);pstmt.setString(1, bean.getName());pstmt.setString(2, bean.getContent());pstmt.setString(3, bean.getTime());pstmt.setString(4, bean.getPhone());return pstmt.executeUpdate();} catch (Exception e){// TODO Auto-generated catch blocke.printStackTrace();return 0;}finally{this.closeAll(conn, pstmt, rs);}}public int update(Bean bean,int id){try{conn = this.getConn();String sql = "update goods set name=?,score=?  where id=?";pstmt = conn.prepareStatement(sql);pstmt.setString(1, bean.getName());pstmt.setString(2, bean.getScore());pstmt.setInt(3, id);return pstmt.executeUpdate();} catch (Exception e){// TODO Auto-generated catch blocke.printStackTrace();return 0;}finally{this.closeAll(conn, pstmt, rs);}}public List<Bean> list(){List<Bean> list = new ArrayList<Bean>();	Bean bean = null;							try{conn = this.getConn();					String sql = "select * from complain ";pstmt = conn.prepareStatement(sql);		rs =  pstmt.executeQuery();				while (rs.next()){bean= new Bean();					bean.setId(rs.getInt("id"));bean.setName(rs.getString("name"));bean.setContent(rs.getString("content"));bean.setTime(rs.getString("time"));bean.setPhone(rs.getString("phone"));list.add(bean);}return list;		} catch (Exception e){e.printStackTrace();return null;	}finally{this.closeAll(conn, pstmt, rs);	}}public Bean edit(int id){Bean bean = null;							try{conn = this.getConn();					String sql = "select * from goods where id='"+ id +"' ";pstmt = conn.prepareStatement(sql);		rs =  pstmt.executeQuery();				while (rs.next()){bean= new Bean();					bean.setId(rs.getInt("id"));bean.setName(rs.getString("name"));bean.setScore(rs.getString("score"));}return bean;		} catch (Exception e){e.printStackTrace();return null;	}finally{this.closeAll(conn, pstmt, rs);	}}public List<Bean> search(String id){List<Bean> list = new ArrayList<Bean>();	Bean bean = null;							try{conn = this.getConn();					String sql = "select * from client where id= '"+ id +"'";pstmt = conn.prepareStatement(sql);		rs =  pstmt.executeQuery();				while (rs.next()){bean= new Bean();					bean.setId(rs.getInt("id"));bean.setName(rs.getString("name"));bean.setPhone(rs.getString("phone"));bean.setMail(rs.getString("mail"));bean.setScore(rs.getString("score"));bean.setType(rs.getString("type"));bean.setState(rs.getString("state"));bean.setDecision(rs.getString("decision"));list.add(bean);}return list;		} catch (Exception e){e.printStackTrace();return null;	}finally{this.closeAll(conn, pstmt, rs);	}}public int delete(int id){int i = 0;try{conn = this.getConn();String sql = "delete from complain where id = ?";pstmt = conn.prepareStatement(sql);pstmt.setInt(1, id);i = pstmt.executeUpdate();this.closeAll(conn, pstmt, rs);} catch (Exception e){e.printStackTrace();}return i;}}

2、业务处理Servlet:
GoodsServlet.java

package servlet;import java.io.IOException;
import java.io.PrintWriter;import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;import bean.Bean;
import dao.ClientDAO;
import dao.GoodsDAO;public class GoodsServlet extends HttpServlet {private static final long serialVersionUID = 1L;public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {doPost(request, response);}public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {response.setContentType("text/html; charset=UTF-8");request.setCharacterEncoding("utf-8");HttpSession session = request.getSession();PrintWriter out = response.getWriter();Bean bean = new Bean();GoodsDAO dao = new GoodsDAO();int kind = Integer.parseInt(request.getParameter("kind"));if (kind == 1) {String name = request.getParameter("name");int money = Integer.parseInt(request.getParameter("money"));int num = Integer.parseInt(request.getParameter("num"));String description = request.getParameter("description");bean.setName(name);bean.setMoney(money);bean.setNum(num);bean.setDescription(description);int i = dao.add(bean);if (i > 0) {out.print("<script>alert('操作成功!');location.href='admin/goods_add.jsp';</script>");} else {out.print("<script>alert('操作失败!');history.go(-1);</script>");}} else if (kind == 2) {int id = Integer.parseInt(request.getParameter("id"));String name = request.getParameter("name");int money = Integer.parseInt(request.getParameter("money"));int num = Integer.parseInt(request.getParameter("num"));String description = request.getParameter("description");bean.setName(name);bean.setMoney(money);bean.setNum(num);bean.setDescription(description);int i = dao.update(bean, id);if (i > 0) {out.print("<script>alert('操作成功!');location.href='admin/goods_edit.jsp?id="+ id + "';</script>");} else {out.print("<script>alert('操作失败!');history.go(-1);</script>");}} else if (kind == 3) {int id = Integer.parseInt(request.getParameter("id"));int i = dao.delete(id);if (i > 0) {out.print("<script>alert('操作成功!');location.href='admin/goods_list.jsp';</script>");} else {out.print("<script>alert('操作失败!');history.go(-1);</script>");}}}}

ComplainServlet.java

package servlet;import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;import bean.Bean;
import dao.ComplainDAO;
import dao.GoodsDAO;public class ComplainServlet extends HttpServlet {private static final long serialVersionUID = 1L;public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {doPost(request, response);}public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {response.setContentType("text/html; charset=UTF-8");request.setCharacterEncoding("utf-8");HttpSession session = request.getSession();PrintWriter out = response.getWriter();Bean bean = new Bean();ComplainDAO dao = new ComplainDAO();int kind = Integer.parseInt(request.getParameter("kind"));if (kind == 1) {String name = request.getParameter("name");String phone = request.getParameter("phone");String content = request.getParameter("content");SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String time = sd.format(new Date());bean.setName(name);bean.setPhone(phone);bean.setContent(content);bean.setTime(time);int i = dao.add(bean);if (i > 0) {out.print("<script>alert('操作成功!');location.href='admin/complain_add.jsp';</script>");} else {out.print("<script>alert('操作失败!');history.go(-1);</script>");}} else if (kind == 2) {int id = Integer.parseInt(request.getParameter("id"));String name = request.getParameter("name");String score = request.getParameter("score");bean.setName(name);bean.setScore(score);int i = dao.update(bean, id);if (i > 0) {out.print("<script>alert('操作成功!');location.href='admin/goods_edit.jsp?id="+ id + "';</script>");} else {out.print("<script>alert('操作失败!');history.go(-1);</script>");}} else if (kind == 3) {int id = Integer.parseInt(request.getParameter("id"));int i = dao.delete(id);if (i > 0) {out.print("<script>alert('操作成功!');location.href='admin/complain_list.jsp';</script>");} else {out.print("<script>alert('操作失败!');history.go(-1);</script>");}}}}

写在最后

需要全部源码和详细文档,可以加博主V交流(Code2Life2)

这篇关于Java Jsp MVC+mysql实现的物资租赁管理系统(管理员管理 客户管理 建材管理 租赁管理 财务管理)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/383792

相关文章

windos server2022里的DFS配置的实现

《windosserver2022里的DFS配置的实现》DFS是WindowsServer操作系统提供的一种功能,用于在多台服务器上集中管理共享文件夹和文件的分布式存储解决方案,本文就来介绍一下wi... 目录什么是DFS?优势:应用场景:DFS配置步骤什么是DFS?DFS指的是分布式文件系统(Distr

NFS实现多服务器文件的共享的方法步骤

《NFS实现多服务器文件的共享的方法步骤》NFS允许网络中的计算机之间共享资源,客户端可以透明地读写远端NFS服务器上的文件,本文就来介绍一下NFS实现多服务器文件的共享的方法步骤,感兴趣的可以了解一... 目录一、简介二、部署1、准备1、服务端和客户端:安装nfs-utils2、服务端:创建共享目录3、服

SpringBoot使用Apache Tika检测敏感信息

《SpringBoot使用ApacheTika检测敏感信息》ApacheTika是一个功能强大的内容分析工具,它能够从多种文件格式中提取文本、元数据以及其他结构化信息,下面我们来看看如何使用Ap... 目录Tika 主要特性1. 多格式支持2. 自动文件类型检测3. 文本和元数据提取4. 支持 OCR(光学

Java内存泄漏问题的排查、优化与最佳实践

《Java内存泄漏问题的排查、优化与最佳实践》在Java开发中,内存泄漏是一个常见且令人头疼的问题,内存泄漏指的是程序在运行过程中,已经不再使用的对象没有被及时释放,从而导致内存占用不断增加,最终... 目录引言1. 什么是内存泄漏?常见的内存泄漏情况2. 如何排查 Java 中的内存泄漏?2.1 使用 J

JAVA系统中Spring Boot应用程序的配置文件application.yml使用详解

《JAVA系统中SpringBoot应用程序的配置文件application.yml使用详解》:本文主要介绍JAVA系统中SpringBoot应用程序的配置文件application.yml的... 目录文件路径文件内容解释1. Server 配置2. Spring 配置3. Logging 配置4. Ma

MySQL中时区参数time_zone解读

《MySQL中时区参数time_zone解读》MySQL时区参数time_zone用于控制系统函数和字段的DEFAULTCURRENT_TIMESTAMP属性,修改时区可能会影响timestamp类型... 目录前言1.时区参数影响2.如何设置3.字段类型选择总结前言mysql 时区参数 time_zon

Python MySQL如何通过Binlog获取变更记录恢复数据

《PythonMySQL如何通过Binlog获取变更记录恢复数据》本文介绍了如何使用Python和pymysqlreplication库通过MySQL的二进制日志(Binlog)获取数据库的变更记录... 目录python mysql通过Binlog获取变更记录恢复数据1.安装pymysqlreplicat

Java 字符数组转字符串的常用方法

《Java字符数组转字符串的常用方法》文章总结了在Java中将字符数组转换为字符串的几种常用方法,包括使用String构造函数、String.valueOf()方法、StringBuilder以及A... 目录1. 使用String构造函数1.1 基本转换方法1.2 注意事项2. 使用String.valu

C#使用yield关键字实现提升迭代性能与效率

《C#使用yield关键字实现提升迭代性能与效率》yield关键字在C#中简化了数据迭代的方式,实现了按需生成数据,自动维护迭代状态,本文主要来聊聊如何使用yield关键字实现提升迭代性能与效率,感兴... 目录前言传统迭代和yield迭代方式对比yield延迟加载按需获取数据yield break显式示迭

Python实现高效地读写大型文件

《Python实现高效地读写大型文件》Python如何读写的是大型文件,有没有什么方法来提高效率呢,这篇文章就来和大家聊聊如何在Python中高效地读写大型文件,需要的可以了解下... 目录一、逐行读取大型文件二、分块读取大型文件三、使用 mmap 模块进行内存映射文件操作(适用于大文件)四、使用 pand