SSM框架+LayUi+Mysql实现的物流配送管理系统
本系统为了解决物流平台的配送难题,将司机/物流配送的整体流程话,便于物流公司的统一管理,提高了物流日常工作的高效。
(文末查看完整源码)
实现功能截图
车辆管理
路线管理
运单管理
调度安排
皮肤设置
系统功能
本系统实现了以下功能:
1、注册登录
2、权限分配
3、员工管理
4、车辆管理
5、路线管理
6、运单管理
7、调度安排
8、其他信息管理
等
使用技术
数据库:mysql
开发工具:Idea(Myeclispe、Eclipse也可以)
知识点:SSM框架
项目结构
代码
java端
entity实体
Admin.java
package com.wbg.logistics.entity;
public class Admin {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column admin.a_id
*
* @mbg.generated
*/
private Integer aId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column admin.a_account
*
* @mbg.generated
*/
private String aAccount;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column admin.a_password
*
* @mbg.generated
*/
private String aPassword;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column admin.a_rank
*
* @mbg.generated
*/
private String aRank;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column admin.a_id
*
* @return the value of admin.a_id
*
* @mbg.generated
*/
public Integer getaId() {
return aId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column admin.a_id
*
* @param aId the value for admin.a_id
*
* @mbg.generated
*/
public void setaId(Integer aId) {
this.aId = aId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column admin.a_account
*
* @return the value of admin.a_account
*
* @mbg.generated
*/
public String getaAccount() {
return aAccount;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column admin.a_account
*
* @param aAccount the value for admin.a_account
*
* @mbg.generated
*/
public void setaAccount(String aAccount) {
this.aAccount = aAccount == null ? null : aAccount.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column admin.a_password
*
* @return the value of admin.a_password
*
* @mbg.generated
*/
public String getaPassword() {
return aPassword;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column admin.a_password
*
* @param aPassword the value for admin.a_password
*
* @mbg.generated
*/
public void setaPassword(String aPassword) {
this.aPassword = aPassword == null ? null : aPassword.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column admin.a_rank
*
* @return the value of admin.a_rank
*
* @mbg.generated
*/
public String getaRank() {
return aRank;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column admin.a_rank
*
* @param aRank the value for admin.a_rank
*
* @mbg.generated
*/
public void setaRank(String aRank) {
this.aRank = aRank == null ? null : aRank.trim();
}
}
Depart.java
package com.wbg.logistics.entity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
public class Depart {
private Firm firm;
private Dispatch dispatch;
@Override
public String toString() {
return "Depart{" +
"firm=" + firm +
", dispatch=" + dispatch +
", staffNo=" + staffNo +
", staffName='" + staffName + '\'' +
", gender='" + gender + '\'' +
", birthhday=" + birthhday +
", phone='" + phone + '\'' +
", password='" + password + '\'' +
", dedpartNo=" + dedpartNo +
", firmNo=" + firmNo +
'}';
}
public Firm getFirm() {
return firm;
}
public void setFirm(Firm firm) {
this.firm = firm;
}
public Dispatch getDispatch() {
return dispatch;
}
public void setDispatch(Dispatch dispatch) {
this.dispatch = dispatch;
}
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column depart.staff_no
*
* @mbg.generated
*/
private Integer staffNo;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column depart.staff_name
*
* @mbg.generated
*/
private String staffName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column depart.gender
*
* @mbg.generated
*/
private String gender;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column depart.birthhday
*
* @mbg.generated
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date birthhday;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column depart.phone
*
* @mbg.generated
*/
private String phone;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column depart.password
*
* @mbg.generated
*/
private String password;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column depart.dedpart_no
*
* @mbg.generated
*/
private Integer dedpartNo;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column depart.firm_no
*
* @mbg.generated
*/
private Integer firmNo;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column depart.staff_no
*
* @return the value of depart.staff_no
*
* @mbg.generated
*/
public Integer getStaffNo() {
return staffNo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column depart.staff_no
*
* @param staffNo the value for depart.staff_no
*
* @mbg.generated
*/
public void setStaffNo(Integer staffNo) {
this.staffNo = staffNo;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column depart.staff_name
*
* @return the value of depart.staff_name
*
* @mbg.generated
*/
public String getStaffName() {
return staffName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column depart.staff_name
*
* @param staffName the value for depart.staff_name
*
* @mbg.generated
*/
public void setStaffName(String staffName) {
this.staffName = staffName == null ? null : staffName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column depart.gender
*
* @return the value of depart.gender
*
* @mbg.generated
*/
public String getGender() {
return gender;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column depart.gender
*
* @param gender the value for depart.gender
*
* @mbg.generated
*/
public void setGender(String gender) {
this.gender = gender == null ? null : gender.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column depart.birthhday
*
* @return the value of depart.birthhday
*
* @mbg.generated
*/
public Date getBirthhday() {
return birthhday;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column depart.birthhday
*
* @param birthhday the value for depart.birthhday
*
* @mbg.generated
*/
public void setBirthhday(Date birthhday) {
this.birthhday = birthhday;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column depart.phone
*
* @return the value of depart.phone
*
* @mbg.generated
*/
public String getPhone() {
return phone;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column depart.phone
*
* @param phone the value for depart.phone
*
* @mbg.generated
*/
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column depart.password
*
* @return the value of depart.password
*
* @mbg.generated
*/
public String getPassword() {
return password;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column depart.password
*
* @param password the value for depart.password
*
* @mbg.generated
*/
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column depart.dedpart_no
*
* @return the value of depart.dedpart_no
*
* @mbg.generated
*/
public Integer getDedpartNo() {
return dedpartNo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column depart.dedpart_no
*
* @param dedpartNo the value for depart.dedpart_no
*
* @mbg.generated
*/
public void setDedpartNo(Integer dedpartNo) {
this.dedpartNo = dedpartNo;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column depart.firm_no
*
* @return the value of depart.firm_no
*
* @mbg.generated
*/
public Integer getFirmNo() {
return firmNo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column depart.firm_no
*
* @param firmNo the value for depart.firm_no
*
* @mbg.generated
*/
public void setFirmNo(Integer firmNo) {
this.firmNo = firmNo;
}
}
dao层
AdminMapper.java
package com.wbg.logistics.dao;
import com.wbg.logistics.entity.Admin;
import java.util.List;
public interface AdminMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table admin
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer aId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table admin
*
* @mbg.generated
*/
int insert(Admin record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table admin
*
* @mbg.generated
*/
Admin selectByPrimaryKey(Integer aId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table admin
*
* @mbg.generated
*/
List<Admin> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table admin
*
* @mbg.generated
*/
int updateByPrimaryKey(Admin record);
}
DepartMapper.java
package com.wbg.logistics.dao;
import com.wbg.logistics.entity.Depart;
import com.wbg.logistics.entity.Dispatch;
import java.util.List;
public interface DepartMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table depart
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer staffNo);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table depart
*
* @mbg.generated
*/
int insert(Depart record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table depart
*
* @mbg.generated
*/
List<Depart> selectByPrimaryKey(Integer staffNo);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table depart
*
* @mbg.generated
*/
List<Depart> selectAll();
List<Depart> selectAllJson();
List<Depart> selectByType(String staffName);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table depart
*
* @mbg.generated
*/
int updateByPrimaryKey(Depart record);
}
controller层
AdminMapperController.java
package com.wbg.logistics.controller;
import com.wbg.logistics.dao.AdminMapper;
import com.wbg.logistics.entity.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@Controller
@RequestMapping("/admin")
public class AdminMapperController {
@Autowired
private AdminMapper adminMapper;
@RequestMapping(method = RequestMethod.GET)
public String index(@RequestParam(defaultValue = "1") int page, Model model){
List<Admin> authodList=adminMapper.selectAll();
model.addAttribute("authod",authodList);
return "/employee";
}
}
DepartController.java
package com.wbg.logistics.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wbg.logistics.dao.DepartMapper;
import com.wbg.logistics.entity.Depart;
import com.wbg.logistics.util.DBUtil;
import com.wbg.logistics.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.ws.rs.PathParam;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping("/depart")
public class DepartController {
@Autowired
private DepartMapper departMapper;
@RequestMapping(value = "/json",method = RequestMethod.GET)
@ResponseBody
public String selectAllJson(@RequestParam("page") int page ,@RequestParam("limit") int limit){
PageHelper.startPage(page,limit);
R r=new R();
List<Depart> list=departMapper.selectAllJson();
PageInfo pi = new PageInfo(list);
r.setMsg("ok");
r.setData(list);
r.setCount((int)pi.getTotal());
return r.toJsonyMd();
}
@RequestMapping(value = "/add", method = RequestMethod.GET)
public String add(Depart depart, RedirectAttributes redirectAttributes) {
try {
if (departMapper.insert(depart) > 0) {
redirectAttributes.addAttribute("msg", "添加成功");
redirectAttributes.addAttribute("routeName","");
redirectAttributes.addAttribute("staff", "");
}
else{
redirectAttributes.addAttribute("msg","添加失败");
}
}catch (Exception e){
redirectAttributes.addAttribute("msg","添加失败");
return "redirect:/depart";
}
return "redirect:/depart";
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public String update(@RequestBody Depart depart) {
R r = new R();
try{
if (departMapper.updateByPrimaryKey(depart) > 0) {
r.setMsg("修改成功");
r.setCode(3);
} else
r.setMsg("修改失败");
}catch (Exception e){
r.setMsg("修改失败");
return r.toJsonyMd();
}
return r.toJsonyMd();
}
@RequestMapping(value = "/del/{departNo}", method = RequestMethod.POST)
@ResponseBody
public String del(@PathVariable("departNo") int departNo) {
R r = new R();
try {
if (departMapper.deleteByPrimaryKey(departNo) > 0) {
r.setMsg("删除成功");
r.setCode(3);
} else
r.setMsg("删除失败");
}catch (Exception e){
r.setMsg("删除失败,可能存在员工");
return r.toJsonyMd();
}
return r.toJsonyMd();
}
@RequestMapping(method = RequestMethod.GET)
public String index(){
return "employeeadd";
}
@RequestMapping(value = "/ById/{staffNo}", method = RequestMethod.GET)
@ResponseBody
public String seleById(@PathVariable("staffNo") int staffNo){
R r=new R();
List<Depart> list=departMapper.selectByPrimaryKey(staffNo);
r.setMsg("ok");
r.setData(list);
r.setCount(1);
return r.toJson();
}
@RequestMapping(value = "/ByName/{staffName}", method = RequestMethod.GET)
@ResponseBody
public String seleByName(@PathVariable("staffName") String staffName){
R r=new R();
List<Depart> list=departMapper.selectByType("%"+staffName+"%");
PageInfo pi = new PageInfo(list);
r.setMsg("ok");
r.setData(list);
r.setCount((int)pi.getTotal());
return r.toJson();
}
}
DBUtil.java
package com.wbg.logistics.util;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.jmx.snmp.Timestamp;
import java.io.IOException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class DBUtil {
public static String toJson(Object obj){
String reuqest=null;
//对象映射
ObjectMapper mapper=new ObjectMapper();
//设置时间格式
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
mapper.setDateFormat(dateFormat);
try {
reuqest=mapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return reuqest;
}
public static String toJsonyMd(Object obj){
String reuqest=null;
//对象映射
ObjectMapper mapper=new ObjectMapper();
//设置时间格式
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd");
mapper.setDateFormat(dateFormat);
try {
reuqest=mapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return reuqest;
}
public static <T> T toObject(String src,Class<T> valueType){
T request=null;
//对象反射
ObjectMapper mapper=new ObjectMapper();
try {
request=mapper.readValue(src, valueType);
} catch (JsonParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return request;
}
public static Timestamp date(String date_str) {
try {
Calendar zcal = Calendar.getInstance();//日期类
Timestamp timestampnow = new Timestamp(zcal.getTimeInMillis());//转换成正常的日期格式
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//改为需要的东西
ParsePosition pos = new ParsePosition(0);
java.util.Date current = formatter.parse(date_str, pos);
timestampnow = new Timestamp(current.getTime());
return timestampnow;
}
catch (NullPointerException e) {
return null;
}
}
}
完整源码
觉得有用,记得一键三连哦!