基于javaweb+mysql的ssm物流快递管理系统(java+ssm+js+jsp+mysql)

基于javaweb+mysql的ssm物流快递管理系统(java+ssm+js+jsp+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的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版本;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
    }

    public void setExpressid(String expressid) {
        this.expressid = expressid == null ? null : expressid.trim();
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context == null ? null : context.trim();
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type == null ? null : type.trim();
    }
}

public class DateUtil {
	private static SimpleDateFormat sdf=new  SimpleDateFormat("yyyyMMddHHmmss");
public static String getId(){
	Random random=new Random();
	Date date=new Date();
	String resu=sdf.format(date)+(random.nextInt(1000)+1000);
	return resu;
	@Override
	public int deleteByPrimaryKey(String id) {
		// TODO Auto-generated method stub
		return userMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(User record) {
		// TODO Auto-generated method stub
		return userMapper.insert(record);
	}

	@Override
	public int insertSelective(User record) {
		// TODO Auto-generated method stub
		return userMapper.insertSelective(record);
	}

	@Override
	public User selectByPrimaryKey(String id) {
		// TODO Auto-generated method stub
		return userMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKeySelective(User record) {
		// TODO Auto-generated method stub
		return userMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(User record) {
		// TODO Auto-generated method stub
		return userMapper.updateByPrimaryKey(record);
	}

	@Override
	public List<User> selectbypt(String pt) {
		// TODO Auto-generated method stub
		return userMapper.selectbypt(pt);
	}

}
	@Override
	public int deleteByPrimaryKey(String id) {
		// TODO Auto-generated method stub
		return userMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(User record) {
		// TODO Auto-generated method stub
		return userMapper.insert(record);
	}

	@Override
	public int insertSelective(User record) {
		// TODO Auto-generated method stub
		return userMapper.insertSelective(record);
	}

	@Override
	public User selectByPrimaryKey(String id) {
		// TODO Auto-generated method stub
		return userMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKeySelective(User record) {
		// TODO Auto-generated method stub
		return userMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(User record) {
		// TODO Auto-generated method stub
		return userMapper.updateByPrimaryKey(record);
	}

	@Override
	public List<User> selectbypt(String pt) {
		// TODO Auto-generated method stub
		return userMapper.selectbypt(pt);
	}

}

		},
		error : function(data) {
			alert("出错!请联系管理员");
		}
	});
}
</script>
</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">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Express物流查询</title>
<link rel="stylesheet" href="css/cityselect.css">
<style type="text/css">
	.demo{width:220px;margin:50px auto;}
	.demo input{padding: 12px 18px;}
</style>

</head>
<body style="background-image: url(image/background.jpg);-moz-background-size:100% 100%; background-size:100% 100%;">
<div style="background-color: rgba(246,246,246,0.7);" >
<div style="text-align: center;margin:200px auto auto 20px;"><h2>新闻热点</h2><br>
<a href="http://www.sohu.com/picture/274945213?_f=index_chan08focus_0" target="_blank">“复兴号”首设快递专用车厢</a><br>
<a href="new1.htm" target="_blank">“双十一”后快递激增 南京各高校“快递山”模式开启</a><br><br><br>
<h3 >在下面的输入框中输入所查询的物流单号:</h3>
</div>
<div class="demo" style="background-color: #f6f6f6;">
	<!-- 在输入框加入id -->
	<form id="form0" action="showexp.do" method="post">
	<input id="expid" name="expid" type="text" placeholder="请输入物流单号" style="width: 220px"><br>
	</form>
	<font color="red" id="msg">${msg}</font>
</div>
<div class="demo">
		<center>
			<button οnclick="fmsub()"
		},
		async : true,
		dataType : 'text',
		success : function(data) {
			alert("入库成功!");
			location.reload(true);
		},
		error : function(data) {
			alert("出错!请联系管理员");
		}
	});
}
function order(id){
	var staffid=prompt("请输入揽收员工号","");
	$.ajax({
		type : "post",
		url : "order.do",
		data : {
			"expid" : id,
			"staffid": staffid
		},
		async : true,
		dataType : 'text',
		success : function(data) {
			if(data=='0'){
				alert("员工号输入有误!");
				return;
			}
			alert(data);
			location.reload(true);
		},
		error : function(data) {
			alert("出错!请联系管理员");
		}
	});
}
function removeorder(id){
	$.ajax({
		type : "post",
		url : "orderremove.do",
		data : {
			"expid" : id
		},
		async : true,
		dataType : 'text',
		success : function(data) {
		User user = userBiz.selectByPrimaryKey(staffid);
		if(user==null) {
			pw.write("0");
			return;
		}
		Log log = new Log();
		log.setContext("快递员:"+user.getName()+"已出发,联系电话"+user.getPhone());
		log.setExpressid(expid);
		log.setTime(new Date());
		Express express = expressBiz.selectByPrimaryKey(expid);
		express.setType("正在揽收,快递员:"+user.getName()+",电话:"+user.getPhone());
		logBiz.insert(log);
		expressBiz.updateByPrimaryKeySelective(express);
		pw.write("已发出揽收通知!");
	}
	
	@RequestMapping(value="orderremove")
	public void orderremove(String expid) {
		expressBiz.deleteByPrimaryKey(expid);
	}
	
	@RequestMapping(value="confimorder")
	public String confimorder(String expid) {
		Express express = expressBiz.selectByPrimaryKey(expid);
		express.setType("已确认收货,感谢您的使用!");
		Log log = new Log();
		log.setContext("已确认收货,感谢您的使用!");
		log.setExpressid(expid);
		log.setTime(new Date());
		log.setType("0");
		logBiz.insertSelective(log);
		expressBiz.updateByPrimaryKeySelective(express);
		return "redirect:showexp.do?expid="+expid;
	}
	
	//仓库管理员工操作:
	@RequestMapping(value="addstaff")
	public String addstaff(User user,HttpSession session) {
		user.setId(DateUtil.getStaffId());
		user.setType("员工");
		userBiz.insertSelective(user);
		session.setAttribute("addstaffmsg", "创建成功,员工号为:"+user.getId());
		return "newstaff";
	}
	
	@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);
	public String orderin(String expid,HttpSession session) {
		session.removeAttribute("msg");
		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());
		String type = express.getType().substring(0, 4);
		//System.out.println(type);
		if(type.equals("正在揽收")&&user.getType().equals("员工")) {
		log.setContext("揽收成功!");
		express.setType("已经揽收等待运输");
		session.setAttribute("msg", "操作成功!单号"+expid+"已经揽收");
		}else if(user.getType().equals("员工")){
			log.setContext("已签收");
			express.setType("已签收,请确认收货");
			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="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();
    }

    public void setFromlocation(String fromlocation) {
        this.fromlocation = fromlocation == null ? null : fromlocation.trim();
    }

    public String getTolocation() {
        return tolocation;
    }

    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;
    
<body style="background-image: url(image/background.jpg);-moz-background-size:100% 100%; background-size:100% 100%;">
	<div style="background-color: rgba(246,246,246,0.9);">
	<h3 style="text-align: center; margin-top: 15px;">请认真填写快递单:</h3>
	<form id="fm1" action="addorder.do" method="post">
	<div class="demo">
		<!-- 在输入框加入id -->
		<input type="hidden" name="fromlocation" id="rfromlocation">
		<label for="fromlocation">寄发城市</label> 
		<input type="text"
			class="cityinput"  id="fromlocation"
			placeholder="请输入寄发地"> <label for="fromlocation">寄发详细地址</label>
		<input type="text" class="cityinput" name="fromdetal" id="fromdetal"
			style="width: 300px;" placeholder="请输入详细地址"><br><span id="fromlabel" style="color: red;"></span>
		<br><span id="fromlabel1" style="color: red;"></span>
		<br> <label for="fromlocation">寄发人</label> 
		<input type="text"
			class="cityinput" name="fromname" id="fromname" placeholder="请输入寄发人"> <label
			for="fromlocation">寄发人电话</label> 
			<input type="text" class="cityinput"
			name="phone" id="fromphone" style="width: 300px;" placeholder="请输入寄发人电话">
	</div>
	<div class="demo" style="text-align: center;">
		<span style=""><br>
		<br></span>
	</div>
	<div class="demo">
		<!-- 在输入框加入id -->
		<input type="hidden" name="tolocation" id="rtolocation">
		<label for="tolocation">收件城市</label> <input type="text"
			class="cityinput" id="tolocation"
			placeholder="请输入目的地"> <label for="fromlocation">收件人详细地址</label>
		<input type="text" class="cityinput" name="todetal" id="todetal"
			style="width: 300px;" placeholder="请输入详细地址"><br><span id="tolabel" style="color: red;"></span>
		<br><span id="tolabel1" style="color: red;"></span>
		<br> <label for="fromlocation">收件人</label> <input type="text"
			class="cityinput" name="toname" id="toname" placeholder="请输入收件人"> <label
			for="fromlocation">收件人电话</label> <input type="text" class="cityinput"
			name="tophone" id="tophone" style="width: 300px;" placeholder="请输入收件人电话">
	</div>
	</form>
	<div class="demo">
		<center>
			<button onclick="fmsub()"
				style="color: #fff; background-color: #4B95FF; border-color: #2a75fe; border-radius: 5px; height: 45px; width: 100%">发送快递</button>
		</center>
	</div>
	</div>
	<br><br><br><br><br>
	<script type="text/javascript">
    int insertSelective(Log record);

    Log selectByPrimaryKey(Integer logid);

    int updateByPrimaryKeySelective(Log record);

    int updateByPrimaryKey(Log record);
}

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">
		// TODO Auto-generated method stub
		return userMapper.insert(record);
	}

	@Override
	public int insertSelective(User record) {
		// TODO Auto-generated method stub
		return userMapper.insertSelective(record);
	}

	@Override
	public User selectByPrimaryKey(String id) {
		// TODO Auto-generated method stub
		return userMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKeySelective(User record) {
		// TODO Auto-generated method stub
		return userMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(User record) {
		// TODO Auto-generated method stub
		return userMapper.updateByPrimaryKey(record);
	}

	@Override
	public List<User> selectbypt(String pt) {
		// TODO Auto-generated method stub
		return userMapper.selectbypt(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 class MyBatisXmlGenerator {
	public static void main(String[] args) {
		try {
			List<String> warnings = new ArrayList<String>();
			boolean overwrite = true;
			// 读取配置文件
			InputStream configFile = MyBatisXmlGenerator.class.getClassLoader()
					.getResourceAsStream("MyBatisGeneratorConfig.xml");
			ConfigurationParser cp = new ConfigurationParser(warnings);
			Configuration config;

			config = cp.parseConfiguration(configFile);

			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 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() {
        return id;
    }

    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    public String getPassword() {
        return password;
    }

        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() {
        return id;
    }

    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    public String getPassword() {
        return password;
    }
	}

	@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);
	}

}

@Service(value="UserBiz")
public class UserBizImpl implements UserBiz{
	@Autowired
	UserMapper userMapper;
	
	@Override
	public int deleteByPrimaryKey(String id) {
		// TODO Auto-generated method stub
		return userMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(User record) {
		// TODO Auto-generated method stub
		return userMapper.insert(record);
	}

      </if>
      <if test="posttime != null" >
        posttime,
      </if>
      <if test="type != null" >
        type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="fromlocation != null" >
        #{fromlocation,jdbcType=VARCHAR},
      </if>
      <if test="tolocation != null" >
        #{tolocation,jdbcType=VARCHAR},
      </if>
      <if test="phone != null" >
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="posttime != null" >
        #{posttime,jdbcType=TIMESTAMP},
      </if>
      <if test="type != null" >
        #{type,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dzx.express.entity.Express" >
    update express
    <set >
      <if test="fromlocation != null" >
        fromlocation = #{fromlocation,jdbcType=VARCHAR},
      </if>
      <if test="tolocation != null" >
        tolocation = #{tolocation,jdbcType=VARCHAR},
      </if>
      <if test="phone != null" >
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="posttime != null" >
        posttime = #{posttime,jdbcType=TIMESTAMP},
      </if>
      <if test="type != null" >
        type = #{type,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
</head>
<body style="background-image: url(image/background.jpg);-moz-background-size:100% 100%; background-size:100% 100%;">
<div style="background-color: rgba(246,246,246,0.7);" >
<div style="text-align: center;margin:200px auto auto 20px;"><h2>新闻热点</h2><br>
<a href="http://www.sohu.com/picture/274945213?_f=index_chan08focus_0" target="_blank">“复兴号”首设快递专用车厢</a><br>
<a href="new1.htm" target="_blank">“双十一”后快递激增 南京各高校“快递山”模式开启</a><br><br><br>
<h3 >在下面的输入框中输入所查询的物流单号:</h3>
</div>
<div class="demo" style="background-color: #f6f6f6;">
	<!-- 在输入框加入id -->
	<form id="form0" action="showexp.do" method="post">
	<input id="expid" name="expid" type="text" placeholder="请输入物流单号" style="width: 220px"><br>
	</form>
	<font color="red" id="msg">${msg}</font>
</div>
<div class="demo">
		<center>
			<button onclick="fmsub()"
				style="color: #fff; background-color: #4B95FF; border-color: #2a75fe; border-radius: 5px; height: 45px; width: 100%">查询快递</button>
		</center>
	</div>
	<div class="demo">
		<center>
			<button onclick="javascript:window.location='addorder.jsp'"
				style="color: #fff; background-color: #4B95FF; border-color: #2a75fe; border-radius: 5px; height: 45px; width: 100%">我要发快递</button>
		</center>
	</div>
	</div>
<div style="text-align:center;">
<br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>

<script type="text/javascript">
function fmsub(){
	var expid = $("#expid").val();
	if(expid==''){
		$("#msg").html("物流单号不能为空");
		return;
	}
	$("#form0").submit();
}
</script>

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值