大家好!我是程序员一帆,感谢您阅读本文,欢迎一键三连哦。
💞当前专栏:Java毕业设计
精彩专栏推荐👇🏻👇🏻👇🏻
开发环境
- 开发语言:Java
- 框架:ssm
- JDK版本:JDK1.8
- 服务器:tomcat7
- 数据库:mysql 5.7
- 数据库工具:Navicat12
- 开发软件:eclipse/myeclipse/idea
- Maven包:Maven3.3.9
- 浏览器:谷歌浏览器
源码下载地址:
https://download.csdn.net/download/2301_76953549/89117261
论文目录
【如需全文请按文末获取联系】
一、项目简介
本基于Java Web的在线电影票购买系统采用Java语言和Vue技术,框架采用SSM,搭配MySQL数据库,运行在Idea里。本基于Java Web的在线电影票购买系统提供管理员、用户两种角色的服务。总的功能包括电影的查询、电影票的购买、评价和订单管理。本系统可以帮助管理员更新电影信息和管理订单信息,帮助用户实现在线的购票方式,并可以实现选座。
二、系统设计
2.1软件功能模块设计
本基于Java Web的在线电影票购买系统的功能结构设计图如下图3-1所示:
2.2数据库设计
(1)管理员的ER图中的属性有账号、密码、权限。管理员ER图如下图3-2所示:
(2)用户的ER图里的属性有性别、姓名、编号等,用户的ER图如下图3-3所示:
(3)电影的ER图里的属性有电影编号、价格、主演、图片等,电影的ER图如下图3-4所示:
(4)订单的ER图里的属性有订单人、编号、订单时间、电影等,订单ER图如下图3-5所示:
三、系统项目部分截图
3.1管理员权限的功能实现
用户信息管理功能的详细实现
管理员负责用户信息的审核和管理,用户的账号和密码都可以由管理员在此功能里看到。管理员查询用户信息的功能实现如下图4-2所示:
电影管理功能的详细实现
管理员可以对电影的信息进行发布和修改、删除。本功能可以实现电影的定时更新和审核管理。管理员查询电影信息的实现界面如下图4-3所示:
电影订单管理功能的详细实现
管理员可以管理用户的订单,用户是否付款也可以在该功能里看到。电影订单管理功能的实现界面如下图4-6所示:
3.2用户权限的功能详细实现
电影查询功能的详细实现
用户可以根据电影的发布时间查询电影信息。用户查询电影的界面实现如下图4-10所示:
在线选座功能的详细实现
用户在想要购买电影票时可以选择自己想坐的座位,已选择的座位以绿色表示,未选择的座位以灰色表示。在线选座功能的实现界面如下图4-11所示:
用户注册功能的详细实现
非用户可以在注册功能里实现成为用户。在注册界面里按照要求填写信息就可以完成。用户注册的实现界面如下图4-13所示:
四、部分核心代码
package com.controller;
import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;
/**
* 电影评价
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/dianyingCommentback")
public class DianyingCommentbackController {
private static final Logger logger = LoggerFactory.getLogger(DianyingCommentbackController.class);
@Autowired
private DianyingCommentbackService dianyingCommentbackService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表service
@Autowired
private DianyingService dianyingService;
@Autowired
private YonghuService yonghuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
PageUtils page = dianyingCommentbackService.queryPage(params);
//字典表数据转换
List<DianyingCommentbackView> list =(List<DianyingCommentbackView>)page.getList();
for(DianyingCommentbackView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
DianyingCommentbackEntity dianyingCommentback = dianyingCommentbackService.selectById(id);
if(dianyingCommentback !=null){
//entity转view
DianyingCommentbackView view = new DianyingCommentbackView();
BeanUtils.copyProperties( dianyingCommentback , view );//把实体数据重构到view中
//级联表
DianyingEntity dianying = dianyingService.selectById(dianyingCommentback.getDianyingId());
if(dianying != null){
BeanUtils.copyProperties( dianying , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setDianyingId(dianying.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(dianyingCommentback.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody DianyingCommentbackEntity dianyingCommentback, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,dianyingCommentback:{}",this.getClass().getName(),dianyingCommentback.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
else if("用户".equals(role))
dianyingCommentback.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
dianyingCommentback.setInsertTime(new Date());
dianyingCommentback.setCreateTime(new Date());
dianyingCommentbackService.insert(dianyingCommentback);
return R.ok();
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody DianyingCommentbackEntity dianyingCommentback, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,dianyingCommentback:{}",this.getClass().getName(),dianyingCommentback.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
// else if("用户".equals(role))
// dianyingCommentback.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
//根据字段查询是否有相同数据
Wrapper<DianyingCommentbackEntity> queryWrapper = new EntityWrapper<DianyingCommentbackEntity>()
.eq("id",0)
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
DianyingCommentbackEntity dianyingCommentbackEntity = dianyingCommentbackService.selectOne(queryWrapper);
dianyingCommentback.setUpdateTime(new Date());
if(dianyingCommentbackEntity==null){
dianyingCommentbackService.updateById(dianyingCommentback);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
dianyingCommentbackService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save( String fileName, HttpServletRequest request){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
List<DianyingCommentbackEntity> dianyingCommentbackList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
if(!".xls".equals(suffix)){
return R.error(511,"只支持后缀为xls的excel文件");
}else{
URL resource = this.getClass().getClassLoader().getResource("../../upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
if(!file.exists()){
return R.error(511,"找不到上传文件,请联系管理员");
}else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for(List<String> data:dataList){
//循环
DianyingCommentbackEntity dianyingCommentbackEntity = new DianyingCommentbackEntity();
// dianyingCommentbackEntity.setDianyingId(Integer.valueOf(data.get(0))); //电影 要改的
// dianyingCommentbackEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的
// dianyingCommentbackEntity.setDianyingCommentbackText(data.get(0)); //评价内容 要改的
// dianyingCommentbackEntity.setInsertTime(date);//时间
// dianyingCommentbackEntity.setReplyText(data.get(0)); //回复内容 要改的
// dianyingCommentbackEntity.setUpdateTime(sdf.parse(data.get(0))); //回复时间 要改的
// dianyingCommentbackEntity.setCreateTime(date);//时间
dianyingCommentbackList.add(dianyingCommentbackEntity);
//把要查询是否重复的字段放入map中
}
//查询是否重复
dianyingCommentbackService.insertBatch(dianyingCommentbackList);
return R.ok();
}
}
}
}catch (Exception e){
e.printStackTrace();
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = dianyingCommentbackService.queryPage(params);
//字典表数据转换
List<DianyingCommentbackView> list =(List<DianyingCommentbackView>)page.getList();
for(DianyingCommentbackView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
DianyingCommentbackEntity dianyingCommentback = dianyingCommentbackService.selectById(id);
if(dianyingCommentback !=null){
//entity转view
DianyingCommentbackView view = new DianyingCommentbackView();
BeanUtils.copyProperties( dianyingCommentback , view );//把实体数据重构到view中
//级联表
DianyingEntity dianying = dianyingService.selectById(dianyingCommentback.getDianyingId());
if(dianying != null){
BeanUtils.copyProperties( dianying , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setDianyingId(dianying.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(dianyingCommentback.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody DianyingCommentbackEntity dianyingCommentback, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,dianyingCommentback:{}",this.getClass().getName(),dianyingCommentback.toString());
dianyingCommentback.setInsertTime(new Date());
dianyingCommentback.setCreateTime(new Date());
dianyingCommentbackService.insert(dianyingCommentback);
return R.ok();
}
}
获取源码或论文
如需对应的论文或源码,以及其他定制需求,也可以下方微❤联系。