JavaEE练习项目–快递e栈(第一天)
内容地址
需求分析链接地址建表,工具类书写链接地址Jdbc工具类链接地址三层架构,阿里云短信链接地址前端Ajax链接地址
1、背景介绍
随着互联网和通信技术的高速发展,使电子商务迅速普及,网购成为人们购物的重要手段之一。据统计2019年双十一,11月11日~16日,受电商平台集中促销影响,业务量达全年高峰,6天内共处理邮(快)件23.09亿件。
疫情期间配送快递成了一件难事。疫情防控已经趋于常态化,很多小区出台了新的治安管理条例,开始禁止快递人员进入。这给民众收发快件造成了极大的不便,因进不去小区,快递人员只能在小区门口周边摆摊设点,也影响了小区周边环境。
除了快递,外卖也一样面临相同的问题。除了小区,写字楼、校园也面临着相同的问题。正是基于对疫情期间配送最后一公里深刻的认识,我们探索出一条解决之道,那就是社区快递e栈(类似快递柜)。
2、项目目的
1、锻炼动手能力
2、融会贯通JavaWeb技术
3、体验项目开发流程
4、做出上线级别的微信端+JavaWeb后端项目
5、为框架阶段打下前后端交互的基础
3、项目涉及技术点
html、css、js、Jquery、bootstrap、layui、layer、ajax、mysql、tomcat、servlet、filter、listener、jsp、公有云服务器。
4、需求分析
该快递项目按照用户分为三层,管理员,普通用户和快递员,管理员可以对用户和快递员的数据进行增删改查操作,以及对快递的增删改查。管理员可以对快递进行增删改查,用户可以取件,也可以查看自己的快递情况。
按照功能模块分为登录模块,用户模块,快递员模块,快递模块,控制台模块,其中部分功能,比如扫码取件是微信端的功能,本系统主要是面向管理员端的后台关联系统
5、数据库设计
管理员表
字段名描述字段类型
id自增主键intusername用户名varcharpassword密码varcharlogin_time登录时间timestamplogin_ip登录的ip地址varchar
用户表
字段名描述字段类型
id自增主键intusername用户名varcharuser_phone手机号varcharid_card_number身份证号varcharpassword用户密码varcharregister_time注册时间timestamplogin_time上次登录时间timestamp
快递员表
字段名描述字段类型
id自增主键intname姓名varcharsys_phone电话号码varcharid_card_number身份证号varcharpassword密码varcharregister_time注册时间timestamplogin_time上次登录时间timestamp
快递表
字段名描述字段类型
id自增书剑intnumber快递单号varcharusername用户名varcharuser_phone手机号varcharcompany快递公司varcharcode取件码varcharin_time录入时间timestampout_time取件时间timestampstatus状态intsys_phone录入人手机号varchar
6、接口设计
登录模块
1.登录
请求地址:
express
/login
.do
请求参数
:
username
:用户名
password
:密码
返回格式示例:
{
"status":0,
"result":"登录成功"
}
2.登出
请求地址:
express
/logout
.do
返回格式示例:
{
"status":0,
"result":"登出成功"
}
快递模块
1.控制台
请求地址:
express
/console
.do
返回格式示例:
{
"status": 0,
"data": [{
"needTakeExpress": 1837,
"totalExpress": 1837,
"insertExpress": 0,
"dayExpress": 0
}]
}
2.快件列表
请求地址:
express
/list
.do
请求参数
:
pageNumber
:每页数据量
offset
:起始页数
返回格式示例:
{
"rows": [{
"id": 2,
"number": "1770471",
"username": "橘右京",
"userPhone": "13804915881",
"company": "中国邮政",
"code": "887475",
"inTime": "2020-10-02 14:26:49",
"outTime": "未出库",
"status": "待取件",
"sysPhone": "15858298809"
}, {
"id": 3,
"number": "1770472",
"username": "项羽",
"userPhone": "13804915882",
"company": "中国邮政",
"code": "900417",
"inTime": "2020-10-02 14:26:50",
"outTime": "未出库",
"status": "待取件",
"sysPhone": "15858298809"
}, {
"id": 4,
"number": "1770473",
"username": "白起",
"userPhone": "13804915883",
"company": "中国邮政",
"code": "136083",
"inTime": "2020-10-02 14:26:50",
"outTime": "未出库",
"status": "待取件",
"sysPhone": "15858298809"
}, {
"id": 5,
"number": "1770474",
"username": "赵云",
"userPhone": "13804915884",
"company": "中国邮政",
"code": "353803",
"inTime": "2020-10-02 14:26:50",
"outTime": "未出库",
"status": "待取件",
"sysPhone": "15858298809"
}, {
"id": 6,
"number": "1770475",
"username": "李白",
"userPhone": "13804915885",
"company": "中国邮政",
"code": "794394",
"inTime": "2020-10-02 14:26:50",
"outTime": "未出库",
"status": "待取件",
"sysPhone": "15858298809"
}],
"total": 1837
}
3.快件录入
请求地址:
express
/insert
.do
参数列表:
number:快递单号
company:快递公司
username:收件人姓名
phone_number
:收件人手机号码(发送短信给新的手机,并且重新生成收件码,并发送短信)
返回格式示例:
成功:
{
"status": 0,
"result": "录入成功"
}
失败:
{
"status": 0,
"result": "录入失败"
}
4.快件修改
请求地址:
express
/update
.do
参数列表:
id:要修改的快递id
number:新的快递单号
company:新的快递公司
username:新的收件人姓名
phone_number
:新的收件人手机号码
status
:快递的状态
返回格式示例:
成功:
{
"status": 0,
"result": "修改成功"
}
失败:
{
"status": 0,
"result": "修改失败"
}
5.快件删除
请求地址:
express
/delete
.do
参数列表:
id:要删除的快递id
返回格式示例:
成功:
{
"status": 0,
"result": "删除成功"
}
失败:
{
"status": 0,
"result": "删除失败"
}
6.根据单号查询快递
请求地址:
express
/find
.do
参数列表:
id:要查询的快递id
返回格式示例:
成功:
{
"status": 0,
"result": "查询成功",
"data": {
"id": 1,
"number": "1770470",
"username": "铠",
"userPhone": "13804915880",
"company": "中国邮政",
"code": "619702",
"inTime": "Oct 2, 2020 2:26:49 PM",
"status": 0,
"sysPhone": "15858298809"
}
}
失败:
{
"status": -1,
"result": "单号不存在"
}
7.根据取件码查询快递
请求地址:
express
/findByCode
.do
参数列表:
code:要查询的快递的取件码
返回格式示例:
{
"status": 0,
"result": "查询成功",
"data": {
"id": 1,
"number": "1770470",
"username": "铠",
"userPhone": "13804915880",
"company": "中国邮政",
"code": "619702",
"inTime": "Oct 2, 2020 2:26:49 PM",
"status": 0,
"sysPhone": "15858298809"
}
}
失败:
{
"status": -1,
"result": "单号不存在"
}
8.根据录入人手机号码查询快递
请求地址:
express
/findBySysPhone
.do
参数列表:
sysPhone:要查询的快递sysPhone
返回格式示例:
成功:
{
"status": 0,
"result": "查询成功",
"data": [{
"id": 10,
"number": "1770479",
"username": "墨子",
"userPhone": "13804915889",
"company": "中国邮政",
"code": "573202",
"inTime": "Oct 2, 2020 2:26:50 PM",
"status": 0,
"sysPhone": "15858298809"
},
{
"status": 0,
"result": "查询成功",
"data": {
"id": 78,
"number": "4814769",
"username": "墨子",
"userPhone": "13804915889",
"company": "中国邮政",
"code": "120264",
"inTime": "Oct 2, 2020 2:27:51 PM",
"status": 0,
"sysPhone": "15858298809"
}
}
]
}
失败:
{
"status": -1,
"result": "单号不存在"
}
9.根据单确认取件
请求地址:
express
/updateStatus
.do
参数列表:
code:需要更改为已取件的取件码
返回格式示例:
成功
{
"status": 0,
"result": "取件成功"
}
失败
{
"status": -1,
"result": "取件失败"
}
用户模块
1.控制台
请求地址:
user
/console
.do
返回格式示例:
{
"status": 0,
"data": [{
"dayUser": 0,
"totalUser": 68
}]
}
1.用户列表
请求地址:
user
/list
.do
请求参数:
pageNumber
:每页数据量
offset
:起始页数
返回格式示例:
{
"rows": [{
"id": 1,
"username": "铠",
"userPhone": "13804915880",
"idCardNumber": "530102199003071790",
"password": "123456",
"expressNumber": 27,
"registerTime": "2020-10-02 14:29:19",
"loginTime": ""
}, {
"id": 2,
"username": "橘右京",
"userPhone": "13804915881",
"idCardNumber": "530102199003071791",
"password": "123456",
"expressNumber": 27,
"registerTime": "2020-10-02 14:29:19",
"loginTime": ""
}, {
"id": 3,
"username": "项羽",
"userPhone": "13804915882",
"idCardNumber": "530102199003071792",
"password": "123456",
"expressNumber": 27,
"registerTime": "2020-10-02 14:29:19",
"loginTime": ""
}, {
"id": 4,
"username": "白起",
"userPhone": "13804915883",
"idCardNumber": "530102199003071793",
"password": "123456",
"expressNumber": 27,
"registerTime": "2020-10-02 14:29:20",
"loginTime": ""
}, {
"id": 5,
"username": "赵云",
"userPhone": "13804915884",
"idCardNumber": "530102199003071794",
"password": "123456",
"expressNumber": 27,
"registerTime": "2020-10-02 14:29:20",
"loginTime": ""
}, {
"id": 6,
"username": "李白",
"userPhone": "13804915885",
"idCardNumber": "530102199003071795",
"password": "123456",
"expressNumber": 27,
"registerTime": "2020-10-02 14:29:20",
"loginTime": ""
}, {
"id": 7,
"username": "韩信",
"userPhone": "13804915886",
"idCardNumber": "530102199003071796",
"password": "123456",
"expressNumber": 27,
"registerTime": "2020-10-02 14:29:20",
"loginTime": ""
}, {
"id": 8,
"username": "刘备",
"userPhone": "13804915887",
"idCardNumber": "530102199003071797",
"password": "123456",
"expressNumber": 27,
"registerTime": "2020-10-02 14:29:20",
"loginTime": ""
}, {
"id": 9,
"username": "鲁班七号",
"userPhone": "13804915888",
"idCardNumber": "530102199003071798",
"password": "123456",
"expressNumber": 27,
"registerTime": "2020-10-02 14:29:20",
"loginTime": ""
}, {
"id": 10,
"username": "墨子",
"userPhone": "13804915889",
"idCardNumber": "530102199003071799",
"password": "123456",
"expressNumber": 27,
"registerTime": "2020-10-02 14:29:20",
"loginTime": ""
}],
"total": 68
}
2.用户录入
请求地址:
user
/insert
.do
参数列表:
username:用户名
idCardNumber:身份证
password:密码
userPhone
:手机号
返回格式示例:
成功
{
"status": 0,
"result": "录入成功"
}
失败
{
"status": -1,
"result": "录入失败"
}
3.用户修改
请求地址:
user
/update
.do
参数列表:
username:用户名
idCardNumber:身份证
password:密码
userPhone
:手机号
返回格式示例:
成功
{
"status": 0,
"result": "更新成功"
}
失败
{
"status": -1,
"result": "更新失败"
}
4.用户删除
请求地址:
user
/delete
.do
参数列表:
id:要删除的快递id
返回格式示例:
成功
{
"status": 0,
"result": "删除成功"
}
失败
{
"status": -1,
"result": "删除失败"
}
5.根据手机号查询用户
请求地址:
user
/find
.do
参数列表:
userPhone:要查询的快递usePhone
返回格式示例:
成功
{
"status": 0,
"result": "查询成功",
"data": {
"id": 66,
"username": "钟无艳",
"userPhone": "13804915865",
"idCardNumber": "530102199003071765",
"password": "123456",
"registerTime": "Oct 2, 2020 2:29:21 PM"
}
}
失败
{
"status": -1,
"result": "删除失败"
}
快递员模块
1.快递员列表
请求地址:
courier
/list
.do
返回格式示例:
{
"rows": [{
"id": 1,
"name": "钟馗",
"sysPhone": "15727851996",
"idCardNumber": "460105199003073410",
"password": "123456",
"sendNumber": 342,
"registerTime": "2020-10-02 02:10:38",
"loginTime": "2020-10-02 15:58:44"
}, {
"id": 2,
"name": "狄仁杰",
"sysPhone": "13017876008",
"idCardNumber": "310101199003077851",
"password": "123456",
"sendNumber": 679,
"registerTime": "2020-10-02 02:12:00",
"loginTime": ""
}, {
"id": 3,
"name": "李元芳",
"sysPhone": "15858298809",
"idCardNumber": "31010119900307225X",
"password": "123456",
"sendNumber": 816,
"registerTime": "2020-10-02 02:12:54",
"loginTime": "2020-10-03 13:29:13"
}],
"total": 3
}
2.快递员录入
请求地址:
courier
/insert
.do
参数列表:
username:用户名
idCardNumber:身份证
password:密码
userPhone
:手机号
返回格式示例:
成功:
{
"status": 0,
"result": "录入成功"
}
失败:
{
"status": 0,
"result": "录入失败"
}
3.用户修改
请求地址:
courier
/update
.do
参数列表:
username:用户名
idCardNumber:身份证
password:密码
userPhone
:手机号
返回格式示例:
成功:
{
"status": 0,
"result": "修改成功"
}
失败:
{
"status": 0,
"result": "修改失败"
}
4.用户删除
请求地址:
courier/delete.do
参数列表:
id:要删除的快递id
返回格式示例:
成功:
{
"status": 0,
"result": "删除成功"
}
失败:
{
"status": 0,
"result": "删除失败"
}
5.根据手机号查询快递员
请求地址
:
courier
/find
.do
参数列表:
sysPhone
:快递员手机号
返回格式示例
:
成功:
{
"status": 0,
"result": "查询成功",
"data": {
"id": 3,
"name": "李元芳",
"sysPhone": "15858298809",
"idCardNumber": "31010119900307225X",
"password": "123456",
"registerTime": "Oct 2, 2020 2:12:54 AM",
"loginTime": "Oct 3, 2020 1:29:13 PM"
}
}
失败:
{
"status": -1,
"result": "快递员信息不存在"
}
7、源码开发
放在下一篇