基于SSM的旅游信息管理系统设计与实现

news2024/10/7 16:15:20

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


目录

一、项目简介

二、系统功能

三、系统项目截图

用户信息管理

旅行社信息管理

旅行团管理

新闻信息管理

四、核心代码

登录相关

文件上传

封装


一、项目简介

现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本“游侠”旅游信息管理系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此“游侠”旅游信息管理系统利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的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;
	}
}

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

竞赛选题 深度学习LSTM新冠数据预测

文章目录 0 前言1 课题简介2 预测算法2.1 Logistic回归模型2.2 基于动力学SEIR模型改进的SEITR模型2.3 LSTM神经网络模型 3 预测效果3.1 Logistic回归模型3.2 SEITR模型3.3 LSTM神经网络模型 4 结论5 最后 0 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 …

上位机在自动化中有何作用和优势?

今日话题 上位机在自动化中有何作用和优势&#xff1f; 自动化控制编程领域包括单片机、PLC、机器视觉和运动控制等方向。输入“777”&#xff0c;即刻获取关于上位机开发和数据可视化的专业学习资料&#xff0c;近年来&#xff0c;上位机编程逐渐兴起&#xff0c;正在逐步替…

统信UOS 1060系统自定义恢复

原文链接&#xff1a;统信UOS 1060系统自定义恢复 hello&#xff0c;大家好啊&#xff0c;今天给大家带来关于统信UOS 1060系统备份还原的系列内容的第五篇文章&#xff0c;系统自定义恢复&#xff0c;前期我们对系统进行了多种方式的备份&#xff0c;接下里就开始进行恢复操作…

免费获取天气预报的API接口(Json格式)

免费获取天气预报的API接口&#xff08;Json格式&#xff09; 1、接口地址2、城市代码 1、接口地址 当需要获取某个城市天气数据json时候&#xff0c;需要传入一个城市代码编码作为入参&#xff0c;地址&#xff1a; http://t.weather.itboy.net/api/weather/city/xxxxx &…

【Redis】Zset 有序集合命令

目录 命令ZADDZCARDZRANGEZCOUNTZREVRANGEZRANGEBYSCOREZPOPMAXBZPOPMAXZPOPMINBZPOPMINZRANKZREVRANKZSCOREZREMZREMRANGEBYRANKZREMRANGEBYSCOREZINCRBY 命令 ZADD 添加或者更新指定的元素以及关联的分数到zset中&#xff0c;分数应该符合double类型&#xff0c;inf/-inf作为…

尚硅谷Flink(二)DStream API

目录 &#x1f320;不会点 &#x1fa90;DataStream API ​编辑 &#x1f320; 执行环境 创建执行环境 执行模式 触发程序执行 &#x1f320;源算子 准备基础类型 从集合中读取数据 从文件读取数据 从 Socket 读取数据 从 Kafka 读取数据 &#xff08;没学过&#xff09; …

分享一下便利店怎么做微信小程序

便利店微信小程序开发&#xff0c;让生意更便捷&#xff01; 在这个数字化时代&#xff0c;微信小程序已经成为一种新的生活方式。它不仅改变了人们的消费习惯&#xff0c;还为各行各业提供了无限商机。对于便利店来说&#xff0c;微信小程序是一个绝佳的营销工具&#xff0c;…

docker-machine常用

docker-machine常用 什么是Docker Machine&#xff1f;Docker Machine默认支持的驱动安装kvm驱动 安装和配置Docker Machine环境准备node1安装Dockernode1安装Docker Machine为Docker Machine安装自动补全为Docker Machine准备boot2docker.iso镜像为node2创建machine主机 管理远…

138589-19-2,羧基荧光素-氨基盐酸盐,FAM-NH2.HCl

CAS号&#xff1a;138589-19-2 中文名&#xff1a;羧基荧光素-氨基.盐酸盐 英文名&#xff1a;FAM-NH2.HCl 化学式&#xff1a;C27H26N2O6 分子量&#xff1a;474.51 纯度标准&#xff1a;95% 产品简介&#xff1a;5-FAM-NH2.HCl(羧基荧光素-氨基.盐酸盐)其中异硫氰酸荧光…

点成分享 | 水浴设备在食品生物活性测定中的应用

一、食品加工副产品和废物的再利用 近年来&#xff0c;人们越来越关注食品加工副产物和废物的再利用问题。从环保角度来看&#xff0c;食品加工副产物和废物处理不当会对环境造成严重污染&#xff0c;因为他们降解后会产生难闻气味和大量渗滤液&#xff0c;从而垃圾填埋场也会…

嵌入式 CVR 和 Linux CVR:智能摄像机视频录制器的未来

随着智能监控、智能家居等领域的不断发展&#xff0c;嵌入式 CVR&#xff08;Camera Video Recorder&#xff09;和基于 RV1106/RV1103 芯片的 Linux CVR&#xff08;Camera Video Recorder&#xff09;平台成为了智能摄像机视频录制器的主要解决方案。本文将介绍嵌入式 CVR 的…

使用postMan调试接口出现 Content type ‘multipart/form-data;charset=UTF-8‘ not supported“

使用postMan调试接口出现 Content type multipart/form-data&#xff1b;charsetUTF-8 not supported" 问题原因解决方案 最近好久没写springboot项目了&#xff0c;然后写了一个添加用户的接口&#xff0c;使用postman测试时出现了问题。如下图&#xff1a; org.springfr…

在IDEA中如何用可视化界面操作数据库? 在idea中如何操作数据库? 在idea中如何像Navicat一样操作数据库?

1、找到database&#xff0c;创建连接 我用了中文包&#xff0c;英文状态下和我的操作完全一样 英文下第二列数据库名称为 database 2、配置相关属性&#xff0c;如IP地址&#xff0c;密码等 3、选择对应的库名&#xff0c;此处也叫架构 4、然后就可以进行愉快的操作了

免费chatGPT工具

发现很多人还是找不到好用的chatGPT工具&#xff0c;这里分享一个邮箱注册即可免费试用。 PromptsZone - 一体化人工智能平台使用 PromptsZone 与 ChatGPT、Claude、AI21 Labs、Google Bard 聊天&#xff0c;并使用 DALL-E、Stable Diffusion 和 Google Imagegen 创建图像&…

第三次作业(9.26)

1.判断奇数和偶数 A. num int(input("请输入一个整数&#xff1a;")) if num % 2 0:print("even_nuumber") else:print("odd_number") B. num int(input("请输入一个整数&#xff1a;")) if num & 1 0:print("even_number…

TiDB 7.4 发版:正式兼容 MySQL 8.0

MySQL 是全球最受欢迎的开源数据库&#xff0c;长期位于 DB-Engines Ranking 排行榜第二名&#xff0c;在世界范围内拥有数量庞大的企业用户和开发者。然而&#xff0c;随着时间的推移&#xff0c;MySQL 用户正面临新挑战。Oracle 官宣将在 2023 年 10 月终止 MySQL 5.7 版本的…

java中的接口interface

一、面向对象基本概念 Java是一种面向对象的语言&#xff0c;其中「对象」就相当于是现实世界中的一个个具体的例子&#xff0c;而「类」就相当于是一个抽象的模板&#xff0c;将抽象的概念模板转化为具体的例子的过程就叫做「实例化」。 比如说人这个概念就是一个抽象化的「…

UE4 快速入门 1

安装 https://www.unrealengine.com/zh-CN/download Launcher ue4.23 editor visual studio 2019 社区版 文档学习

EtherCAT 转 CClinkIE 协议网关与三菱CClinkIE通讯方法

远创智控YC-ECTM-CCLKIE网关产品是工业领域的一大神器&#xff0c;它可以通过各种数据接口与仪表、PLC、计量设备等产品进行连接&#xff0c;实时采集这些设备中的运行数据、状态数据等信息。然后&#xff0c;它将采集的数据进行整合、运算等操作后&#xff0c;传输到其他设备或…

网络工程师知识点2

21、VLAN 有什么作用&#xff1f; ①广播控制&#xff1b;②安全性&#xff1b;③增加带宽利用率&#xff1b;④减少延迟。 22、实际的项目中如何划分vlan的&#xff1f; 采用静态VLAN的划分方式&#xff0c;可以按照楼层划分&#xff0c;可以按安装科室划分 23、vlan 的链路…