基于SSM+Vue的亿互游在线平台的设计与开发

2023-09-21 17:53:38

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:采用Vue技术开发
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能

三、系统项目截图

用户功能模块的实现

管理员功能模块的实现 

前台工作人员功能模块的实现 

四、核心代码

登录相关

文件上传

封装

五、总结 


一、项目简介

随着旅游业的迅速发展,传统的旅游资讯查询方式,已经无法满足用户需求,因此,结合计算机技术的优势和普及,特开发了本亿互游在线平台。

本文研究的亿互游在线平台基于SSM框架,采用JSP技术、Java语言和MYSQL数据库设计开发。通过本系统,满足了不同权限用户的需求,包括管理员、用户和前台,用户通过本系统可查看旅游信息,注册登录后还可进行酒店预订、美食购买等,前台注册登录后可实现景点信息管理、路线规划管理、景点美食管理以及住宿信息管理功能,管理员可登录系统后台对系统进行全面管理,确保系统正常稳定运行,更好的为用户服务。

本系统经过测试,运行效果稳定,操作方便、快捷,是一个功能全面、实用性好、安全性高,并具有良好的可扩展性、可维护性的亿互游在线平台。


二、系统功能

系统结构设计是整个系统设计中重要的一部分,在结构设计过程中,首先对系统进行需求分析,然后进行系统初步设计,将系统功能模块细化,具体分析每一个功能模块具体应该首先哪些功能,最后将各个模块进行整合,实现系统结构的最终设计。



三、系统项目截图

用户功能模块的实现

 

 

 

 

管理员功能模块的实现 

 

 

 

前台工作人员功能模块的实现 

 

 


四、核心代码

登录相关


package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

文件上传

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.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 org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;

/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

封装

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}

	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

五、总结 

通过自己为期数周的不间断努力,该亿互游在线平台的开发与设计终于接近尾声了。在网站开发过程中,让我体验了其中的苦与乐,学会了如何面临困难,如何解决问题,达到了锻炼的目的。同时,拓展了知识面,进一步加深了对软件开发的理解和认识。

在做毕业设计之前,我对亿互游在线平台的理解,是停留在感官和理论水平上的,是“纸上谈兵”,虽然有一定的了解,但是总体说概念和思路并不是很明确、清楚。并且缺乏实际的开发经验。这次通过该亿互游在线平台毕业设计的制作,真正给我了一次难得的锻炼机会。在整个开发过程中,遇到了很多问题,但“功夫不负有心人”,通过向指导老师、同学及上网有技术大牛交流等方法。最终,问题都被一一解决了。

在设计的过程中,后台编程方面,我个人有很大欠缺,在指导老师的推荐下,我也查阅了很多相关资料和文章,。我增长了很多知识和见解,进一步熟悉了编程、网页制作的方法以及网页制作工具的使用。通过分析,画出了网站的流程图,并且掌握了网站设计的基本步骤和方法,经历了网站规划、网站分析、网站设计等阶段。更正了以前对网站的错误认识。懂得了网站的开发与设计是网站后期维护方便与否的至关重要的因素,而且进一步理解了眼高手低的讽刺意义。课程设计过程中,因为缺少经验,出现了很多之前没预料到的问题,程序这方面大家都知道,有个字符拼写错误,程序就很可能运行不成功,这次毕业设计又一次让我真切的意识到:细心,才能事半功倍。总体看来,此网站基本达到毕业设计的内容要求,但是由于我个人能力有限,有些问题自己虽然已发现,考虑到时间及个人技术,部分问题尚未得到解决,网站仍存在许多缺点和不足。在调试过程中出现的部分问题还没能完全解决,只是避免了问题的出现。另外,对网站的制作速度太慢,工具的使用还不熟练,还有待于改善和提高。

更多推荐

(21)多线程实例应用:双色球(6红+1蓝)

一、需求1.双色球:投注号码由6个红色球号码和1个蓝色球号码组成。2.红色球号码从01--33中选择,红色球不能重复。3.蓝色球号码从01--16中选择。4.最终结果7个号码:6+1;即33选6(红)+16选1(蓝)5.产品:能用;用户放心使用;原则:靠运气,不能有暗箱操作,号码开奖的随机性。6.做法思路:(1)从左往

短视频矩阵源码系统

一、什么是短视频矩阵源码?短视频矩阵源码是一种基于短视频平台的软件程序,它可以帮助用户在多个短视频平台上进行短视频营销。短视频矩阵源码包含了多种功能,例如短视频上传、短视频批量管理、短视频数据分析等等。用户可以根据自己的需求,选择不同的功能来实现短视频营销的目标。二、短视频矩阵源码的优势是什么?节省时间和人力成本:短视

智能热水器丨打造智能家居新体验

随着科学技术的不断发展,智能电器越来越被大众所采纳,如智能扫地机,智能洗衣机,智能微波炉等等,越来越智能的电器为人们的生活带来了许多便利。以往的热水器一般都是只有按键/机械的控制方式,没有其他无线控制的控制方式。但现在新增了语音功能控制。用户通过语音控制智能热水器进行加热或保温等操作,无需用户手动控制;为人们带来了全新

微信小程序隐私授权

微信开发者平台新公告:2023年9月15之后,隐私协议将被启用,所以以后的小程序都要加上隐私协议的内容提示用户,首先设置好隐私协议的内容,登录小程序的开发者后台,在设置--》服务内容声明--》用户隐私保护指引,点击右侧的“更新”,可以在线编辑隐私协议内容,编辑完保存;然后在代码中创建一个components文件夹,用来

【ELK】日志系统&部署

一、ELK日志分析系统1、ELK的组成ElasticSearchLogStashKibanaELK基于这三个开源日志的收集、存储、检索和可视化的解决方案;可帮助用户快速定位和分析应用程序的故障,监控应用程序性能和安全,以及提供丰富的数据分析和展示功能。2、完整日志系统特征ELK是一个完整的处理分析日志的系统收集:能够采

ELK企业级日志分析系统

1.ELKELK概述ELK平台是一套完整的日志集中处理解决方案,将ElasticSearch、Logstash和Kiabana三个开源工具配合使用,完成更强大的用户对日志的查询、排序、统计需求ElasticSearch是基于Lucene(一个全文检索引擎的架构)开发的分布式存储检索引擎,用来存储各类日志。Elastic

ELK 企业级日志分析系统

1、ELK简介ELK平台是一套完整的日志集中处理解决方案,将ElasticSearch、Logstash和Kiabana三个开源工具配合使用,完成更强大的用户对日志的查询、排序、统计需求。ElasticSearch:是基于Lucene(一个全文检索引擎的架构)开发的分布式存储检索引擎,用来存储各类日志。Elastics

LabVIEW开发基于物联网的多功能功率分析仪

LabVIEW开发基于物联网的多功能功率分析仪根据技术规则,电气元件网络中的单个被创建为在标称正弦波振动制造频率下运行。失真顺序的电流和电压波与正弦波不同,它们或多或少地扭曲成形状。它是由交流网络中非线性组件的存在引起的,例如静态转换器、旋转电气设备和电力变压器。由于其独特的特性,包含功率开关静态转换器的电流消费者是网

68、Spring Data JPA 的 方法名关键字查询(全自动,既不需要提供sql语句,也不需要提供方法体)

1、方法名关键字查询(全自动,既不需要提供sql语句,也不需要提供方法体)2、@Query查询(半自动:提供SQL或JPQL查询)3、自定义查询(全手动)★方法名关键字查询(全自动)(1)继承CrudRepository接口的DAO组件可按特定规则来定义查询方法,只要这些查询方法的方法名遵守特定的规则,SpringDa

如何进行性能测试

文章目录前言什么是性能测试为什么要做性能测试怎么做我们的性能测试SoloPiSoloPi的介绍和安装SoloPi的性能数据前言随着科学技术的迅速发展,信息时代离不开软件,软件的成功上线离不开软件测试的功劳,因此软件测试对于软件的重要性不言而喻。性能测试作为软件测试中的一部分,通过自动化测试工具模拟多种正常、峰值以及异常

Flutter实现地图上汇聚到一点的效果。

要求效果:实现的效果:代码:选择点的界面:import'dart:math';import'package:flutter/material.dart';import'package:get/get.dart';import'package:kq_flutter_widgets/widgets/animate/mapC

热文推荐