基于SpringBoot的校园社团信息管理系统

news2024/10/6 10:38:09

目录

前言

 一、技术栈

二、系统功能介绍

学生管理

社长管理

社团信息管理

社团新闻管理

社团添加

社团活动

加入社团

三、核心代码

1、登录模块

 2、文件上传模块

3、代码封装


前言

随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。本文介绍了校园社团信息管理系统的开发全过程。通过分析校园社团信息管理系统管理的不足,创建了一个计算机管理校园社团信息管理系统的方案。文章介绍了校园社团信息管理系统的系统分析部分,包括可行性分析等,系统设计部分主要介绍了系统功能设计和数据库设计。

本校园社团信息管理系统管理员功能有个人中心,学生管理,社长管理,社团分类管理,社团信息管理,加入社团管理,社团成员管理,社团活动管理,活动报名管理,系统管理等。社长添加社团,管理员审核社团,学生加入社团,社长审核社团。因而具有一定的实用性。

本站是一个B/S模式系统,采用Spring Boot框架,MYSQL数据库设计开发,充分保证系统的稳定性。系统具有界面清晰、操作简单,功能齐全的特点,使得校园社团信息管理系统管理工作系统化、规范化。本系统的使用使管理人员从繁重的工作中解脱出来,实现无纸化办公,能够有效的提高校园社团信息管理系统管理效率。

 一、技术栈

末尾获取源码
SpringBoot+Vue+JS+ jQuery+Ajax...

二、系统功能介绍

学生管理

校园社团信息管理系统的系统管理员可以管理学生,可以对学生信息修改删除以及查询操作。

社长管理

系统管理员可以查看对社长信息进行修改,删除以及查询操作。

 

社团信息管理

系统管理员可以对社团信息进行添加修改删除操作。

社团新闻管理

系统管理员可以对社团新闻进行添加修改删操作。        

 

社团添加

社长创建社团,等待管理员审核。

社团活动

社长创建社团活动,等待管理员审核。

 

加入社团

学生用户可以社团界面加入社团,等待社长审核。

三、核心代码

1、登录模块

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

 2、文件上传模块

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

3、代码封装

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/1077022.html

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

相关文章

Linux---进程(1)

操作系统 传统的计算机系统资源分为硬件资源和软件资源。硬件资源包括中央处理器&#xff0c;存储器&#xff0c;输入设备&#xff0c;输出设备等物理设备&#xff1b;软件资源是以文件形式保存在存储器上的成熟和数据等信息。 操作系统就是计算机系统资源的管理者。 如果你的计…

GEO生信数据挖掘(七)差异基因分析

上节&#xff0c;我们使用结核病基因数据&#xff0c;做了一个数据预处理的实操案例。例子中结核类型&#xff0c;包括结核&#xff0c;潜隐进展&#xff0c;对照和潜隐&#xff0c;四个类别。本节延续上个数据&#xff0c;进行了差异分析。 差异分析 计算差异指标step12 加载…

销售小白如何写客户拜访记录?

销售小白如何写客户拜访记录&#xff1f;10年客户管理经验&#xff0c;接下来我说的&#xff0c;都是实实在在的经验&#xff0c;小白能用到其中的40%&#xff0c;你的客户成单率会大大提升&#xff01; 首先&#xff0c;客户拜访记录的哪些信息是重要的&#xff1f; 答案是&…

【ccf-csp题解】第7次csp认证-第二题-俄罗斯方块-简单碰撞检测算法

题目描述 思路讲解 本题的主要思路是实现一个draw函数&#xff0c;这个函数可以绘制每一个状态的画布。然后从第一个状态往后遍历&#xff0c;当绘制到某一个状态发生碰撞时&#xff0c;答案就是上一个状态的画布。 此处的状态x实际就是在原来的15*10画布上的第x行开始画我们…

深度优先搜索详解

目录 前言 一、工作原理 二、模板 函数模板&#xff1a; 准备工作 三、主要应用 &#xff08;一&#xff09;寻找全部路径 题目描述 输入格式 输出格式 样例输入 样例输出 参考代码 思路 原题链接&#xff1a;1213: 走迷宫 &#xff08;二&#xff09;统计连通块…

哪款洗地机更好用?2023年最好用的洗地机

随着科技的发展和生活质量的提高&#xff0c;人们对洗地机的关注也越来越频繁&#xff0c;但是市场上洗地机品牌众多&#xff0c;消费者在选择时常常会感到困惑。那么&#xff0c;究竟哪个品牌的洗地机更好用呢? 我们在购买洗地机的时候&#xff0c;都要关注洗地机的哪些方面…

如何下载IEEE Journal/Conference/Magazine的LaTeX/Word模板

当你准备撰写一篇学术论文或会议论文时&#xff0c;使用IEEE&#xff08;电气和电子工程师协会&#xff09;的LaTeX或Word模板是一种非常有效的方式&#xff0c;它可以帮助你确保你的文稿符合IEEE出版的要求。无论你是一名研究生生或一名资深学者&#xff0c;本教程将向你介绍如…

深度学习问答题(更新中)

1. 各个激活函数的优缺点&#xff1f; 2. 为什么ReLU常用于神经网络的激活函数&#xff1f; 在前向传播和反向传播过程中&#xff0c;ReLU相比于Sigmoid等激活函数计算量小&#xff1b;避免梯度消失问题。对于深层网络&#xff0c;Sigmoid函数反向传播时&#xff0c;很容易就…

读懂MCU产品选型表

读懂MCU产品选型表 产品状态 MP&#xff1a;Mass Production&#xff08;大规模生产&#xff09; - 这表示产品已经进入了大规模生产阶段&#xff0c;可以大量生产并提供给市场。UD&#xff1a;Under Development&#xff08;开发中&#xff09; - 这表示产品目前正在开发阶段…

嵌入式音频软件开发之协议时序图分析方法

是否需要申请加入数字音频系统研究开发交流答疑群(课题组)&#xff1f;加我微信hezkz17, 本群提供音频技术答疑服务 1 TCP/IP 三次握手协议-时序图 序列号是随机数&#xff0c;但是对方回应则是序列号1 &#xff0c;同步1使能&#xff0c;ACK1使能该功能 2 iAP2 授权交互时序…

如何优化敏捷需求管理流程,敏捷需求如何管理。

优化敏捷需求管理流程的方法可以参照如下&#xff1a; 明确需求 。在项目开始时&#xff0c;要确保清楚地理解客户需求&#xff0c;明确项目的目标和范围&#xff0c;以便能够在敏捷迭代中快速响应需求变更。 使用用户故事 。采用用户故事的方式&#xff0c;让客户和开发团队…

云开发中关于Container与虚拟机之间的比较

虚拟机的优势&#xff1a; 1、较小的硬盘开销&#xff1a;一个物理机上可以运行多个虚拟机。 2、容易移植到其他机器上。 3、整合闲置工作负载。 提高设备利用率。 4、通过释放不用的资源来减少能源消耗。 5、多种操作系统让其具有灵活性和可扩展性。 虚拟机的缺点&#…

数据库中了mkp勒索病毒怎么恢复数据,勒索病毒解密,数据恢复

mkp勒索病毒是一种危害性极大&#xff0c;且比较常见的电脑病毒类型。根据数据统计&#xff0c;这种类型的勒索病毒每月攻击的用户数量高达数百起。其中绝大多数用户需要恢复的数据类型为数据库。包括但不限于SQL server、MySQL和oracle等数据库。所以云天数据恢复中心将针对数…

行情分析——加密货币市场大盘走势(9.10)

大饼在昨日下跌回踩了EMA21均线&#xff0c;但是遇到强阻力回调&#xff0c;形成了金针探底的形态。MACD日线级别来看&#xff0c;延续了绿色空心柱&#xff0c;并且还要继续延续的趋势。但是目前依然没有跌破上涨趋势区域。现在建议保持观望状态&#xff0c;现在多空盈亏比不够…

python 在window对exe、注册表、bat、系统服务操作等实例讲解

目录 前言&#xff1a; 1、python准备工作 具体操作实例 实例1&#xff1a;调用exe文件 实例2&#xff1a;调用bat批处理文件 实例3&#xff1a;调用mis安装文件 实例4&#xff1a; 操作注册表 实例5&#xff1a; window系统服务的操作 完整代码 前言&#xf…

原生JS-鼠标拖动

原生JS-鼠标拖动 通过鼠标的点击事件通过h5的属性 通过鼠标的点击事件 步骤&#xff1a; 1. 鼠标按下div。 2. 鼠标移动&#xff0c;div跟着移动 原生js&#xff0c;实现拖拽效果。1. 给被拖拽的div加上 onmousedown 鼠标【按下事件】。鼠标按下的时候&#xff0c;开始监听鼠标…

安达发|制造业的新趋势:APS排程软件的广泛应用

近年来&#xff0c;随着科技的快速发展&#xff0c;制造业也在逐步实现智能化、自动化。其中&#xff0c;APS排程软件的应用越来越广泛&#xff0c;成为制造业提高生产效率、降低运营成本的重要工具。本文将深入探讨这一现象背后的原因。 制造业是全球经济的重要支柱&#xff0…

pygame简单实现游戏开始菜单

最终效果&#xff1a; 完整视频&#xff1a; pygame简单实现菜单 Code&#xff1a; settings.py RESWIDTH,HEIGHT800,600 FPS60main.py import pygame as pg from settings import * import sysclass Game:def __init__(self):pg.init()self.screenpg.display.set_mode(RES)…

浏览器中XPath的使用

概念 XPath (XML Path Language) 是一门在 XML 文档中查找信息的语言&#xff0c;可用来在 XML 文档中对元素和属性进行遍历。 XPath定位在爬虫和自动化测试中都比较常用&#xff0c;通过使用路径表达式来选取 XML 文档中的节点或者节点集&#xff0c;熟练掌握XPath可以极大提…

生成多元正态数据

目录 一、mvrnorm()函数使用介绍 例1&#xff1a;生成服从多元正态分布的数据 例2:生成一组服从多元正态分布的观测 一、mvrnorm()函数使用介绍 获取来自给定均值向量和协方差阵的多元正态分布的数据。 MASS包中的mvrnorm()函数可以让这个问题变得很容易&#xff0c;其调用…