SpringBoot在线订票系统设计与实现+文档报告

博主介绍:✌在职Java研发工程师、专注于程序设计、源码分享、技术交流、专注于Java技术领域和毕业设计

项目名称

SpringBoot在线订票系统设计与实现+文档报告

视频演示

SpringBoot在线订票系统设计与实现_哔哩哔哩_bilibili

系统介绍

 

需求分析是所有软件开发当中最为重要的功能之一,如果没有和需求方沟通好需求就会出现功能不符合预计的情况。良好的需求分析需要根据需求来推导出具体的功能模块,并且主要将功能模块的设计反向对需求进行补充,形成一个闭环的方式,并且每一个需求和功能需要环环相扣。在Web系统的功能分析当中,需要明确的是系统用户的所有功能模块并且明确它们的联系,并且还需要对系统的角色进行划分从而明确系统的功能权限用以设计前端页面。

系统当中主要是含有三种角色分类,分别是用户、游客以及管理员。它们的功能详情如下所示:

  1. 游客

游客是代表没有经过注册登录的用户,该类用户可以浏览推荐的电影信息,查看电影院信息等等,包括了注册、电影院以及电影浏览、评论查看、新闻阅读的基础功能。如下图3.1所示:

图3.1游客用例图

  1. 注册用户

通过点击用户注册并且注册成功的用户,再次登录成功后可以浏览电影院和电影信息,还可以直接在线上进行订票,电影的评论等等,功能主要包括了:支付、评论、电影简介、登录注册、新闻浏览、影院查询、电影列表、电影详情、关于我们、联系我们、诚聘英才、法律声明、移动端使用、地图选影院、充值功能、合作伙伴等。如下图3.2所示:

图3.2 注册用户用例图

  1. 系统管理员

管理员负责系统所有的基础数据管理,包括了系统的基础数据设置、订单支付管理、用户管理、电影及排片管理、影院管理、影厅管理、新闻资讯、地域管理如下图3.3所示:

图3.3 系统管理员用例图

本系统的角色用例图主要分为了游客、用户以及系统管理员,通过以上对各个角色的功能分析,最终确定了系统总体的用例图如下图3.4所示:
图3.4 系统总体用例图需求分析是所有软件开发当中最为重要的功能之一,如果没有和需求方沟通好需求就会出现功能不符合预计的情况。良好的需求分析需要根据需求来推导出具体的功能模块,并且主要将功能模块的设计反向对需求进行补充,形成一个闭环的方式,并且每一个需求和功能需要环环相扣。在Web系统的功能分析当中,需要明确的是系统用户的所有功能模块并且明确它们的联系,并且还需要对系统的角色进行划分从而明确系统的功能权限用以设计前端页面。
系统当中主要是含有三种角色分类,分别是用户、游客以及管理员。它们的功能详情如下所示:

  1. 游客

游客是代表没有经过注册登录的用户,该类用户可以浏览推荐的电影信息,查看电影院信息等等,包括了注册、电影院以及电影浏览、评论查看、新闻阅读的基础功能。如下图3.1所示:

图3.1游客用例图

  1. 注册用户

通过点击用户注册并且注册成功的用户,再次登录成功后可以浏览电影院和电影信息,还可以直接在线上进行订票,电影的评论等等,功能主要包括了:支付、评论、电影简介、登录注册、新闻浏览、影院查询、电影列表、电影详情、关于我们、联系我们、诚聘英才、法律声明、移动端使用、地图选影院、充值功能、合作伙伴等。如下图3.2所示:

图3.2 注册用户用例图

  1. 系统管理员

管理员负责系统所有的基础数据管理,包括了系统的基础数据设置、订单支付管理、用户管理、电影及排片管理、影院管理、影厅管理、新闻资讯、地域管理如下图3.3所示:

图3.3 系统管理员用例图

本系统的角色用例图主要分为了游客、用户以及系统管理员,通过以上对各个角色的功能分析,最终确定了系统总体的用例图如下图3.4所示:

图3.4 系统总体用例图

环境需要

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

使用说明

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/ 登录

运行截图

 用户管理控制层:

package com.houserss.controller;

import javax.servlet.http.HttpSession;

import org.apache.commons.lang3.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 com.houserss.common.Const;
import com.houserss.common.Const.Role;
import com.houserss.common.ServerResponse;
import com.houserss.pojo.User;
import com.houserss.service.IUserService;
import com.houserss.service.impl.UserServiceImpl;
import com.houserss.util.MD5Util;
import com.houserss.util.TimeUtils;
import com.houserss.vo.DeleteHouseVo;
import com.houserss.vo.PageInfoVo;

/**
 * Created by admin
 */
@Controller
@RequestMapping("/user/")
public class UserController {
    @Autowired
    private IUserService iUserService;

    /**
     * 用户登录
     * @param username
     * @param password
     * @param session
     * @return
     */
    @RequestMapping(value = "login.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse<User> login(User user,String uvcode, HttpSession session){
        String code = (String)session.getAttribute("validationCode");
        if(StringUtils.isNotBlank(code)) {
            if(!code.equalsIgnoreCase(uvcode)) {
                return ServerResponse.createByErrorMessage("验证码不正确");
            }
        }
        ServerResponse<User> response = iUserService.login(user.getUsername(),user.getPassword());
        if(response.isSuccess()){
            session.setAttribute(Const.CURRENT_USER,response.getData());
        }
        return response;
    }

  
    
    
}

管理员管理控制层:


package com.sxl.controller.admin;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.sxl.controller.MyController;

@Controller("adminController")
@RequestMapping(value = "/admin")
public class AdminController extends MyController {
	

	@RequestMapping(value = "/index")
	public String frame(Model model, HttpServletRequest request)throws Exception {
		return "/admin/index";
	}
	
	@RequestMapping(value = "/main")
	public String main(Model model, HttpServletRequest request)throws Exception {
		return "/admin/main";
	}
	
	@RequestMapping(value = "/tj1")
	public String tj1(Model model, HttpServletRequest request)throws Exception {
		String sql="select DATE_FORMAT(insertDate,'%Y-%m-%d') dates,sum(allPrice) price from t_order order by DATE_FORMAT(insertDate,'%Y-%m-%d')  desc";
		List<Map> list = db.queryForList(sql);
		model.addAttribute("list", list);
		System.out.println(list);
		return "/admin/tj/tj1";
	}
	
	
	@RequestMapping(value = "/password")
	public String password(Model model, HttpServletRequest request)throws Exception {
		return "/admin/password";
	}
	
	
	@RequestMapping(value = "/changePassword")
	public ResponseEntity<String> loginSave(Model model,HttpServletRequest request,String oldPassword,String newPassword) throws Exception {
		Map admin = getAdmin(request);
		if(oldPassword.equals(admin.get("password").toString())){
			String sql="update t_admin set password=? where id=?";
			db.update(sql, new Object[]{newPassword,admin.get("id")});
			return renderData(true,"1",null);
		}else{
			return renderData(false,"1",null);
		}
	}
}

修改密码业务逻辑:


package com.sxl.controller.admin;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.sxl.controller.MyController;

@Controller("userController")
@RequestMapping(value = "/user")
public class UserController extends MyController {
	

	@RequestMapping(value = "/index")
	public String frame(Model model, HttpServletRequest request)throws Exception {
		return "/user/index";
	}
	
	@RequestMapping(value = "/main")
	public String main(Model model, HttpServletRequest request)throws Exception {
		return "/user/main";
	}
	
	
	@RequestMapping(value = "/password")
	public String password(Model model, HttpServletRequest request)throws Exception {
		return "/user/password";
	}
	
	
	@RequestMapping(value = "/changePassword")
	public ResponseEntity<String> loginSave(Model model,HttpServletRequest request,String oldPassword,String newPassword) throws Exception {
		Map user = getUser(request);
		if(oldPassword.equals(user.get("password").toString())){
			String sql="update t_user set password=? where id=?";
			db.update(sql, new Object[]{newPassword,user.get("id")});
			return renderData(true,"1",null);
		}else{
			return renderData(false,"1",null);
		}
	}
	@RequestMapping(value = "/mine")
	public String mine(Model model, HttpServletRequest request)throws Exception {
Map user =getUser(request);Map map = db.queryForMap("select * from t_user where id=?",new Object[]{user.get("id")});model.addAttribute("map", map);		return "/user/mine";
	}
	
	

	@RequestMapping(value = "/mineSave")
	public ResponseEntity<String> mineSave(Model model,HttpServletRequest request,Long id
		,String username,String password,String name,String gh,String mobile) throws Exception{
		int result = 0;
			String sql="update t_user set name=?,gh=?,mobile=? where id=?";
			result = db.update(sql, new Object[]{name,gh,mobile,id});
		if(result==1){
			return renderData(true,"操作成功",null);
		}else{
			return renderData(false,"操作失败",null);
		}
	}
	}

通用管理模块:

package com.sxl.controller;


import java.nio.charset.Charset;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;

import com.sxl.util.JacksonJsonUtil;
import com.sxl.util.StringUtil;
import com.sxl.util.SystemProperties;


public class BaseController {
	public static final Long EXPIRES_IN = 1000 * 3600 * 24 * 1L;// 1天

	@Autowired
	private SystemProperties systemProperties;

	/**
	 * 获得配置文件内容
	 */
	public String getConfig(String key) {
		return systemProperties.getProperties(key);
	}

	/**
	 * 返回服务器地址 like http://192.168.1.1:8441/UUBean/
	 */
	public String getHostUrl(HttpServletRequest request) {
		String hostName = request.getServerName();
		Integer hostPort = request.getServerPort();
		String path = request.getContextPath();

		if (hostPort == 80) {
			return "http://" + hostName + path + "/";
		} else {
			return "http://" + hostName + ":" + hostPort + path + "/";
		}
	}

	/***
	 * 获取当前的website路径 String
	 */
	public static String getWebSite(HttpServletRequest request) {
		String returnUrl = request.getScheme() + "://"
				+ request.getServerName();

		if (request.getServerPort() != 80) {
			returnUrl += ":" + request.getServerPort();
		}

		returnUrl += request.getContextPath();

		return returnUrl;
	}



	/**
	 * 初始化HTTP头.
	 * 
	 * @return HttpHeaders
	 */
	public HttpHeaders initHttpHeaders() {
		HttpHeaders headers = new HttpHeaders();
		MediaType mediaType = new MediaType("text", "html",
				Charset.forName("utf-8"));
		headers.setContentType(mediaType);
		return headers;
	}

	/**
	 * 返回 信息数据
	 * 
	 * @param status
	 * @param msg
	 * @return
	 */
	public ResponseEntity<String> renderMsg(Boolean status, String msg) {
		if (StringUtils.isEmpty(msg)) {
			msg = "";
		}
		String str = "{\"status\":\"" + status + "\",\"msg\":\"" + msg + "\"}";
		ResponseEntity<String> responseEntity = new ResponseEntity<String>(str,
				initHttpHeaders(), HttpStatus.OK);
		return responseEntity;
	}

	/**
	 * 返回obj数据
	 * 
	 * @param status
	 * @param msg
	 * @param obj
	 * @return
	 */
	public ResponseEntity<String> renderData(Boolean status, String msg,
			Object obj) {
		if (StringUtils.isEmpty(msg)) {
			msg = "";
		}
		StringBuffer sb = new StringBuffer();
		sb.append("{");
		sb.append("\"status\":\"" + status + "\",\"msg\":\"" + msg + "\",");
		sb.append("\"data\":" + JacksonJsonUtil.toJson(obj) + "");
		sb.append("}");

		ResponseEntity<String> responseEntity = new ResponseEntity<String>(
				sb.toString(), initHttpHeaders(), HttpStatus.OK);
		return responseEntity;
	}


	/***
	 * 获取IP(如果是多级代理,则得到的是一串IP值)
	 */
	public static String getIpAddr(HttpServletRequest request) {
		String ip = request.getHeader("x-forwarded-for");
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("Proxy-Client-IP");
		}

		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("WL-Proxy-Client-IP");
		}

		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getRemoteAddr();
		}

		if (ip != null && ip.length() > 0) {
			String[] ips = ip.split(",");
			for (int i = 0; i < ips.length; i++) {
				if (!"unknown".equalsIgnoreCase(ips[i])) {
					ip = ips[i];
					break;
				}
			}
		}

		return ip;
	}

	/**
	 * 国际化获得语言内容
	 * 
	 * @param key
	 *            语言key
	 * @param args
	 * @param argsSplit
	 * @param defaultMessage
	 * @param locale
	 * @return
	 */
	public static String getLanguage(String key, String args, String argsSplit,
			String defaultMessage, String locale) {
		String language = "zh";
		String contry = "cn";
		String returnValue = defaultMessage;

		if (!StringUtil.isEmpty(locale)) {
			try {
				String[] localeArray = locale.split("_");
				language = localeArray[0];
				contry = localeArray[1];
			} catch (Exception e) {
			}
		}

		try {
			ResourceBundle resource = ResourceBundle.getBundle("lang.resource",
					new Locale(language, contry));
			returnValue = resource.getString(key);
			if (!StringUtil.isEmpty(args)) {
				String[] argsArray = args.split(argsSplit);
				for (int i = 0; i < argsArray.length; i++) {
					returnValue = returnValue.replace("{" + i + "}",
							argsArray[i]);
				}
			}
		} catch (Exception e) {
		}

		return returnValue;
	}
}

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
1 Introduction 简介 1.1 Purpose 目的 影院售票系统的开发目的是使影院售票模式从手工记录转变成信息管理,为影院售票人员提供方便条件。用户也可以轻松地在家都可以操作查找影片、订票、退票等功能。对电影院的实际情况进行调研之后,进行详细的需求分析,对现有的管理模式进行改进,开发出一套新型的管理系统,从中领悟系统开发的思想,掌握系统开发的流程和方法。随着电影院信息系统的不断完善,电影院售票的管理将越来越依赖于信息化的管理。所以系统开发将围绕电影院售票工作的实际情况,使之能迅速适应电影院售票的需要。 影院售票系统的实施的现实意义是减少管理售票的工作人员;管理人员可以随时浏览查看,而且更加直观;改变了以前手工记录的方式,电脑录入更加方便快捷;实现了影院售票的计算机化。 1.2 Scope 范围 本系统适应于全国各大影院 2General description 总体概述 定位:该项目为系统应用软件 风格:窗口 用户人群:电影爱好者 产品:该课程设计在实验过程中需要在window系统下运行 2.1 Soft perspective 软件概述 2.1.1 About the Project 项目介绍 在当今世界电脑普及的时刻,电脑能为我们做更多的事了。过往如果我们想在电影院看最新上映的电影的时候,我们不得不将大部分时间和精力花费在排队购买电影票上,既费时又费力,那种等待让人心烦。为了解决买票的问题,我们完全能通过电脑跟互联网来完成,本系统就是根据此需求进行开发和设计的。我们开发一个满足用户需求,为用户提供便捷服务的安全稳定的在线电影购票订票系统在线电影购票系统是为了提高劳动的效率、节约成本、提高服务质量,方便电影售票和客户购买。在线电影售票系统涉及到未注册用户注册、注册用户登录、查询电影、创建订单、付款等功能,并且还有对数据库进行管理和操作,总体实现项目的任务。系统角色共分为未注册用户、注册用户和管理员这三种,各自对应着相应的任务,实现功能。
基于Spring Boot在线商城系统的设计实现,需要考虑以下几个方面: 1. 数据库设计:商城系统需要存储大量的商品信息、订单信息、用户信息等,需要设计合理的数据库表结构,同时需要考虑数据的存储和访问效率。 2. 业务逻辑:商城系统需要实现商品的浏览、搜索、下单、支付、退款等功能,需要对业务逻辑进行详细的分析和设计。 3. 系统架构:商城系统需要考虑高并发、高可用等问题,需要设计合理的系统架构,包括负载均衡、缓存、分布式存储等。 4. 安全性:商城系统需要考虑用户信息的安全性,包括用户密码加密、防止SQL注入、防止XSS攻击等。 5. 接口设计:商城系统需要提供一些API接口给第三方开发者使用,需要设计合理的接口,同时需要考虑接口的安全性和使用效率。 基于以上几个方面,以下是一个简要的实现步骤: 1. 数据库设计:根据需求分析,设计出商品表、订单表、用户表等数据库表结构,并且进行合理的索引设计和数据关联设计。 2. 业务逻辑:根据需求分析,实现商品的浏览、搜索、下单、支付、退款等业务逻辑,并且进行合理的逻辑划分,提高代码的可维护性。 3. 系统架构:使用Spring Boot作为Web框架,使用Nginx进行反向代理和负载均衡,使用Redis进行缓存,使用MySQL进行数据存储等。 4. 安全性:使用Spring Security进行用户认证和授权,使用BCrypt进行密码加密,使用防火墙等安全措施防止攻击。 5. 接口设计:根据需求分析,设计实现合理的API接口,同时进行接口安全控制和接口文档编写。 以上是基于Spring Boot在线商城系统的简要设计实现步骤。当然,具体实现还需要结合实际需求和系统规模进行详细设计

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

全职计算机毕业设计

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值