基于javaweb+mysql的ssm物流快递管理系统(java+ssm+js+jsp+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM物流快递管理系统(java+ssm+js+jsp+mysql)
项目介绍
仓库管理员角色包含以下功能: 仓库管理员操作,入库操作,员工查看,揽收快件,新建员工等功能。
快递员角色包含以下功能: 员工操作,员工登录,操作成功等功能。
用户角色包含以下功能: 发快递成功,发送快递,查看快递等功能。
管理员角色包含以下功能: 管理员查看全局快递信息等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
if(expid==''){
$("#msg").html("物流单号不能为空");
return;
}
$("#form0").submit();
}
</script>
</body>
</html>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dzx.express.mapper.ExpressMapper" >
<resultMap id="BaseResultMap" type="com.dzx.express.entity.Express" >
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="fromlocation" property="fromlocation" jdbcType="VARCHAR" />
<result column="tolocation" property="tolocation" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="posttime" property="posttime" jdbcType="TIMESTAMP" />
<result column="type" property="type" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, fromlocation, tolocation, phone, posttime, type
</sql>
<select id="selectall" resultMap="BaseResultMap" parameterType="java.lang.String">
select * from express where fromlocation like concat(#{0},'%') or tolocation like concat(#{0},'%')
</select>
<select id="selectbyphone" resultMap="BaseResultMap" parameterType="java.lang.String" >
select * from express
where phone = #{phone}
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from express
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from express
where id = #{id,jdbcType=VARCHAR}
}
expressBiz.updateByPrimaryKeySelective(express);
logBiz.insert(log);
return "orderin";
}
@RequestMapping(value="orderout")
public String orderout(String expid,HttpSession session) {
Express express = expressBiz.selectByPrimaryKey(expid);
if(express==null) {
session.setAttribute("msg", "没有此快递单号的记录,请核对后再次操作!");
return "orderin";
}
User user = (User) session.getAttribute("loginUser");
Log log = new Log();
log.setExpressid(expid);
log.setTime(new Date());
if(express.getType().equals("等待揽收")&&user.getType().equals("快递员")) {
session.setAttribute("msg", "操作有误请确认快递单号!");
}else if(user.getType()!=null&&user.getType().equals("员工")){
log.setContext("派件中,快递员:"+user.getName()+",电话:"+user.getPhone()+",请确保电话畅通!");
express.setType("派件中,快递员:"+user.getName()+"电话:"+user.getPhone());
session.setAttribute("msg", "操作成功!单号"+expid+"已经准备派件");
}else {
log.setContext(user.getType()+"已出库,发往下一目的地");
express.setType("正在运输,之前位置:"+user.getType());
session.setAttribute("msg", "操作成功!单号"+expid+"已经出库");
}
expressBiz.updateByPrimaryKeySelective(express);
logBiz.insert(log);
return "orderin";
}
@RequestMapping(value="order")
public void order(String expid,String staffid,HttpServletResponse res) throws IOException {
res.setCharacterEncoding("utf-8");
PrintWriter pw = res.getWriter();
User user = userBiz.selectByPrimaryKey(staffid);
public void setTolocation(String tolocation) {
this.tolocation = tolocation == null ? null : tolocation.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public Date getPosttime() {
return posttime;
}
public void setPosttime(Date posttime) {
this.posttime = posttime;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
}
public class User {
private String id;
private String password;
private String type;
private String phone;
private String name;
private String pt;
public String getId() {
@RequestMapping(value="showstaff")
public String showstaff(HttpSession session) {
User user = (User) session.getAttribute("loginUser");
List<User> staffList = userBiz.selectbypt(user.getType());
session.setAttribute("staffList", staffList);
return "staff";
}
@RequestMapping(value="allorder")
public String allorder(HttpSession session) {
User user = (User) session.getAttribute("loginUser");
String location = user.getType().substring(0, user.getType().length()-1);
List<Express> orderList = expressBiz.selectall(location);
session.setAttribute("orderList", orderList);
return "allorder";
}
}
@Service(value="ExpressBiz")
public class ExpressBizImpl implements ExpressBiz{
@Autowired
ExpressMapper expressMapper;
@Override
public int deleteByPrimaryKey(String id) {
// TODO Auto-generated method stub
return expressMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(Express record) {
// TODO Auto-generated method stub
return expressMapper.insert(record);
}
@Override
public int insertSelective(Express record) {
<sql id="Base_Column_List" >
logid, expressid, context, time, type
</sql>
<select id="selectlog" resultMap="BaseResultMap" parameterType="String">
select * from log
where expressid = #{expressid} order by time desc
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from log
where logid = #{logid,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from log
where logid = #{logid,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.dzx.express.entity.Log" >
insert into log (logid, expressid, context,
time, type)
values (#{logid,jdbcType=INTEGER}, #{expressid,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR},
#{time,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.dzx.express.entity.Log" >
insert into log
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="logid != null" >
logid,
</if>
<if test="expressid != null" >
expressid,
</if>
<if test="context != null" >
context,
</if>
<if test="time != null" >
time,
</if>
<if test="type != null" >
type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="logid != null" >
#{logid,jdbcType=INTEGER},
</if>
<if test="expressid != null" >
#{expressid,jdbcType=VARCHAR},
</if>
<if test="context != null" >
return "success";
}
@RequestMapping(value="showexp")
public String showexp(String expid,HttpSession session) {
Express express = expressBiz.selectByPrimaryKey(expid);
if(express==null) {
List<Express> expressList = expressBiz.selectbyphone(expid);
if(expressList.size()==0) {
session.setAttribute("msg", "没有此快递单号或手机号的记录,请核对后再次查询!");
return "index";
}
session.setAttribute("expressList", expressList);
return "success";
}
List<Log> logList = logBiz.selectlog(expid);
session.setAttribute("express", express);
session.setAttribute("logList", logList);
return "orderinfo";
}
@RequestMapping(value="staff")
public String staff() {
return "login";
}
@RequestMapping(value="login")
public String login(String username,String password,HttpSession session) {
User user = userBiz.selectByPrimaryKey(username);
if(!user.getPassword().equals(password)) {
session.setAttribute("error", "工号或密码错误!");
return "login";
}
session.setAttribute("loginUser", user);
session.removeAttribute("msg");
String lastname = user.getType().substring(user.getType().length()-1, user.getType().length());
if(lastname.equals("仓")) {
return "cangadmin";
}
if(user.getType().equals("admin")) {
List<Express> orderList = expressBiz.selectall("");
#{id,jdbcType=VARCHAR},
</if>
<if test="password != null" >
#{password,jdbcType=VARCHAR},
</if>
<if test="type != null" >
#{type,jdbcType=VARCHAR},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="phone != null" >
#{phone,jdbcType=VARCHAR},
</if>
<if test="pt != null" >
#{pt,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.dzx.express.entity.User" >
update adminuser
<set >
<if test="password != null" >
password = #{password,jdbcType=VARCHAR},
</if>
<if test="type != null" >
type = #{type,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.dzx.express.entity.User" >
update adminuser
set password = #{password,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS中国各大城市搜索框代码 - 源码之家</title>
<link rel="stylesheet" href="css/cityselect.css">
<style type="text/css">
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator;
myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
System.out.println("Generator job done!");
// 打印结果
for (String str : warnings) {
System.out.println(str);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
public class Express {
private String id;
private String fromlocation;
private String tolocation;
private String phone;
private Date posttime;
private String type;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getFromlocation() {
return fromlocation;
}
public void setFromlocation(String fromlocation) {
this.fromlocation = fromlocation == null ? null : fromlocation.trim();
}
public String getTolocation() {
private String id;
private String password;
private String type;
private String phone;
private String name;
private String pt;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPt() {
return pt;
$("#rfromlocation").val(rfromlocation);
var rtolocation = tolocation+todetal+toname+"收"+tophone;
$("#rtolocation").val(rtolocation);
$("#fm1").submit();
}
</script>
<div style="text-align: center;"></div>
</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">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrapValidator.css">
<body><table class="table">
<thead>
<tr>
<th>
快递单号
</th>
<th>
寄发地
</th>
<th>
收件地
</th>
<th>
当前状态
</th>
<th>
下单时间
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
<c:forEach items="${orderList }" var="order">
<tr class="warning">
@Service(value="LogBiz")
public class LogBizImpl implements LogBiz{
@Autowired
LogMapper logMapper;
@Override
public int deleteByPrimaryKey(Integer logid) {
// TODO Auto-generated method stub
return logMapper.deleteByPrimaryKey(logid);
}
@Override
public int insert(Log record) {
// TODO Auto-generated method stub
return logMapper.insert(record);
}
@Override
public int insertSelective(Log record) {
// TODO Auto-generated method stub
return logMapper.insertSelective(record);
}
@Override
public Log selectByPrimaryKey(Integer logid) {
// TODO Auto-generated method stub
return logMapper.selectByPrimaryKey(logid);
}
@Override
public int updateByPrimaryKeySelective(Log record) {
// TODO Auto-generated method stub
return logMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(Log record) {
// TODO Auto-generated method stub
return logMapper.updateByPrimaryKey(record);
}
@Override
public List<Log> selectlog(String expressid) {
// TODO Auto-generated method stub
return logMapper.selectlog(expressid);
}
String location = user.getType().substring(0, user.getType().length()-1);
List<Express> orderList = expressBiz.selectall(location);
session.setAttribute("orderList", orderList);
return "allorder";
}
}
@Service(value="ExpressBiz")
public class ExpressBizImpl implements ExpressBiz{
@Autowired
ExpressMapper expressMapper;
@Override
public int deleteByPrimaryKey(String id) {
// TODO Auto-generated method stub
return expressMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(Express record) {
// TODO Auto-generated method stub
return expressMapper.insert(record);
}
@Override
public int insertSelective(Express record) {
// TODO Auto-generated method stub
return expressMapper.insertSelective(record);
}
@Override
public Express selectByPrimaryKey(String id) {
// TODO Auto-generated method stub
return expressMapper.selectByPrimaryKey(id);
}
@Override
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPt() {
return pt;
}
public void setPt(String pt) {
this.pt = pt;
}
}
public class Log {
private Integer logid;
private String expressid;
private String context;
private Date time;
private String type;
public Integer getLogid() {
return logid;
}
public void setLogid(Integer logid) {
this.logid = logid;
}
public String getExpressid() {
return expressid;
}
</update>
<update id="updateByPrimaryKey" parameterType="com.dzx.express.entity.Express" >
update express
set fromlocation = #{fromlocation,jdbcType=VARCHAR},
tolocation = #{tolocation,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
posttime = #{posttime,jdbcType=TIMESTAMP},
type = #{type,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dzx.express.mapper.LogMapper" >
<resultMap id="BaseResultMap" type="com.dzx.express.entity.Log" >
<id column="logid" property="logid" jdbcType="INTEGER" />
<result column="expressid" property="expressid" jdbcType="VARCHAR" />
<result column="context" property="context" jdbcType="VARCHAR" />
<result column="time" property="time" jdbcType="TIMESTAMP" />
<result column="type" property="type" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
logid, expressid, context, time, type
</sql>
<select id="selectlog" resultMap="BaseResultMap" parameterType="String">
select * from log
where expressid = #{expressid} order by time desc
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from log
where logid = #{logid,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from log
where logid = #{logid,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.dzx.express.entity.Log" >
insert into log (logid, expressid, context,
time, type)
values (#{logid,jdbcType=INTEGER}, #{expressid,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR},
#{time,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.dzx.express.entity.Log" >
insert into log
<trim prefix="(" suffix=")" suffixOverrides="," >
public String addorder(Express express,HttpSession session) {
express.setId(DateUtil.getId());
express.setPosttime(new Date());
express.setType("等待揽收");
expressBiz.insertSelective(express);
session.setAttribute("expid", express.getId());
return "success";
}
@RequestMapping(value="showexp")
public String showexp(String expid,HttpSession session) {
Express express = expressBiz.selectByPrimaryKey(expid);
if(express==null) {
List<Express> expressList = expressBiz.selectbyphone(expid);
if(expressList.size()==0) {
session.setAttribute("msg", "没有此快递单号或手机号的记录,请核对后再次查询!");
return "index";
}
session.setAttribute("expressList", expressList);
return "success";
}
List<Log> logList = logBiz.selectlog(expid);
session.setAttribute("express", express);
session.setAttribute("logList", logList);
return "orderinfo";
}
@RequestMapping(value="staff")
public String staff() {
return "login";
}
@RequestMapping(value="login")
public String login(String username,String password,HttpSession session) {
User user = userBiz.selectByPrimaryKey(username);
if(!user.getPassword().equals(password)) {
session.setAttribute("error", "工号或密码错误!");
return "login";
}
session.setAttribute("loginUser", user);
session.removeAttribute("msg");
public interface UserMapper {
List<User> selectbypt(String pt);
int deleteByPrimaryKey(String id);
int insert(User record);
int insertSelective(User record);
User selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKey(User record);
}
public interface UserBiz {
List<User> selectbypt(String pt);
int deleteByPrimaryKey(String id);
int insert(User record);
int insertSelective(User record);
User selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKey(User record);
}
<%@ 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">
<title>寄发快递</title>
<link rel="stylesheet" href="css/cityselect.css">
<style type="text/css">
.demo {
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dzx.express.mapper.LogMapper" >
<resultMap id="BaseResultMap" type="com.dzx.express.entity.Log" >
<id column="logid" property="logid" jdbcType="INTEGER" />
<result column="expressid" property="expressid" jdbcType="VARCHAR" />
<result column="context" property="context" jdbcType="VARCHAR" />
<result column="time" property="time" jdbcType="TIMESTAMP" />
<result column="type" property="type" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
logid, expressid, context, time, type
</sql>
<select id="selectlog" resultMap="BaseResultMap" parameterType="String">
select * from log
where expressid = #{expressid} order by time desc
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from log
where logid = #{logid,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from log
where logid = #{logid,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.dzx.express.entity.Log" >
insert into log (logid, expressid, context,
time, type)
values (#{logid,jdbcType=INTEGER}, #{expressid,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR},
#{time,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.dzx.express.entity.Log" >
insert into log
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="logid != null" >
logid,
</if>
<if test="expressid != null" >
expressid,
</if>
<if test="context != null" >
context,
</if>
<if test="time != null" >
time,
</if>