[原创]Java Web——外卖配送系统/在线点餐系统
项目类型:JAVA WEB项目用户类型:管理员+顾客+配送员+商家主要技术:Jsp+Servlet+MySQL+Tomcat前端html+css样式:使用了LayUI开发工具:Eclipse (Idea导入需要配置信息)对应环境介绍:JDK+MySQL+Tomcat数据库表:6张功能介绍:1.配送系统:根据要求注册登录,注册后可接单配送。2.管理员系统:对配送信息,订单信息,顾客,配送员,商家进行
项目类型:JAVA WEB项目
用户类型:管理员+顾客+配送员+商家
主要技术:Jsp+Servlet+MySQL+Tomcat
前端html+css样式:使用了LayUI
开发工具:Eclipse (Idea导入需要配置信息)
对应环境介绍:JDK+MySQL+Tomcat
数据库表:6张
功能介绍:
1.配送系统:根据要求注册登录,注册后可接单配送。
2.管理员系统:对配送信息,订单信息,顾客,配送员,商家进行增删改查。
3.商家系统:可以发布店内的商品。
4.顾客系统:在线点餐。
系统实际使用流程:
顾客点单——>>商家接单——>>——>>配送员接单配送——>>顾客收货确认
项目非开源(原创开发项目)
项目来源:“那条学长”(V)(公)
点击顶部,点击分类专栏查看获取方式
其他分类专栏也有不同类型的JavaWeb项目
视频演示如下:
外卖配送系统/在线点餐系统
外卖配送管理系统/在线点餐系统
0项目结构设计
1.dao:对数据库的访问,实现了增删改查,SQL语句的定义。
2.entity:定义了实体,并设置对应实体的属性。
3.filter:过滤器,设置字符编码都为utf8,防止乱码出现。
4.service:业务逻辑处理的接口。
5.service.impl:接口的实现类。
5.servlet:处理页面请求。
6.utils:工具类。
7.c3p0-config.xml:JDBC配置。
1顾客端功能介绍
1.1登录
一共有4类角色进行使用
1.2在线外卖点餐
以外卖的方式进行点餐购买
1.3个人订单
购买以后,在我的订单可以查看。购买以后,需要等待商家接单。
并且由配送员配送以后,确认收货。
2商家端功能介绍
2.1上线外卖商品
2.2商家接单
在顾客下单以后,需要及时接单。
3配送员端功能介绍
3.1在线接单
我的订单
3.2我的订单
4管理员端功能介绍
4.1商家管理
4.2顾客管理
4.3配送员管理
4.4外卖商品管理
4.5订单管理
5功能实现代码讲解
以添加一条配送员为例子,讲解jsp+servlet的整个过程。
5.1JSP页面
jsp页面内,以form表单的形式,action指向的地址为PsrServlet内的addPsr_admin。并且在表单内,用户输入相应的数据信息。
<form action="PsrServlet?action=addPsr_admin" method="post" id="registerForm" name="registerForm" >
<div class="layui-form-item">
<label class="layui-form-label">姓名:</label>
<div class="layui-input-inline">
<input name="psy" id="psy" class="layui-input" />
<span id="msg3" style="color:red">${message}</span>
</div>
</div>
<div class="layui-form-item" >
<label class="layui-form-label">手机号:</label>
<div class="layui-input-inline">
<input name="phone" id="phone" class="layui-input" />
</div>
</div>
<div class="layui-form-item" >
<label class="layui-form-label">登录密码:</label>
<div class="layui-input-inline">
<input name="pwd" id="pwd" class="layui-input" />
</div>
</div>
<div class="layui-form-item" >
<label class="layui-form-label">配送人住址:</label>
<div class="layui-input-inline">
<input name="psrxy" id="psrxy" class="layui-input" />
</div>
</div>
<br>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" type="submit" id="sub_btn">提交</button>
<a href="PsrServlet?action=psrList" class="layui-btn layui-btn-primary" >返回</a>
</div>
</div>
</form>
5.2Servlet.java
在PsrServlet内定义addPsr_admin方法
if(action != null && action.equals("addPsr_admin")){
addPsr_admin(request, response);
定义addPsr_admin方法,先接受用户输入的数据,再调用set方法。并调用service方法,执行。在执行之前进行判断,如果改用户已存在,则提示信息,否则执行方法。
private void addPsr_admin(HttpServletRequest request, HttpServletResponse response) {
String psy = request.getParameter("psy");
String phone = request.getParameter("phone");
String pwd = request.getParameter("pwd");
String psrxy= request.getParameter("psrxy");
Psr psr =new Psr();
psr.setPsy(psy);
psr.setPhone(phone);
psr.setPwd(pwd);
psr.setPsrxy(psrxy);
psr.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()));
try {
Psr p1 = ps.selectPsr(psr);
if(p1 == null){
ps.savePsr(psr);
response.sendRedirect(request.getContextPath()+"/PsrServlet?action=psrList");
}else{
request.setAttribute("message", "该学生已是配送员,不能重复注册!");
request.getRequestDispatcher("/WEB-INF/views/register.jsp").forward(request,response);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
5.3Service.java
定义service业务逻辑接口
public interface PsrService {
void savePsr(Psr psr);
}
5.4Serviceimpl.java
继承接口,实现方法。也就是调用dao层的数据增删改查的方法。
@Override
public void savePsr(Psr psr) {
pd.savePsr(psr);
}
5.5dao.java
dao层内,也就是数据访问层,定义SQL语句,执行插入语句。
public void savePsr(Psr psr) {
try {
runner.update("insert into psr (psy,phone,pwd,psrxy,time) values (?,?,?,?,?)",
psr.getPsy(),psr.getPhone(),psr.getPwd(),psr.getPsrxy(),psr.getTime());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
6MySQL数据库表的创建
/*
Navicat Premium Data Transfer
Source Server : 本地
Source Server Type : MySQL
Source Server Version : 50715
Source Host : localhost:3306
Source Schema : db_takeaway
Target Server Type : MySQL
Target Server Version : 50715
File Encoding : 65001
Date: 16/04/2021 15:15:09
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for admin
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`userName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`nickName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`pwd` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of admin
-- ----------------------------
INSERT INTO `admin` VALUES (1, 'admin', '管理员', '123456');
-- ----------------------------
-- Table structure for business
-- ----------------------------
DROP TABLE IF EXISTS `business`;
CREATE TABLE `business` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`business_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`business_person` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`business_no` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`business_pwd` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of business
-- ----------------------------
INSERT INTO `business` VALUES (2, '喔喔奶茶店', '张老板', '2021-04-15 10:28', '15365656363', '123456');
INSERT INTO `business` VALUES (3, '每日杯奶茶店', '徐老板1', '2021-04-15 10:29', '16545456969', '123456');
-- ----------------------------
-- Table structure for customer
-- ----------------------------
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`customer_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`customer_no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`customer_pwd` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of customer
-- ----------------------------
INSERT INTO `customer` VALUES (1, '小明', '88888888', '123456', '2021-04-15 15:13');
INSERT INTO `customer` VALUES (2, '小红', '66666666', '123456', '2021-04-15 15:21');
-- ----------------------------
-- Table structure for psr
-- ----------------------------
DROP TABLE IF EXISTS `psr`;
CREATE TABLE `psr` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`psy` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '配送人',
`pwd` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码',
`psrxy` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '配送人学院',
`phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号',
`time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`studentId` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of psr
-- ----------------------------
INSERT INTO `psr` VALUES (2, '王五', '123456', '管理学院', '14523875432', '2021-04-15 16:04', 1);
INSERT INTO `psr` VALUES (3, '李四', '123456', '管理学院', '12345674567', '2021-04-15 16:10', 67);
-- ----------------------------
-- Table structure for record
-- ----------------------------
DROP TABLE IF EXISTS `record`;
CREATE TABLE `record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tea_id` int(11) NULL DEFAULT NULL,
`tea_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`tea_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '订单编号',
`userName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`userId` int(11) NULL DEFAULT NULL,
`time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`state` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '1默认已购买 2商家已接单 3配送员已接单 4已收货',
`psrId` int(11) NULL DEFAULT NULL,
`psrName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of record
-- ----------------------------
INSERT INTO `record` VALUES (3, 3, '波霸奶茶', '小杯', '6c9e9e19-2684-4db9-a665-c0468fd44ab4', '小明', 1, '2021-04-16 11:30', '4', 2, '王五');
INSERT INTO `record` VALUES (4, 3, '波霸奶茶', '小杯', 'f9d699da-61a4-4460-b781-c5ac67040401', '小红', 2, '2021-04-16 14:59', '4', 3, '李四');
-- ----------------------------
-- Table structure for student
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`student_id` int(11) NOT NULL AUTO_INCREMENT,
`student_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`student_college` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`student_major` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`student_class` int(11) NOT NULL,
`student_telephone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`student_id`) USING BTREE,
INDEX `student_name`(`student_name`) USING BTREE,
INDEX `student_major`(`student_major`) USING BTREE,
INDEX `student_telephone`(`student_telephone`) USING BTREE,
INDEX `student_college`(`student_college`) USING BTREE,
INDEX `student_class`(`student_class`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 68 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of student
-- ----------------------------
INSERT INTO `student` VALUES (1, '王五', '管理学院', '信息管理与信息系统', 2, '14523875432');
INSERT INTO `student` VALUES (3, '孙策', '药学院', '中药学', 5, '16754327864');
INSERT INTO `student` VALUES (23, '刘老根', '管理学院', '公共事业管理', 1, '15678342367');
INSERT INTO `student` VALUES (34, '赵六', '管理学院', '法学', 2, '14567832456');
INSERT INTO `student` VALUES (35, '周瑜', '中医学院', '中医学', 3, '17865244567');
INSERT INTO `student` VALUES (67, '李四', '管理学院', '市场营销', 1, '12345674567');
-- ----------------------------
-- Table structure for tea
-- ----------------------------
DROP TABLE IF EXISTS `tea`;
CREATE TABLE `tea` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`business_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商家名称',
`business_cp` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商家产品',
`business_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品类型',
`business_id` int(11) NULL DEFAULT NULL,
`time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tea
-- ----------------------------
INSERT INTO `tea` VALUES (1, '喔喔奶茶店', '芋圆波波奶茶', '中杯', 2, '2021-04-15 17:23');
INSERT INTO `tea` VALUES (2, '喔喔奶茶店', '珍珠奶茶', '大杯', 2, '2021-04-15 17:25');
INSERT INTO `tea` VALUES (3, '喔喔奶茶店', '波霸奶茶', '小杯', 2, '2021-04-15 17:25');
INSERT INTO `tea` VALUES (4, '每日杯奶茶店', '奶茶双享杯', '中杯', 3, '2021-04-15 17:26');
SET FOREIGN_KEY_CHECKS = 1;
更多推荐
所有评论(0)