作者主页:编程指南针
作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师
主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助
文末获取源码
一,项目简介
基于SSM框架的物流管理系统主要分为三种用户角色,分别是管理员、员工以及客户用户,其具体功能如下:
管理员:管理员登录后主要功能模块有个人信息,客户管理,反馈信息,基础信息,货物信息以及货物运输。
员工用户:员工用户登录后主要模块有个人信息,配送范围,货物信息,货物运输以及反馈信息。
客户用户:客户用户登录后主要模块有个人信息,配送范围,货物信息,货物运输以及反馈信息。
二,环境介绍
语言环境:Java: jdk1.8
数据库:Mysql: mysql5.7
应用服务器:Tomcat: tomcat8.5.31
开发工具:IDEA或eclipse
后台开发:SSM框架
前端开发:Bootstrap+Jquery+Echart
三,系统展示
展示一下部分系统的功能:
用户登陆
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/572913abeffd4916b47fd29d4d249d2f~tplv-k3u1fbpfcp-zoom-in-crop-mark:1512:0:0:0.awebp) 编辑
管理员主功能界面:
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/8d1b110f993e48c78b529d4fd849a772~tplv-k3u1fbpfcp-zoom-in-crop-mark:1512:0:0:0.awebp) 编辑
员工管理
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/1e8c10f30f4c4e91a851e6e9297a3758~tplv-k3u1fbpfcp-zoom-in-crop-mark:1512:0:0:0.awebp) 编辑
客户管理
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/fccc3031c4c84bf08a8cbbafd8f8b69a~tplv-k3u1fbpfcp-zoom-in-crop-mark:1512:0:0:0.awebp) 编辑
反馈信息
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/5885de111e2f41de9da884ec8b6d3491~tplv-k3u1fbpfcp-zoom-in-crop-mark:1512:0:0:0.awebp) 编辑
基础信息管理
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/7e7da6505d8a47c3ab4cb2256ba55d65~tplv-k3u1fbpfcp-zoom-in-crop-mark:1512:0:0:0.awebp) 编辑
货物信息审核
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/ec618f5fd9864d299f29f1ccee7d1a27~tplv-k3u1fbpfcp-zoom-in-crop-mark:1512:0:0:0.awebp) 编辑
货物运输
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/4f66a2ff78f24778a918172cea6a5afe~tplv-k3u1fbpfcp-zoom-in-crop-mark:1512:0:0:0.awebp) 编辑
客户角色的管理主界面
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/b2fb6d3cde6f48fe9536c44570035ca8~tplv-k3u1fbpfcp-zoom-in-crop-mark:1512:0:0:0.awebp) 编辑
普通管理用户的管理主界面
四,核心代码展示
package com.action;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import com.model.*;
import com.service.*;
import com.util.*;
@Controller
public class GgtypeAction {
@Autowired
private GgtypeService ggtypeService;
@RequestMapping("/getGgtypes")
public void getGgtypes(HttpServletRequest request,
HttpServletResponse response) throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String page = (String) request.getParameter("page");
String rows = (String) request.getParameter("rows");
String ggtypeName = (String) request.getParameter("ggtypeName");
String ggtypeId = (String) request.getParameter("ggtypeId");
PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
Ggtype ggtype = new Ggtype();
try {
if (StringUtil.isNotEmpty(ggtypeName)) {
ggtype.setGgtypeName(ggtypeName);
}
if (StringUtil.isNotEmpty(ggtypeId)) {
ggtype.setGgtypeId(Integer.parseInt(ggtypeId));
}
JSONArray jsonArray = JSONArray.fromObject(ggtypeService.queryGgtypes(ggtype, pageBean.getStart(), pageBean.getRows()));
JSONObject result = new JSONObject();
int total = ggtypeService.queryGgtypes(ggtype, 0, 0).size();
result.put("rows", jsonArray);
result.put("total", total);
ResponseUtil.write(response, result);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/addGgtype")
public void addGgtype(HttpServletRequest request, HttpServletResponse response)
throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
try {
JSONObject result = new JSONObject();
String ggtypeName = (String) request.getParameter("ggtypeName");
String ggtypeMark = (String) request.getParameter("ggtypeMark");
String ggtypeId = (String) request.getParameter("ggtypeId");
Ggtype ggtype = new Ggtype();
if (StringUtil.isNotEmpty(ggtypeId)) {
ggtype = ggtypeService.getGgtype(Integer.parseInt(ggtypeId));
}
if (StringUtil.isNotEmpty(ggtypeName)) {
ggtype.setGgtypeName(ggtypeName);
}
if (StringUtil.isNotEmpty(ggtypeMark)) {
ggtype.setGgtypeMark(ggtypeMark);
}
if (StringUtil.isNotEmpty(ggtypeId)) {
ggtypeService.modifyGgtype(ggtype);
} else {
ggtypeService.save(ggtype);
}
result.put("success", "true");
ResponseUtil.write(response, result);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/deleteGgtype")
public void deleteGgtype(HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
String delIds = (String) request.getParameter("delIds");
System.out.println("delIds = " + delIds);
JSONObject result = new JSONObject();
String str[] = delIds.split(",");
for (int i = 0; i < str.length; i++) {
ggtypeService.deleteGgtype(Integer.parseInt(str[i]));
}
result.put("success", "true");
result.put("delNums", str.length);
ResponseUtil.write(response, result);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/ggtypeComboList")
public void ggtypeComboList(HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", "");
jsonObject.put("ggtypeName", "请选择...");
jsonArray.add(jsonObject);
jsonArray.addAll(JSONArray.fromObject(ggtypeService.queryGgtypes(null, 0, 0)));
ResponseUtil.write(response, jsonArray);
} catch (Exception e) {
e.printStackTrace();
}
}
}
![点击并拖拽以移动]()
package com.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.model.*;
import com.service.*;
@Controller
public class AdminAction {
@Autowired
private AdminService adminService;
@RequestMapping("/mimaAdmin")
public void mimaAdmin(HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
JSONObject result = new JSONObject();
String adminPassword = (String) request.getParameter("adminPassword");
String adminPassword1 = (String) request.getParameter("adminPassword1");
Admin admin = new Admin();
admin.setAdminName("admin");
admin.setAdminPassword(adminPassword);
if (adminService.queryAdmins(admin, 0, 0).size()==1) {
admin = (Admin)(adminService.queryAdmins(admin, 0, 0)).get(0);
admin.setAdminPassword(adminPassword1);
adminService.modifyAdmin(admin);
request.setAttribute("error", "密码修改成功!");
request.getRequestDispatcher("adminmima.jsp").forward(request,
response);
}else{
result.put("success", "true");
request.setAttribute("error", "原密码错误,请重新输入!");
request.getRequestDispatcher("adminmima.jsp").forward(request,
response);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
![点击并拖拽以移动]()
package com.action;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import com.model.*;
import com.service.*;
import com.util.*;
@Controller
public class RoleAction {
@Autowired
private RoleService roleService;
@RequestMapping("/getRoles")
public void getRoles(HttpServletRequest request,
HttpServletResponse response) throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String page = (String) request.getParameter("page");
String rows = (String) request.getParameter("rows");
String roleName = (String) request.getParameter("roleName");
String roleId = (String) request.getParameter("roleId");
String roleMark2 = (String) request.getParameter("roleMark2");
PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
Role role = new Role();
try {
if (StringUtil.isNotEmpty(roleName)) {
role.setRoleName(roleName);
}
if (StringUtil.isNotEmpty(roleId)) {
role.setRoleId(Integer.parseInt(roleId));
}
if (StringUtil.isNotEmpty(roleMark2)) {
role.setRoleMark2(Integer.parseInt(roleMark2));
}
JSONArray jsonArray = JSONArray.fromObject(roleService.queryRoles(role, pageBean.getStart(), pageBean.getRows()));
JSONObject result = new JSONObject();
int total = roleService.queryRoles(role, 0, 0).size();
result.put("rows", jsonArray);
result.put("total", total);
ResponseUtil.write(response, result);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/addRole")
public void addRole(HttpServletRequest request, HttpServletResponse response)
throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
try {
JSONObject result = new JSONObject();
String roleName = (String) request.getParameter("roleName");
String roleMark = (String) request.getParameter("roleMark");
String roleMark1 = (String) request.getParameter("roleMark1");
String roleMark2 = (String) request.getParameter("roleMark2");
String roleId = (String) request.getParameter("roleId");
Role role = new Role();
if (StringUtil.isNotEmpty(roleId)) {
role = roleService.getRole(Integer.parseInt(roleId));
}
if (StringUtil.isNotEmpty(roleName)) {
role.setRoleName(roleName);
}
if (StringUtil.isNotEmpty(roleMark)) {
role.setRoleMark(roleMark);
}
if (StringUtil.isNotEmpty(roleMark1)) {
role.setRoleMark1(roleMark1);
}
if (StringUtil.isNotEmpty(roleMark2)) {
role.setRoleMark2(Integer.parseInt(roleMark2));
}
if (StringUtil.isNotEmpty(roleId)) {
roleService.modifyRole(role);
} else {
roleService.save(role);
}
result.put("success", "true");
ResponseUtil.write(response, result);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/deleteRole")
public void deleteRole(HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
String delIds = (String) request.getParameter("delIds");
System.out.println("delIds = " + delIds);
JSONObject result = new JSONObject();
String str[] = delIds.split(",");
for (int i = 0; i < str.length; i++) {
roleService.deleteRole(Integer.parseInt(str[i]));
}
result.put("success", "true");
result.put("delNums", str.length);
ResponseUtil.write(response, result);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/roleComboList")
public void roleComboList(HttpServletRequest request, HttpServletResponse response)
throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String roleMark2 = (String) request.getParameter("roleMark2");
Role role = new Role();
if (StringUtil.isNotEmpty(roleMark2)) {
role.setRoleMark2(Integer.parseInt(roleMark2));
}
try {
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", "");
jsonObject.put("roleName", "请选择...");
jsonArray.add(jsonObject);
//jsonArray.addAll(JSONArray.fromObject(roleService.queryRoles(role, 0, 0)));
ResponseUtil.write(response, jsonArray);
} catch (Exception e) {
e.printStackTrace();
}
}
}
![点击并拖拽以移动]()
package com.action;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import com.model.*;
import com.service.*;
import com.util.*;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
//导入导出
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
@Controller
public class GonggaoAction {
@Autowired
private GonggaoService gonggaoService;
@Autowired
private GgtypeService ggtypeService;
/***上传导入开始***/
private InputStream excelFile;
public InputStream getExcelFile() {
return excelFile;
}
/***上传导入结束***/
@RequestMapping("/getGonggaos")
public void getGonggaos(HttpServletRequest request,
HttpServletResponse response) throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String page = (String) request.getParameter("page");
String rows = (String) request.getParameter("rows");
String gonggaoName = (String) request.getParameter("gonggaoName");
String gonggaoId = (String) request.getParameter("gonggaoId");
String ggtypeId = (String) request.getParameter("ggtypeId");
String sdate = (String) request.getParameter("sdate");
String edate = (String) request.getParameter("edate");
PageBean pageBean = new PageBean(Integer.parseInt(page), Integer.parseInt(rows));
Gonggao gonggao = new Gonggao();
try {
if (StringUtil.isNotEmpty(gonggaoName)) {
gonggao.setGonggaoName(gonggaoName);
}
if (StringUtil.isNotEmpty(gonggaoId)) {
gonggao.setGonggaoId(Integer.parseInt(gonggaoId));
}
if (StringUtil.isNotEmpty(ggtypeId)) {
gonggao.setGgtypeId(Integer.parseInt(ggtypeId));
}
JSONArray jsonArray = JSONArray.fromObject(gonggaoService.queryGonggaos(
gonggao, pageBean.getStart(), pageBean.getRows(), sdate, edate));
JSONObject result = new JSONObject();
int total = gonggaoService.queryGonggaos(gonggao, 0, 0, sdate, edate).size();
result.put("rows", jsonArray);
result.put("total", total);
ResponseUtil.write(response, result);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/addGonggao")
public void addGonggao(HttpServletRequest request, HttpServletResponse response)
throws Exception {
JSONObject result = new JSONObject();
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String gonggaoName = (String) request.getParameter("gonggaoName");
String gonggaoMark = (String) request.getParameter("gonggaoMark");
String gonggaoDate = (String) request.getParameter("gonggaoDate");
String ggtypeId = (String) request.getParameter("ggtypeId");
String gonggaoId = (String) request.getParameter("gonggaoId");
Gonggao gonggao = new Gonggao();
if (StringUtil.isNotEmpty(gonggaoId)) {
gonggao = gonggaoService.getGonggao(Integer.parseInt(gonggaoId));
}
if (StringUtil.isNotEmpty(gonggaoName)) {
gonggao.setGonggaoName(gonggaoName);
}
if (StringUtil.isNotEmpty(gonggaoMark)) {
gonggao.setGonggaoMark(gonggaoMark);
}
if (StringUtil.isNotEmpty(gonggaoDate)) {
gonggao.setGonggaoDate(DateUtil.formatString(gonggaoDate,
"yyyy-MM-dd hh:mm:ss"));
}
if (StringUtil.isNotEmpty(ggtypeId)) {
gonggao.setGgtypeId(Integer.parseInt(ggtypeId));
Ggtype ggtype = new Ggtype();
ggtype = ggtypeService.getGgtype(Integer.parseInt(ggtypeId));
gonggao.setGgtypeName(ggtype.getGgtypeName());
}
try {
if (StringUtil.isNotEmpty(gonggaoId)) {
gonggaoService.modifyGonggao(gonggao);
result.put("success", "true");
ResponseUtil.write(response, result);
} else {
Date date = new Date();
gonggao.setGonggaoDate(date);
gonggaoService.save(gonggao);
result.put("success", "true");
ResponseUtil.write(response, result);
}
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/deleteGonggao")
public void deleteGonggao(HttpServletRequest request, HttpServletResponse response)
throws Exception {
JSONObject result = new JSONObject();
String delIds = (String) request.getParameter("delIds");
try {
String str[] = delIds.split(",");
for (int i = 0; i < str.length; i++) {
gonggaoService.deleteGonggao(Integer.parseInt(str[i]));
}
result.put("success", "true");
result.put("delNums", str.length);
ResponseUtil.write(response, result);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/gonggaoComboList")
public void gonggaoComboList(HttpServletRequest request, HttpServletResponse response)
throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String ggtypeId = (String) request.getParameter("ggtypeId");
Gonggao gonggao = new Gonggao();
if (StringUtil.isNotEmpty(ggtypeId)) {
gonggao.setGgtypeId(Integer.parseInt(ggtypeId));
}
try {
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", "");
jsonObject.put("gonggaoName", "请选择...");
jsonArray.add(jsonObject);
jsonArray.addAll(JSONArray.fromObject(gonggaoService.queryGonggaos(gonggao, 0, 0, null, null)));
ResponseUtil.write(response, jsonArray);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("/gonggaoTongji")
public void gonggaoTongji(HttpServletRequest request, HttpServletResponse response)
throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String sdate=request.getParameter("sdate");
String edate=request.getParameter("edate");
List ggtypeIds = new ArrayList();
List ggtypeNames = new ArrayList();
List gonggaoZongshus = new ArrayList();
List ggtypes = new ArrayList();
List gonggaos = new ArrayList();
Gonggao gonggao = new Gonggao();
Integer zongshu = 0;
try {
ggtypes = ggtypeService.queryGgtypes(null, 0,0);
for(int i=0;i |