基于SpringBoot的高校党务管理系统

2023-11-18

系列文章目录

基于PHP的旅游管理系统

基于SSM的毕业设计管理系统

基于SpringBoot的高校在线答疑管理系统


目录

系列文章目录

一、相关技术

二、系统功能

三、系统页面

1.管理员功能页面

2.学生功能页面

3.党组织功能页面

4.党员功能页面 

5.前台功能页面

四、核心代码


一、相关技术

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


二、系统功能

本党务管理系统主要包括五大功能模块,即管理员模块、学生模块、积极分子模块、党员、党建组织。

(1)管理员模块:主要功能有:首页、个人中心、学生管理、学院管理、专业管理、班级管理、积极分子管理、党员管理、党建组织管理、党员转入管理、党员转出管理、入党资料管理、党团活动管理、公告信息管理、系统管理。 

(2)党员:首页、个人中心、党员转入管理、党员转出管理。

(3)学生:首页、个人中心、入党资料管理。

(4)党建组织:首页、个人中心、党员管理、党员转入管理、党员转出管理。


三、系统页面

1.管理员功能页面

 

2.学生功能页面

3.党组织功能页面

4.党员功能页面 

5.前台功能页面


四、核心代码

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.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);
    	UserEntity u = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername()));
    	if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) {
    		return R.error("用户名已存在。");
    	}
        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);
		/**
  		 * 如果使用idea或者eclipse重启项目,发现之前上传的图片或者文件丢失,将下面一行代码注释打开
   		 * 请将以下的"D:\\springbootq33sd\\src\\main\\resources\\static\\upload"替换成你本地项目的upload路径,
 		 * 并且项目路径不能存在中文、空格等特殊字符
 		 */
//		FileUtils.copyFile(dest, new File("D:\\springbootq33sd\\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、token验证

package com.annotation;

import java.lang.annotation.*;

/**
 * 忽略Token验证
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface IgnoreAuth {

}

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

基于SpringBoot的高校党务管理系统 的相关文章

随机推荐

  • R语言数据拆分

    博主的话 大家好 这里是bio 先赞后看养成习惯 还没关注的小伙伴点点关注不迷路 今天是南方的小年 祝福大家小年快乐 目录 博主的话 前言 一 split 函数 二 subset 函数 总结 前言 今天继续学习R语言 我们之前已经介绍过了数
  • 用python对训练集和测试集进行特征规范化处理

    这里的规范化处理指对提取后的特征集进行处理 不是对原始的数据信号进行处理 包括归一化和标准化 规范化的原因 不同特征具有不同量级时会导致 a 数量级的差异将导致量级较大的特征占据主导地位 b 数量级的差异将导致迭代收敛速度减慢 c 依赖于样
  • 从ChatGPT出发:大模型与自然语言模型

    目录 引言 基石 故事的开始 Transformer 异姓兄弟 GPT Bert与GPT 2 GPT Bert GPT 2 大力出奇迹 GPT3 模型的进化 InstructGPT ChatGPT 代码库 Transformer GPT 2
  • 【Linux】进程篇---进程概念及原理

    目录 1 什么是进程 2 操作系统是如何管理进程的 3 进程标识符 PID 3 1查看进程标识符 3 2getpid 和getppid 4 进程当前状态 4 1进程状态粗分 4 2Linux下进程状态 4 2 1linux下进程状态概念 4
  • 【深度学习】端到端的“即插即用“卷积模块以替代传统Conv层

    文章参考 大盘点 十大即插即用的涨点神器 360doc com CompConv 一种用于高效特征学习的紧凑型卷积模块 知乎 zhihu com 紧凑型深度卷积神经网络在图像识别中的应用 ceaj org
  • 浪潮服务器通过DHCP获取地址进入IPMI,BMC管理后台的方法,可实现远程安装系统、温度运行状态监测、风扇转速调整、远程开关机、KVM控制台显示器等功能

    前言 这里主要介绍通过DHCP进入BMC管理后台的方法 在官方网站有介绍的地方会直接给链接 这里就不在赘述 配置网络 DHCP获取地址 这个方法适用于没有手动设置过BMC地址的情况 这里用到的DHCP工具是 深度远程启动管理器 深度远程启动
  • 面试准备:MySQL建立索引的原则

    文章目录 建立索引 1 和in可以乱序 2 最左前缀匹配原则 3 尽量选择区分度高的列作为索引 4 索引列不能参与计算 5 尽量的扩展索引 不要新建索引 6 为经常需要排序 分组和联合操作的字段建立索引 7 为常作为查询条件的字段建立索引
  • 【山河送书第十一期】:朋友圈大佬都去读研了,这份备考书单我码住了,考研书籍五本!!

    朋友圈大佬都去读研了 这份备考书单我码住了 数据结构与算法分析 计算机网络 自顶向下方法 现代操作系统 深入理解计算机系统 概率论基础教程 原书第10版 线性代数 原书第10版 线性代数及其应用 重磅推荐 参与方式 往期赠书回顾 八九月的朋
  • AlmaLinux 安装过程解析

    此文将对AlmaLinux操作系统安装过程进行解析 对于经常使用Linux系统的大佬 可能对此安装过程有些乏味 但鉴于目前为止 似乎没有一篇安装的过程解析 那不妨由笔者写下一篇吧 笔者软件安装环境 VMware VMware Worksta
  • 提升模型效果的途径

    模型效果不佳 可以考虑从以下几个方面进行改进 数据增广 1 基于图像处理的数据增广 几何变换 旋转 缩放 翻转 剪裁 平移 仿射变换 颜色空间变换 亮度 对比度 饱和度调整 颜色空间转行 色彩调整 添加噪声和滤波 注入高斯噪声 椒盐噪声 模
  • Python模糊控制库使用(基本操作与仿真结果3D显示)

    Python模糊控制库使用 模糊控制库安装 示例 定义模糊控制变量 模糊隶属函数 模糊规则 激活模糊控制器 3D可视化结果 完整代码 模糊控制库安装 模糊控制库github 链接 Github python pip安装 pip instal
  • 第三十九章、PyQt显示部件:OpenGL Widget部件功能简介及使用其显示图片

    专栏 Python基础教程目录 专栏 使用PyQt开发图形界面Python应用 专栏 PyQt入门学习 老猿Python博文目录 老猿学5G博文目录 一 概述 OpenGL Widget部件是一个OpenGL Open Graphics L
  • java反射机制 (属性,注解)(代码)

    博学谷IT学习技术支持 1案例的类 import com example demo3 fanshe MyAnnotation import lombok Data author zw Description 描述 create 2022 2
  • YOLOv8+BoT-SORT多目标跟踪(行人车辆计数与越界识别)

    课程链接 https edu csdn net course detail 38919 BoT SORT是发表于2022年的先进的多目标跟踪算法 它结合了运动和外观信息 相机运动补偿和更准确的卡尔曼滤波状态向量 并把这些改进集成到ByteT
  • vue的环境搭建2023,idea,vscode踩坑记录

    由于看了19 20年的几篇博客 导致搭建vue环境一部分环节出大问题 大家还是看官方文档吧 血泪教训 不说废话直接开始 1 nodejs下载 下载地址 https nodejs org zh cn 下载稳定版 安装过程我是一路next 就是
  • python之折半查找算法

    折半查找算法也叫二分查找算法 算法的细节我就不讲了 但是必须说一下二分查找是基于我们之前的数据是有序的 如果没有序该算法是没有意义的 个人觉得代码比较直观 所以我这里就直接上代码了 折半查找非递归算法 折半查找非递归算法 折半查找函数 参数
  • 实验二 势函数算法的迭代训练

    实验二 势函数算法的迭代训练 一 实验目的 通过本实验的学习 使学生了解或掌握模式识别中利用势函数思想设计非线性判别函数的方法 能够实现模式的分类 学会运用已学习的先导课程如数据结构和算法设计知识 选用合适的数据结构完成算法的设计和程序的实
  • Python获取文件名和文件类型

    def get file info path dir path file full name os path split path file name file type os path splitext file full name re
  • [搬家前]代码走查

    代码走查 就是一群人一起 对别人写的代码进行分析 在算法上 在具体实现上 提出改进的意见 以使得程序更加健壮 更加有效率 今天对我写的一个Java Mail程序进行走查 自我感觉写得是有点丑 但是基本功能还是实现得很好的 经过走查 我收获很
  • 基于SpringBoot的高校党务管理系统

    系列文章目录 基于PHP的旅游管理系统 基于SSM的毕业设计管理系统 基于SpringBoot的高校在线答疑管理系统 目录 系列文章目录 一 相关技术 二 系统功能 三 系统页面 1 管理员功能页面 2 学生功能页面 3 党组织功能页面 4