项目介绍

本项目分为前后台,前台为普通用户登录,后台为管理员登录;

管理员角色包含以下功能:

管理员登录,系统用户管理,游客用户查询,新闻管理,场馆信息管理,门票管理,订单管理,订单统计,留言信息查看,留言回复等功能。

用户角色包含以下功能:

用户首页,查看某一展品,用户登录注册,加入购物车,查看我的订单,修改个人信息等功能。

环境需要

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版本;

6.是否Maven项目:否;

技术栈

1. 后端:Spring+SpringMVC+Mybatis

2. 前端:JSP+css+javascript+jQuery+Ajax

使用说明

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

4. 运行项目,在浏览器中输入http://localhost:8080/ssm_bwgsp_sys 登录

运行截图

前台界面

java开发购票流程_java开发购票流程

java开发购票流程_java开发购票流程_02

java开发购票流程_List_03

java开发购票流程_java_04

java开发购票流程_开发语言_05

后台界面

java开发购票流程_开发语言_06

java开发购票流程_开发语言_07

java开发购票流程_spring_08

java开发购票流程_List_09

java开发购票流程_spring_10

相关代码

VenueAction

package com.action;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Venue;
import com.service.VenueService;
import com.util.PageHelper;

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/venue", produces = "text/plain;charset=utf-8")
public class VenueAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private VenueService venueService;

	// 准备添加数据
	@RequestMapping("createVenue.action")
	public String createVenue() {
		return "admin/addvenue";
	}

	// 添加数据
	@RequestMapping("addVenue.action")
	public String addVenue(Venue venue) {
		venue.setHits("0");
		this.venueService.insertVenue(venue);
		return "redirect:/venue/createVenue.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteVenue.action")
	public String deleteVenue(String id) {
		this.venueService.deleteVenue(id);
		return "redirect:/venue/getAllVenue.action";
	}

	// 批量删除数据
	@RequestMapping("deleteVenueByIds.action")
	public String deleteVenueByIds() {
		String[] ids = this.getRequest().getParameterValues("venueid");
		for (String venueid : ids) {
			this.venueService.deleteVenue(venueid);
		}
		return "redirect:/venue/getAllVenue.action";
	}

	// 更新数据
	@RequestMapping("updateVenue.action")
	public String updateVenue(Venue venue) {
		this.venueService.updateVenue(venue);
		return "redirect:/venue/getAllVenue.action";
	}

	// 显示全部数据
	@RequestMapping("getAllVenue.action")
	public String getAllVenue(String number) {
		List<Venue> venueList = this.venueService.getAllVenue();
		PageHelper.getPage(venueList, "venue", null, null, 10, number, this.getRequest(), null);
		return "admin/listvenue";
	}

	// 按条件查询数据 (模糊查询)
	@RequestMapping("queryVenueByCond.action")
	public String queryVenueByCond(String cond, String name, String number) {
		Venue venue = new Venue();
		if (cond != null) {
			if ("venuename".equals(cond)) {
				venue.setVenuename(name);
			}
			if ("image".equals(cond)) {
				venue.setImage(name);
			}
			if ("contents".equals(cond)) {
				venue.setContents(name);
			}
			if ("hits".equals(cond)) {
				venue.setHits(name);
			}
		}

		List<String> nameList = new ArrayList<String>();
		List<String> valueList = new ArrayList<String>();
		nameList.add(cond);
		valueList.add(name);
		PageHelper.getPage(this.venueService.getVenueByLike(venue), "venue", nameList, valueList, 10, number, this.getRequest(), "query");
		name = null;
		cond = null;
		return "admin/queryvenue";
	}

	// 按主键查询数据
	@RequestMapping("getVenueById.action")
	public String getVenueById(String id) {
		Venue venue = this.venueService.getVenueById(id);
		this.getRequest().setAttribute("venue", venue);
		return "admin/editvenue";
	}

	public VenueService getVenueService() {
		return venueService;
	}

	public void setVenueService(VenueService venueService) {
		this.venueService = venueService;
	}

}

UsersAction

package com.action;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Users;
import com.service.UsersService;
import com.util.PageHelper;

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/users", produces = "text/plain;charset=utf-8")
public class UsersAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private UsersService usersService;

	// 准备添加数据
	@RequestMapping("createUsers.action")
	public String createUsers() {
		return "admin/addusers";
	}

	// 添加数据
	@RequestMapping("addUsers.action")
	public String addUsers(Users users) {
		this.usersService.insertUsers(users);
		return "redirect:/users/createUsers.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteUsers.action")
	public String deleteUsers(String id) {
		this.usersService.deleteUsers(id);
		return "redirect:/users/getAllUsers.action";
	}

	// 批量删除数据
	@RequestMapping("deleteUsersByIds.action")
	public String deleteUsersByIds() {
		String[] ids = this.getRequest().getParameterValues("usersid");
		for (String usersid : ids) {
			this.usersService.deleteUsers(usersid);
		}
		return "redirect:/users/getAllUsers.action";
	}

	// 更新数据
	@RequestMapping("updateUsers.action")
	public String updateUsers(Users users) {
		this.usersService.updateUsers(users);
		return "redirect:/users/getAllUsers.action";
	}

	// 显示全部数据
	@RequestMapping("getAllUsers.action")
	public String getAllUsers(String number) {
		List<Users> usersList = this.usersService.getAllUsers();
		PageHelper.getPage(usersList, "users", null, null, 10, number, this.getRequest(), null);
		return "admin/listusers";
	}

	// 按条件查询数据 (模糊查询)
	@RequestMapping("queryUsersByCond.action")
	public String queryUsersByCond(String cond, String name, String number) {
		Users users = new Users();
		if (cond != null) {
			if ("username".equals(cond)) {
				users.setUsername(name);
			}
			if ("password".equals(cond)) {
				users.setPassword(name);
			}
			if ("realname".equals(cond)) {
				users.setRealname(name);
			}
			if ("sex".equals(cond)) {
				users.setSex(name);
			}
			if ("birthday".equals(cond)) {
				users.setBirthday(name);
			}
			if ("contact".equals(cond)) {
				users.setContact(name);
			}
			if ("address".equals(cond)) {
				users.setAddress(name);
			}
			if ("image".equals(cond)) {
				users.setImage(name);
			}
			if ("regdate".equals(cond)) {
				users.setRegdate(name);
			}
		}

		List<String> nameList = new ArrayList<String>();
		List<String> valueList = new ArrayList<String>();
		nameList.add(cond);
		valueList.add(name);
		PageHelper.getPage(this.usersService.getUsersByLike(users), "users", nameList, valueList, 10, number, this.getRequest(), "query");
		name = null;
		cond = null;
		return "admin/queryusers";
	}

	// 按主键查询数据
	@RequestMapping("getUsersById.action")
	public String getUsersById(String id) {
		Users users = this.usersService.getUsersById(id);
		this.getRequest().setAttribute("users", users);
		return "admin/editusers";
	}

	public UsersService getUsersService() {
		return usersService;
	}

	public void setUsersService(UsersService usersService) {
		this.usersService = usersService;
	}

}

UploadAction

package com.action;

import java.io.File;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import com.util.VeDate;

@Controller
@RequestMapping("/upload")
public class UploadAction {

	@RequestMapping(value = "/image.action")
	public String upload(@RequestParam(value = "image", required = false) MultipartFile file, HttpServletRequest request, ModelMap model) {
		String path = request.getSession().getServletContext().getRealPath("/") + "upfiles/";
		String fileName = file.getOriginalFilename();
		int i = fileName.lastIndexOf(".");
		String name = String.valueOf(VeDate.getStringDatex());
		String type = fileName.substring(i + 1);
		fileName = name + "." + type;
		File targetFile = new File(path, fileName);
		if (!targetFile.exists()) {
			targetFile.mkdirs();
		}

		// 保存
		try {
			file.transferTo(targetFile);
		} catch (Exception e) {
			e.printStackTrace();
		}
		model.addAttribute("imageFileName", fileName);
		return "saveimage";
	}

	@RequestMapping(value = "/files.action")
	public String files(@RequestParam(value = "image", required = false) MultipartFile file, HttpServletRequest request, ModelMap model) {
		String path = request.getSession().getServletContext().getRealPath("/") + "upfiles/";
		String fileName = file.getOriginalFilename();
		int i = fileName.lastIndexOf(".");
		String name = String.valueOf(VeDate.getStringDatex());
		String type = fileName.substring(i + 1);
		fileName = name + "." + type;
		File targetFile = new File(path, fileName);
		if (!targetFile.exists()) {
			targetFile.mkdirs();
		}

		// 保存
		try {
			file.transferTo(targetFile);
		} catch (Exception e) {
			e.printStackTrace();
		}
		model.addAttribute("imageFileName", fileName);
		return "savefile";
	}
}

TicketAction

package com.action;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Ticket;
import com.service.TicketService;
import com.entity.Venue;
import com.service.VenueService;
import com.util.PageHelper;
import com.util.VeDate;

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/ticket", produces = "text/plain;charset=utf-8")
public class TicketAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private TicketService ticketService;
	@Autowired
	@Resource
	private VenueService venueService;

	// 准备添加数据
	@RequestMapping("createTicket.action")
	public String createTicket() {
		List<Venue> venueList = this.venueService.getAllVenue();
		this.getRequest().setAttribute("venueList", venueList);
		return "admin/addticket";
	}

	// 添加数据
	@RequestMapping("addTicket.action")
	public String addTicket(Ticket ticket) {
		ticket.setAddtime(VeDate.getStringDateShort());
		this.ticketService.insertTicket(ticket);
		return "redirect:/ticket/createTicket.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteTicket.action")
	public String deleteTicket(String id) {
		this.ticketService.deleteTicket(id);
		return "redirect:/ticket/getAllTicket.action";
	}

	// 批量删除数据
	@RequestMapping("deleteTicketByIds.action")
	public String deleteTicketByIds() {
		String[] ids = this.getRequest().getParameterValues("ticketid");
		for (String ticketid : ids) {
			this.ticketService.deleteTicket(ticketid);
		}
		return "redirect:/ticket/getAllTicket.action";
	}

	// 更新数据
	@RequestMapping("updateTicket.action")
	public String updateTicket(Ticket ticket) {
		this.ticketService.updateTicket(ticket);
		return "redirect:/ticket/getAllTicket.action";
	}

	// 显示全部数据
	@RequestMapping("getAllTicket.action")
	public String getAllTicket(String number) {
		List<Ticket> ticketList = this.ticketService.getAllTicket();
		PageHelper.getPage(ticketList, "ticket", null, null, 10, number, this.getRequest(), null);
		return "admin/listticket";
	}

	// 按条件查询数据 (模糊查询)
	@RequestMapping("queryTicketByCond.action")
	public String queryTicketByCond(String cond, String name, String number) {
		Ticket ticket = new Ticket();
		if (cond != null) {
			if ("ticketname".equals(cond)) {
				ticket.setTicketname(name);
			}
			if ("venueid".equals(cond)) {
				ticket.setVenueid(name);
			}
			if ("price".equals(cond)) {
				ticket.setPrice(name);
			}
			if ("memo".equals(cond)) {
				ticket.setMemo(name);
			}
			if ("addtime".equals(cond)) {
				ticket.setAddtime(name);
			}
		}

		List<String> nameList = new ArrayList<String>();
		List<String> valueList = new ArrayList<String>();
		nameList.add(cond);
		valueList.add(name);
		PageHelper.getPage(this.ticketService.getTicketByLike(ticket), "ticket", nameList, valueList, 10, number, this.getRequest(), "query");
		name = null;
		cond = null;
		return "admin/queryticket";
	}

	// 按主键查询数据
	@RequestMapping("getTicketById.action")
	public String getTicketById(String id) {
		Ticket ticket = this.ticketService.getTicketById(id);
		this.getRequest().setAttribute("ticket", ticket);
		List<Venue> venueList = this.venueService.getAllVenue();
		this.getRequest().setAttribute("venueList", venueList);
		return "admin/editticket";
	}

	public TicketService getTicketService() {
		return ticketService;
	}

	public void setTicketService(TicketService ticketService) {
		this.ticketService = ticketService;
	}

}