基于jsp,ssm物流快递管理系统

开发工具:eclipse,jdk1.8

服务器:tomcat7.0

数据库:mysql5.7

技术: spring+springMVC+mybaits+EasyUI

项目包括用户前台和管理后台两部分,功能介绍如下:

一、用户(前台)功能:

用户进入物流快递管理系统后,可以进行在线下单,下单完成后,可以查询订单状态;接着,用户可以浏览相关物流快递的新闻资讯;用户可以浏览网站提供的业务范围;最后,用户如果需要投诉或者反馈信息,可以给网站在线留言。

在线下单:用户可以在线下单,填写发货人、收货人和货物相关信息即可。

查询订单:用户下单后,可以输入订单号,查询物流快递订单的状态。

浏览新闻:用户可以在网站上,浏览相关物流快递的最新资讯。

浏览业务:用户可以浏览网站上的业务介绍,了解业务范围,明确自己的物流快递需求。

在线留言:用户可以给网站在线留言,填写相关信息即可。

二、管理员(后台)功能:

管理员首先登录系统,可以进行菜单管理、角色管理、用户管理、订单管理、新闻管理、留言管理、查看日志。

菜单管理:管理员可以增、删、改和查菜单信息。

角色管理:对角色信息进行管理,可以增、删、改和查角色信息。

用户管理:对用户信息进行管理,可以添加、修改、查询和删除用户信息。

订单管理:对订单信息进行管理,可以添加、修改、查询和删除订单信息。

新闻管理:对新闻进行管理,可以添加、修改、查询和删除新闻资讯。

留言管理:对留言信息进行管理,可以修改和删除留言信息。

查看日志:可以查看系统的详细日志信息。

文档截图:

前台用户截图:

后台管理员截图:

java 复制代码
package com.ischoolbar.programmer.controller.admin;

import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import com.ischoolbar.programmer.entity.admin.News;
import com.ischoolbar.programmer.page.admin.Page;
import com.ischoolbar.programmer.service.admin.NewsCategoryService;
import com.ischoolbar.programmer.service.admin.NewsService;

/**
 * 新闻控制器
 * @author llq
 *
 */
@RequestMapping("/admin/news")
@Controller
public class NewsController {
	
	@Autowired
	private NewsCategoryService newsCategoryService;
	
	@Autowired
	private NewsService newsService;
	
	/**
	 * 新闻列表页面
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/list",method=RequestMethod.GET)
	public ModelAndView list(ModelAndView model){
		model.addObject("newsCategoryList", newsCategoryService.findAll());
		model.setViewName("news/list");
		return model;
	}
	
	/**
	 * 新闻添加页面
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/add",method=RequestMethod.GET)
	public ModelAndView add(ModelAndView model){
		model.addObject("newsCategoryList", newsCategoryService.findAll());
		model.setViewName("news/add");
		return model;
	}
	
	/**
	 * 新闻添加
	 * @param news
	 * @return
	 */
	@RequestMapping(value="/add",method=RequestMethod.POST)
	@ResponseBody
	public Map<String,String> add(News news){
		Map<String,String> ret = new HashMap<String, String>();
		if(news == null){
			ret.put("type", "error");
			ret.put("msg", "请填写正确的信息!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getTitle())){
			ret.put("type", "error");
			ret.put("msg", "新闻标题不能为空!");
			return ret;
		}
		if(news.getCategoryId() == null){
			ret.put("type", "error");
			ret.put("msg", "请选择新闻分类!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getAbstrs())){
			ret.put("type", "error");
			ret.put("msg", "新闻摘要不能为空!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getTags())){
			ret.put("type", "error");
			ret.put("msg", "新闻标签不能为空!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getPhoto())){
			ret.put("type", "error");
			ret.put("msg", "新闻封面图片必须上传!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getAuthor())){
			ret.put("type", "error");
			ret.put("msg", "新闻作者不能为空!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getContent())){
			ret.put("type", "error");
			ret.put("msg", "新闻内容不能为空!");
			return ret;
		}
		news.setCreateTime(new Date());
		if(newsService.add(news) <= 0){
			ret.put("type", "error");
			ret.put("msg", "添加失败,请联系管理员!");
			return ret;
		}
		ret.put("type", "success");
		ret.put("msg", "添加成功!");
		return ret;
	}
	
	
	/**
	 * 新闻编辑页面
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/edit",method=RequestMethod.GET)
	public ModelAndView edit(ModelAndView model,Long id){
		model.addObject("newsCategoryList", newsCategoryService.findAll());
		model.addObject("news", newsService.find(id));
		model.setViewName("news/edit");
		return model;
	}
	
	/**
	 * 新闻信息编辑
	 * @param newsCategory
	 * @return
	 */
	@RequestMapping(value="/edit",method=RequestMethod.POST)
	@ResponseBody
	public Map<String,String> edit(News news){
		Map<String,String> ret = new HashMap<String, String>();
		if(news == null){
			ret.put("type", "error");
			ret.put("msg", "请填写正确的信息!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getTitle())){
			ret.put("type", "error");
			ret.put("msg", "新闻标题不能为空!");
			return ret;
		}
		if(news.getCategoryId() == null){
			ret.put("type", "error");
			ret.put("msg", "请选择新闻分类!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getAbstrs())){
			ret.put("type", "error");
			ret.put("msg", "新闻摘要不能为空!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getTags())){
			ret.put("type", "error");
			ret.put("msg", "新闻标签不能为空!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getPhoto())){
			ret.put("type", "error");
			ret.put("msg", "新闻封面图片必须上传!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getAuthor())){
			ret.put("type", "error");
			ret.put("msg", "新闻作者不能为空!");
			return ret;
		}
		if(StringUtils.isEmpty(news.getContent())){
			ret.put("type", "error");
			ret.put("msg", "新闻内容不能为空!");
			return ret;
		}
		if(newsService.edit(news) <= 0){
			ret.put("type", "error");
			ret.put("msg", "修改失败,请联系管理员!");
			return ret;
		}
		ret.put("type", "success");
		ret.put("msg", "修改成功!");
		return ret;
	}
	
	/**
	 * 删除新闻
	 * @param id
	 * @return
	 */
	@RequestMapping(value="/delete",method=RequestMethod.POST)
	@ResponseBody
	public Map<String,String> delete(Long id){
		Map<String,String> ret = new HashMap<String, String>();
		if(id == null){
			ret.put("type", "error");
			ret.put("msg", "请选择要删除的信息!");
			return ret;
		}
		try{
			if(newsService.delete(id) <= 0){
				ret.put("type", "error");
				ret.put("msg", "删除失败,请联系管理员!");
				return ret;
			}
		}catch(Exception e){
			ret.put("type", "error");
			ret.put("msg", "该新闻下有评论信息,不可删除!");
			return ret;
		}
		ret.put("type", "success");
		ret.put("msg", "删除成功!");
		return ret;
	}
	
	/**
	 * 分页模糊搜索查询列表
	 * @param name
	 * @param page
	 * @return
	 */
	@RequestMapping(value="/list",method=RequestMethod.POST)
	@ResponseBody
	public Map<String,Object> getList(
			@RequestParam(name="title",required=false,defaultValue="") String title,
			@RequestParam(name="author",required=false,defaultValue="") String author,
			@RequestParam(name="categoryId",required=false) Long categoryId,
			Page page
			){
		Map<String,Object> ret = new HashMap<String, Object>();
		Map<String,Object> queryMap = new HashMap<String, Object>();
		queryMap.put("title", title);
		queryMap.put("author", author);
		if(categoryId != null && categoryId.longValue() != -1){
			queryMap.put("categoryId", categoryId);
		}
		queryMap.put("offset", page.getOffset());
		queryMap.put("pageSize", page.getRows());
		ret.put("rows", newsService.findList(queryMap));
		ret.put("total", newsService.getTotal(queryMap));
		return ret;
	}
	
	/**
	 * 上传图片
	 * @param photo
	 * @param request
	 * @return
	 */
	@RequestMapping(value="/upload_photo",method=RequestMethod.POST)
	@ResponseBody
	public Map<String, String> uploadPhoto(MultipartFile photo,HttpServletRequest request){
		Map<String, String> ret = new HashMap<String, String>();
		if(photo == null){
			ret.put("type", "error");
			ret.put("msg", "选择要上传的文件!");
			return ret;
		}
		if(photo.getSize() > 1024*1024*1024){
			ret.put("type", "error");
			ret.put("msg", "文件大小不能超过10M!");
			return ret;
		}
		//获取文件后缀
		String suffix = photo.getOriginalFilename().substring(photo.getOriginalFilename().lastIndexOf(".")+1,photo.getOriginalFilename().length());
		if(!"jpg,jpeg,gif,png".toUpperCase().contains(suffix.toUpperCase())){
			ret.put("type", "error");
			ret.put("msg", "请选择jpg,jpeg,gif,png格式的图片!");
			return ret;
		}
		String savePath = request.getServletContext().getRealPath("/") + "/resources/upload/";
		File savePathFile = new File(savePath);
		if(!savePathFile.exists()){
			//若不存在改目录,则创建目录
			savePathFile.mkdir();
		}
		String filename = new Date().getTime()+"."+suffix;
		try {
			//将文件保存至指定目录
			photo.transferTo(new File(savePath+filename));
		}catch (Exception e) {
			// TODO Auto-generated catch block
			ret.put("type", "error");
			ret.put("msg", "保存文件异常!");
			e.printStackTrace();
			return ret;
		}
		ret.put("type", "success");
		ret.put("msg", "用户上传图片成功!");
		ret.put("filepath",request.getServletContext().getContextPath() + "/resources/upload/" + filename );
		return ret;
	}
}
相关推荐
阮胜昌3 小时前
MySQL 9.7.0 LTS 现已发布:扩展了社区功能,并为企业级应用增加了动态数据脱敏功能
数据库·mysql
码域空间4 小时前
锁住了检查,锁不住延迟——MySQL 读写分离架构下双重检查模式失效实录
数据库·mysql·架构
数据库小学妹6 小时前
MySQL 8.4还是9.7 LTS?8.0 EOL后升级怎么选
数据库·mysql·dba·版本升级·数据库运维
m0_547486666 小时前
《数据库原理及应用教程MySQL 8.0》全套PPT课件2026
数据库·mysql
程序员夏洛6 小时前
MySQL 中的事务隔离级别有哪些?
数据库·mysql
冰暮流星6 小时前
mysql之字符串函数
数据库·mysql
梦想不只是梦与想7 小时前
MySQL 不同操作系统的安装方式
数据库·mysql·mysql安装
码农颜7 小时前
6.4.1 监听连接
java·数据库·mysql
菀亓1 天前
ubuntu系统mysql安装
mysql
程序员贺加贝1 天前
别被 saveBatch 骗了:一次 MyBatis-Plus 批量插入性能排查
mysql