基于SSM的土家风景文化管理平台

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


前言

基于SSM的土家风景文化管理平台有用户、管理员两大角色:

用户:首页、热门景点、旅游路线、排行榜、网站公告、个人中心、后台管理、在线客服。

管理员:个人中心、用户管理、景点分类管理、热门景点管理、门票订单管理、旅游路线管理、景点评价管理、排行榜管理、系统管理等。 

前台首页

 首先进入我们系统可以看到有首页、热门景点、旅游路线、排行榜、网站公告、个人中心、后台管理、在线客服。

 在首页会有一些热门景点推荐或者网站公告显示在首页上呈现给用户查看。

 在热门景点中,可以查看景点图片或者详情信息又或者可以搜索自己想要查阅的景点。

 在旅游路线中,用户可以查看自己想要去的地方查看路线。

 用户注册页面,输入相关信息并且通过邮箱或者验证码即可注册成功。

 注册成功后可以到返回登录页面进行登录。

 登录后在个人中心,用户可以查看自己的信息并且可以修改。

 用户登录后,可以在选择自己喜欢的景点选择购买门票。

 在线客服功能模块,可以让用户联系系统客服。

管理员功能模块

 管理员后台登录模块。

进入系统后台可以看到管理员功能有:个人中心、用户管理、景点分类管理、热门景点管理、门票订单管理、旅游路线管理、景点评价管理、排行榜管理、系统管理等。 

在用户管理中,管理员可以查看用户信息详情或者删除又或者可以进行修改等操作。

景点分类管理也是如此。

热门景点管理,管理员可以发布新的景点信息或者可以查看删除修改景点信息。 

在门票订单中,管理员可以查看订单统计图。

 网站公告,管理员可以发布公告,让前台用户查阅。


登录模块核心代码


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;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/24567.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

孤儿僵尸守护进程

孤儿僵尸守护进程 1. 孤儿进程&#xff1a;2. 僵尸进程&#xff1a;3. 守护进程&#xff1a;(重点) 1. 孤儿进程&#xff1a; 父进程退出,还没退出的子进程就变成了孤儿进程 不要怕,还有爷爷进程init: 孤儿进程将被init进程所收养&#xff0c;并由init进程对它们完成状态收集…

MySQL主从复制配置

一、MySQL主从概念二、主库配置&#xff08;Master&#xff09;第一步:修改Mysql数据库的配置文件/etc/my.cnf第二步:重启Mysql服务 systemctl restart mysqld第三步:登录Mysql数据库&#xff0c;执行下面SQL第四步:登录Mysql数据库&#xff0c;执行下面SQL&#xff0c;记录下结…

解决node上传文件乱码问题终极方案

问题描述 今天在菜鸟教程学习node上传文件时遇到了一个中文乱码的问题&#xff0c;文件名包含中文就会显示乱码&#xff0c;上传到服务器的文件名也是乱码。试了两个方法都不行&#xff0c;最后还是问了万能的度娘才解决。 我做了一个非常简单的上传文件的界面&#xff0c; …

介绍10款ChatGPT替代产品

ChatGPT 引领着聊天 AI 的世界&#xff0c;许多人已经开始在日常生活中使用它。OpenAI 的 GPT-3 语言模型是聊天机器人的基础&#xff0c;它使得用户能够通过回答问题与 AI 进行交互。 GPT-4 的引入为机器人提供了更强大的功能。然而&#xff0c;它也有一个明显的缺点&#xff…

19-02 基于业务量级的架构技术选型演进

从零开始——单服务应用 单体应用技术选型 &#xff08;GitHub、Gitee…&#xff09;搜索是否有线程的产品用最熟悉的技术&#xff0c;最快的速度上线如果有经费&#xff1a;考虑商业化解决方案 个人小程序怎么做技术选型的 搜索是否有快速搭建下程序的软件技术选型 后端技…

python 网络编程和http协议--网络编程,HTTP协议,Web服务器

一.网络编程 1.IP地址 给网络中的每一台设备进行编号. IPV4 IPV6 2.端口和端口号 端口的作用就是给运行的应用程序提供传输数据的通道。 端口号的作用是用来区分和管理不同端口的&#xff0c;通过端口号能找到唯一个的一个端口。 3.TCP协议 协议: 双方的约定. 网络传输协…

代码线程安全

线程生命周期 synchronized synchronized会自动释放锁 synchronized同步代码块 synchronized后面括号里obj是锁对象(保证唯一)&#xff1b;static修饰的obj对象是自定义MyThread线程类的静态成员变量&#xff0c;该自定义线程类所有实例共享保证锁对象唯一性&#xff1b;另一…

博客系统的后端设计(八) - 实现发布博客功能

文章目录 发布博客1. 约定前后端交互接口2. 服务器代码3. 客户端代码4. 出现的问题 发布博客 在原来的编辑页面点击发布文章按钮&#xff0c;是不会有什么效果的。 这是因为此时还不能实现前后端的交互。 1. 约定前后端交互接口 请求使用 POST&#xff0c;路径是 /blog title这…

Niagara—— Niagara Editor界面

目录 一&#xff0c;菜单栏 二&#xff0c;工具栏 三&#xff0c;预览面板 四&#xff0c;参数面板 五&#xff0c;系统总览面板 六&#xff0c;暂存区面板 七&#xff0c;选择面板 八&#xff0c;时间轴面板 九&#xff0c;曲线面板 十&#xff0c;日志面板 十一&a…

通过js来判断是否是横屏如果是就自刷新页面解决横屏之后只有屏幕一半宽度的问题

判断页面是横屏还是竖屏 window.addEventListener("load", rotate, false);window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", rotate, false);function rotate() {if (window.orientatio…

力扣高频SQL50题(基础版)——第一天

力扣高频SQL50题(基础版)——第一天 1 可回收且低脂的产品 1.1 题目内容 1.1.1 基本题目信息 1.1.2 示例输入输出 1.2 示例sql语句 # WHERE子句中使用多条件 SELECT product_id FROM Products WHERE low_fatsY AND recyclableY1.3 运行截图 2 寻找用户推荐人 2.1 题目内容…

《数据库应用系统实践》------ 小区停车管理系统

系列文章 《数据库应用系统实践》------ 小区停车管理系统 文章目录 系列文章一、需求分析1、系统背景2、 系统功能结构&#xff08;需包含功能结构框图和模块说明&#xff09;3&#xff0e;系统功能简介 二、概念模型设计1&#xff0e;基本要素&#xff08;符号介绍说明&…

第13届蓝桥杯Scratch选拔赛真题集锦

第13届蓝桥杯Scratch选拔赛真题集锦 编程题 第 1 题问答题 跳舞机游戏 题目说明 编程实现 跳舞机游戏。 具体要求: 1).点击绿旗,舞台左上角显示得分0代表玩家分数,在得分右侧倒计时10代表游戏时长(10s) 2).游戏开始倒数计时,在舞台上随机显示上、下、左、右四个箭头中…

SCMA基本原理介绍

SCMA: Sparse Code Multiple Access SCMA基本原理 我们考虑一个同步&#xff08;synchronous&#xff09;的SCMA系统&#xff0c; 含1个基站&#xff08;Base Station, BS&#xff09;&#xff1b; J J J个用户&#xff08;so called layers&#xff09;&#xff1b;K个OFDM…

vue2介绍(入门)

目录 声明式渲染 v-bind v-if条件与循环 name命名 学会log打印 一些js方法 双向绑定v-model和v-bind 那么请实现一个复选框吧 自定义标签模板 声明式渲染 我感觉这里文档的意思是双向绑定&#xff0c; 或许需要清理一下js缓存机制 &#xff0c;嗯...不懂,响应式&…

深入解析Linux C/C++ 编程中的内存泄漏问题

深入解析Linux C/C 编程中的内存泄漏问题 I. 前言 (Introduction)1.1 文章目的与内容概述 (Purpose and Overview of the Content)1.2 重要性和实用性的说明 (Significance and Practicality Explanation)1.3 数据结构与内存泄漏的基本概念 (Basic Concepts of Data Structure …

PDF文件数字证书签名指南

一、安装PDF证书的环境 1.1 PDF证书安装环境 Windows pc 机一台 安装Adobe Acrobat 软件 PDF文档签名证书一张(备注&#xff1a;本指南使用沃通内部文档加密证书进行操作,通用其它版本证书) 1.2 网络环境要求 请确保您签名的电脑可以正常访问外网。 二、PDF证书安装 2.…

数据结构之二叉树的基本实现

在我们之前已经了解的堆这样的完全二叉树的实现&#xff0c;也对树型结构有了一些了解&#xff0c;那么今天我们来看看二叉树的一些性质。 因为二叉树是一种每个节点至多只有两个子树&#xff08;即二叉树的每个节点的度不大于2&#xff09;&#xff0c;并且二叉树的子树有左右…

Shell脚本攻略:shell函数应用

目录 一、理论 1.shell函数 2.函数传参 3.函数变量的作用范围 4.递归 5.函数位置变量与脚本位置变量区别 6.创建库 二、实验 1.实验一 一、理论 1.shell函数 &#xff08;1&#xff09;概念 将命令序列按格式写在一起&#xff0c;可方便重复使用命令序列。 ① 避免…

Docker容器与虚拟机(VM)大对比

Docker是一个开源应用容器引擎。Docker可以将应用程序与基本架构分开&#xff0c;从而快速交付软件。 传统虚拟机的运行需要占用较高的资源&#xff0c;包括磁盘空间、内存和处理器性能。每个虚拟机都需要完整的操作系统和应用程序副本&#xff0c;这在资源利用和启动时间上存…