作者主页:编程指南针

作者简介:Java领域优质创作者、博客专家 、特邀作者、多年架构师设计经验、腾讯课堂常驻讲师

主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助

文末获取源码 

项目编号:BS-XX-124

一,项目简介

   本项目基于Springboot+Mybatis开发实现了一个高校社团管理系统,系统包含三个角色:管理员、团长、会员。管理员主要是做一些基础数据的管理,比较用户管理,新闻管理,活动审批,社团创建审批等等,会员可以申请加入相关的社团,也可自己申请社团,管理员审批通过后成为团长,可以申请开展相关的活动。团长登陆后可以审批申请加入本社团的申请信息,并管理和查看相关的社团用户信息。各角色进入均可以查看发布的新闻信息。

二,环境介绍

语言环境:Java:  jdk1.8

数据库:Mysql: mysql5.7   Redis缓存数据库

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

后台开发技术:Springboot+Mybatis+SpringCache缓存框架

前端开发技术:Jquery+AjAX+JSP

三,系统展示

下面展示一下系统的相关功能模块:

管理员登陆后主要操作功能

登陆注册界面

基于Springboot实现高校社团管理系统_java

 

主界面

基于Springboot实现高校社团管理系统_学校社团管理_02

查看社团活动信息

基于Springboot实现高校社团管理系统_高校社团申请系统_03

用户管理

基于Springboot实现高校社团管理系统_社团管理系统_04

社团管理

基于Springboot实现高校社团管理系统_社团管理系统_05

审核 管理

基于Springboot实现高校社团管理系统_springboot应用程序_06

新闻管理

基于Springboot实现高校社团管理系统_java_07

团长登陆系统后

申请创建活动

基于Springboot实现高校社团管理系统_springboot应用程序_08

管理本社团成员

基于Springboot实现高校社团管理系统_社团管理系统_09

审核加入社团申请

基于Springboot实现高校社团管理系统_学校社团管理_10

学生登陆

申请创建社团

基于Springboot实现高校社团管理系统_高校社团申请系统_11

申请加入社团

基于Springboot实现高校社团管理系统_学校社团管理_12

 

四,核心代码展示

package com.example.association2.controller;

import com.example.association2.service.impl.ActivityServiceImpl;
import com.example.association2.service.impl.AssociationMemberServiceImpl;
import com.example.association2.utils.PicUtil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class ActivityController {
    @Autowired
    private AssociationMemberServiceImpl associationMemberService;
    @Autowired
    private ActivityServiceImpl activityService;

    @GetMapping("/activities")//所有活动页面
    public String toActivities(HttpServletRequest httpServletRequest,
                               @RequestParam(name = "key", required = true) int key) {//key判断点击的活动分类
        if (key == 0) {//所有活动
            httpServletRequest.setAttribute("activityList", activityService.findAllActivityAndName());
            httpServletRequest.setAttribute("key", key);
        } else if (key == 1) {//文体类活动
            httpServletRequest.setAttribute("activityList", activityService.findActivityAndNameByAssociationType(key));
            httpServletRequest.setAttribute("key", key);
        } else if (key == 2) {//学术类活动
            httpServletRequest.setAttribute("activityList", activityService.findActivityAndNameByAssociationType(key));
            httpServletRequest.setAttribute("key", key);
        } else if (key == 3) {//公益类活动
            httpServletRequest.setAttribute("activityList", activityService.findActivityAndNameByAssociationType(key));
            httpServletRequest.setAttribute("key", key);
        }
        return "jsp/activity";
    }

    @GetMapping("/activity")//活动详情页面
    public String act_detail(HttpServletRequest httpServletRequest,
                             @RequestParam(name = "activityId", required = true) int activityId) {
        String imglocation[] = activityService.findActivityById(activityId).getPicture().split(";");//把活动图片路径和分号切割后返回正确的图片路径
        httpServletRequest.setAttribute("imgLocation", imglocation);
        int imgNum = imglocation.length;
        httpServletRequest.setAttribute("imgNum", imgNum);//获取图片数量
        httpServletRequest.setAttribute("activity", activityService.findActivityById(activityId));
        return "jsp/act_detail";//活动详情页面
    }

    @GetMapping("/activityApply")//申请活动页面
    public String toApply(HttpServletRequest httpServletRequest) {
        HttpSession session = httpServletRequest.getSession();
        int userId = (int) session.getAttribute("userId");
        httpServletRequest.setAttribute("associationId", associationMemberService.findassociationIdByUserId(userId));
        return "jsp/act_apply";
    }

    @PostMapping("/activity")//提交活动申请
    @ResponseBody
    public String addAct(@RequestParam String title,
                         String description,
                         int associationId,
                         String startTime,
                         String endTime,
                         String location,
                         float material,
                         @RequestParam(name = "base64Data0", required = false) String base64Data0,
                         @RequestParam(name = "base64Data1", required = false) String base64Data1,
                         @RequestParam(name = "base64Data2", required = false) String base64Data2,
                         HttpServletRequest httpServletRequest) {
        String picture1 = "";
        String picture2 = "";
        String picture3 = "";
        String picture = "";
        if (base64Data0 == null || "".equals(base64Data0)) {
            //提示上传图片错误
        } else {
            picture1 = PicUtil.pictureUtil(base64Data0, httpServletRequest);
            picture = picture1;
        }
        if (base64Data1 == null || "".equals(base64Data1)) {
            //提示上传图片错误
        } else {
            picture2 = PicUtil.pictureUtil(base64Data1, httpServletRequest);
            picture = picture + ";" + picture2;
        }
        if (base64Data2 == null || "".equals(base64Data2)) {
            //提示上传图片错误
        } else {
            picture3 = PicUtil.pictureUtil(base64Data2, httpServletRequest);
            picture = picture + ";" + picture3;
        }

        activityService.addActivity(title, description, associationId, startTime, endTime, location, material, picture);
        //HttpSession session = httpServletRequest.getSession();
        String result = "1";
        return result;
    }

    @RequestMapping("/applyResult")//活动申请结果页面
    public String toresult() {
        return "jsp/apply_result";
    }

    @RequestMapping("/actDelete")
    public ModelAndView actDelete(@RequestParam(name = "activityId", required = true) int activityId) {
        activityService.deleteActivity(activityId);
        int bar = 2;
        ModelAndView mv = new ModelAndView();
        mv.addObject("bar", bar);
        mv.setViewName("forward:assManage");
        return mv;
    }
    //查看申请的活动图片
    @RequestMapping("/actPicture")
    public String act_picture(HttpServletRequest httpServletRequest,
                             @RequestParam(name = "activityId", required = true) int activityId) {
        String imglocation[] = activityService.findActivityById(activityId).getPicture().split(";");//把活动图片路径和分号切割后返回正确的图片路径
        httpServletRequest.setAttribute("imgLocation", imglocation);
        int imgNum = imglocation.length;
        httpServletRequest.setAttribute("imgNum", imgNum);//获取图片数量
        httpServletRequest.setAttribute("activity", activityService.findActivityById(activityId));
        return "jsp/manage/act_picture";//活动详情页面
    }
    @RequestMapping("/toActModify")//活动修改页面
    public String toAssModify(@RequestParam(name = "activityId", required = true) int activityId,
                              HttpServletRequest httpServletRequest) {
        String imglocation[] = activityService.findActivityAndNameById(activityId).getPicture().split(";");//把活动图片路径和分号切割后返回正确的图片路径
        httpServletRequest.setAttribute("imgLocation", imglocation);
        int imgNum = imglocation.length;
        httpServletRequest.setAttribute("imgNum", imgNum);//获取图片数量
        httpServletRequest.setAttribute("act", activityService.findActivityAndNameById(activityId));
        return "jsp/manage/act_modify";
    }
    @RequestMapping("/actModify")//提交活动修改
    @ResponseBody
    public String actModify( @RequestParam(name = "activityId", required = true)int activityId,
                             int activityStatus,
                             @RequestParam String title,
                             String description,
                             int associationId,
                             String startTime,
                             String endTime,
                             String location,
                             float material,
                             @RequestParam(name = "base64Data0", required = false) String base64Data0,
                             @RequestParam(name = "base64Data1", required = false) String base64Data1,
                             @RequestParam(name = "base64Data2", required = false) String base64Data2,
                             HttpServletRequest httpServletRequest) {
        String picture1 = "";
        String picture2 = "";
        String picture3 = "";
        String picture = "";
        if("data".equals(base64Data0.substring(0,4))){//本地上传的图片
            if (base64Data0 == null || "".equals(base64Data0)) {
                //提示上传图片错误
            } else {
                picture1 = PicUtil.pictureUtil(base64Data0, httpServletRequest);
                picture = picture1;
            }
            if (base64Data1 == null || "".equals(base64Data1)) {
                //提示上传图片错误
            } else {
                picture2 = PicUtil.pictureUtil(base64Data1, httpServletRequest);
                picture = picture + ";" + picture2;
            }
            if (base64Data2 == null || "".equals(base64Data2)) {
                //提示上传图片错误
            } else {
                picture3 = PicUtil.pictureUtil(base64Data2, httpServletRequest);
                picture = picture + ";" + picture3;
            }
        }else {//是从数据库读取的图片
            if (base64Data0 == null || "".equals(base64Data0)) {
                //提示上传图片错误
            } else {
                picture1 = base64Data0;
                picture = picture1;
            }
            if (base64Data1 == null || "".equals(base64Data1)) {
                //提示上传图片错误
            } else {
                picture2 = base64Data1;
                picture = picture + ";" + picture2;
            }
            if (base64Data2 == null || "".equals(base64Data2)) {
                //提示上传图片错误
            } else {
                picture3 =base64Data2;
                picture = picture + ";" + picture3;
            }
        }
        activityService.updateActivity(title,description,associationId,startTime,endTime,location,picture,material,activityStatus,activityId);
        String result = "1";
        return result;
    }

    @RequestMapping("/toAddAct")
    public String toAddAss(int associationId,HttpServletRequest httpServletRequest) {
        httpServletRequest.setAttribute("associationId",associationId);
        return "jsp/manage/act_add";
    }

    @PostMapping("/actAdd")//活动添加业务逻辑
    @ResponseBody
    public String actAdd(@RequestParam String title,
                         String description,
                         int associationId,
                         String startTime,
                         String endTime,
                         String location,
                         float material,
                         @RequestParam(name = "base64Data0", required = false) String base64Data0,
                         @RequestParam(name = "base64Data1", required = false) String base64Data1,
                         @RequestParam(name = "base64Data2", required = false) String base64Data2,
                         HttpServletRequest httpServletRequest) {
        String picture1 = "";
        String picture2 = "";
        String picture3 = "";
        String picture = "";
        if (base64Data0 == null || "".equals(base64Data0)) {
            //提示上传图片错误
        } else {
            picture1 = PicUtil.pictureUtil(base64Data0, httpServletRequest);
            picture = picture1;
        }
        if (base64Data1 == null || "".equals(base64Data1)) {
            //提示上传图片错误
        } else {
            picture2 = PicUtil.pictureUtil(base64Data1, httpServletRequest);
            picture = picture + ";" + picture2;
        }
        if (base64Data2 == null || "".equals(base64Data2)) {
            //提示上传图片错误
        } else {
            picture3 = PicUtil.pictureUtil(base64Data2, httpServletRequest);
            picture = picture + ";" + picture3;
        }

        activityService.addActivity(title, description, associationId, startTime, endTime, location, material, picture);
        //HttpSession session = httpServletRequest.getSession();
        String result = "1";
        return result;
    }

    @RequestMapping("/actApplyPass")//活动申请通过
    public ModelAndView actApplySuccess(@RequestParam(name = "activityId", required = true) int activityId) {
        activityService.applyPass(activityId);
        int bar = 1;
        ModelAndView mv = new ModelAndView();
        mv.addObject("bar", bar);
        mv.setViewName("forward:applyManage");
        return mv;
    }
    @RequestMapping("/actApplyRefuse")//活动申请拒绝
    public ModelAndView actApplyRefuse(@RequestParam(name = "activityId", required = true) int activityId) {
        activityService.applyRefuse(activityId);
        int bar = 1;
        ModelAndView mv = new ModelAndView();
        mv.addObject("bar", bar);
        mv.setViewName("forward:applyManage");
        return mv;
    }
}
package com.example.association2.controller;

import com.example.association2.service.impl.ActivityServiceImpl;
import com.example.association2.service.impl.AssociationMemberServiceImpl;
import com.example.association2.service.impl.AssociationServiceImpl;
import com.example.association2.service.impl.NewsServiceImpl;
import com.example.association2.utils.PicUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Date;

@Controller
public class AssociationController {
    @Autowired
    private AssociationServiceImpl associationService;
    @Autowired
    private AssociationMemberServiceImpl associationMemberService;
    @Autowired
    private ActivityServiceImpl activityService;
    @Autowired
    private NewsServiceImpl newsService;
    @GetMapping("/associations")//所有社团页面
    public String index(HttpServletRequest httpServletRequest,
                        @RequestParam(name = "type", required = false, defaultValue = "1") int type) {
        httpServletRequest.setAttribute("type", type);
        httpServletRequest.setAttribute("associationsList", associationService.findAssociationsByType(type));
        httpServletRequest.setAttribute("lastActivity", activityService.findLastActivity());
        return "jsp/mid/index";
    }

    //申请创建社团页面
    @GetMapping("/associationApply")
    public String toApplyAss(HttpServletRequest httpServletRequest) {
        HttpSession session = httpServletRequest.getSession();
        int userId = (int) session.getAttribute("userId");
        httpServletRequest.setAttribute("userId", userId);
        return "jsp/ass_apply";
    }

    //提交创建社团申请
    @PostMapping("/associationApply")
    @ResponseBody
    public String addAss(String name,
                         String description,
                         int ownerId,
                         int type,
                         @RequestParam(name = "base64Data", required = true) String base64Data,
                         HttpServletRequest httpServletRequest) {
        String logo = "";
        String s[];
        if (base64Data == null || "".equals(base64Data)) {
            //提示上传图片错误
        } else {
            logo = PicUtil.pictureUtil(base64Data, httpServletRequest);
            logo = logo.substring(3, logo.length());
            System.out.println(logo);
        }
        associationService.addAssociation(description, name, null, type, ownerId, logo);
        String result = "1";
        return result;
    }

    //社团详情页面
    @GetMapping("/association")
    public String association(
            @RequestParam(name = "associationId", required = true) int associationId,
            @RequestParam(name = "bar", defaultValue = "1") int bar,
            HttpServletRequest httpServletRequest) {
        switch (bar) {
            case 1:
                //首页
                httpServletRequest.setAttribute("bar", 1);
                break;
            case 2:
                //成员列表
                httpServletRequest.setAttribute("presidentDes",
                        associationMemberService.findPresidentDesByAssid(associationId));
                httpServletRequest.setAttribute("VicePresidentDes",
                        associationMemberService.findVicePresidentDesByAssid(associationId));
                httpServletRequest.setAttribute("MinisterDes",
                        associationMemberService.findMinisterDesByAssid(associationId));
                httpServletRequest.setAttribute("bar", 2);
                break;
            case 3:
                //活动列表
                httpServletRequest.setAttribute("activityList",
                        activityService.findActivityByAssociationId(associationId));
                httpServletRequest.setAttribute("signatureActivity",associationService.findSignatureActivityName(associationId));
                httpServletRequest.setAttribute("bar", 3);
                break;
        }
        httpServletRequest.setAttribute("association", associationService.findAssociationById(associationId));
        return "jsp/ass_detail";
    }

    @RequestMapping("/assManage")
    public String toAssManage(@RequestParam(name = "bar", defaultValue = "1") int bar,
                              HttpServletRequest httpServletRequest) {
        switch (bar) {
            case 1:
                httpServletRequest.setAttribute("assList", associationService.findAllAss());
                httpServletRequest.setAttribute("bar", 1);
                break;
            case 2:
                httpServletRequest.setAttribute("actList", activityService.findAllActivityAndName());
                httpServletRequest.setAttribute("bar", 2);
                break;

        }
        return "jsp/manage/ass_manage";
    }

    @RequestMapping("/toAddAss")
    public String toAddAss() {
        return "jsp/manage/ass_add";
    }


    @PostMapping("/assAdd")
    @ResponseBody
    public String AddAss(String name,
                         String description,
                         int ownerId,
                         int type,
                         @RequestParam(name = "base64Data", required = true) String base64Data,
                         HttpServletRequest httpServletRequest) {
        String logo = "";
        String s[];
        if (base64Data == null || "".equals(base64Data)) {
            //提示上传图片错误
        } else {
            logo = PicUtil.pictureUtil(base64Data, httpServletRequest);
            logo = logo.substring(3, logo.length());
            System.out.println(logo);
        }
        String createTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
        associationService.addAss(description, name, createTime, type, ownerId, logo);
        String result = "1";
        return result;
    }

    @RequestMapping("/assDelete")
    public ModelAndView amDelete(@RequestParam(name = "associationId", required = true) int associationId) {
        associationService.deleteAss(associationId);
        int bar = 2;
        ModelAndView mv = new ModelAndView();
        mv.addObject("bar", bar);
        mv.setViewName("forward:assManage");
        return mv;

    }

    @RequestMapping("/toAssModify")
    public String toAssModify(@RequestParam(name = "associationId", required = true) int associationId,
                              HttpServletRequest httpServletRequest) {
        httpServletRequest.setAttribute("ass", associationService.findAssociationById(associationId));
        return "jsp/manage/ass_modify";
    }
    @RequestMapping("/assModify")
    @ResponseBody
    public String assModify( @RequestParam(name = "associationId", required = true)int associationId,
                                  String name,
                                  String description,
                                  int ownerId,
                                  int type,
                                  Integer signatureActivity,
                                  @RequestParam(name = "base64Data", required = true) String base64Data,
                                  HttpServletRequest httpServletRequest) {
        String logo = "";
        if("data".equals(base64Data.substring(0,4))) {//本地上传的图片
            if (base64Data == null || "".equals(base64Data)) {

                //提示上传图片错误
            } else {
                logo = PicUtil.pictureUtil(base64Data, httpServletRequest);
                logo = logo.substring(3, logo.length());
            }
        }else {
            logo=base64Data.substring(22,base64Data.length()) ;
        }
        associationService.assModify(description,name,type,ownerId,logo,signatureActivity,associationId);
        associationMemberService.updatePresidentByAssociationId(associationId,ownerId);
        String result = "1";
        return result;
    }

    @RequestMapping("/applyManage")
    public String toApplyManage(@RequestParam(name = "bar", defaultValue = "1") int bar,
                                HttpServletRequest httpServletRequest) {
        switch (bar) {
            case 1:
                httpServletRequest.setAttribute("actApplyList", activityService.findAllActivityApply());
                httpServletRequest.setAttribute("bar", 1);
                break;
            case 2:
                httpServletRequest.setAttribute("assApplyList", associationService.findAllAssociationsApply());
                httpServletRequest.setAttribute("bar", 2);
                break;
        }
        return "jsp/manage/apply_manage";
    }

    @RequestMapping("/assApplyPass")
    public ModelAndView assApplySuccess(@RequestParam(name = "associationId", required = true) int associationId) {
        String createTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
        associationService.applyPass(createTime,associationId);

        associationMemberService.updatePresidentByAssociationId(associationId,associationService.findOwnerIdByAssociationId(associationId));

        associationMemberService.updateUserByAssociationId(associationId,associationService.findOwnerIdByAssociationId(associationId));

        int bar = 2;
        ModelAndView mv = new ModelAndView();
        mv.addObject("bar", bar);
        mv.setViewName("forward:applyManage");
        return mv;
    }

    @RequestMapping("/assApplyRefuse")
    public ModelAndView assApplyRefuse(@RequestParam(name = "associationId", required = true) int associationId) {
        associationService.applyRefuse(associationId);
        int bar = 2;
        ModelAndView mv = new ModelAndView();
        mv.addObject("bar", bar);
        mv.setViewName("forward:applyManage");
        return mv;
    }
}
package com.example.association2.controller;

import com.example.association2.enums.UserType;
import com.example.association2.model.User;
import com.example.association2.service.impl.ActivityServiceImpl;
import com.example.association2.service.impl.AssociationServiceImpl;
import com.example.association2.service.impl.NewsServiceImpl;
import com.example.association2.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
//@ResponseBody
public class LoginController{
    @Autowired
    private UserServiceImpl userService;
    @Autowired
    private NewsServiceImpl newsService;
    @Autowired
    private AssociationServiceImpl associationService;
    @Autowired
    private ActivityServiceImpl activityService;
    //登录界面
    @GetMapping("/")
    public String tologin(){
        return "templates/login2";
    }
    //校验账户密码
    @PostMapping("/login")
    public String check(User user, HttpSession session, HttpServletRequest httpServletRequest, RedirectAttributes redirectAttributes) {
        User u1=userService.validUser(user.getUserId(), user.getPassword());
        if(u1==null) {//账户密码不匹配
            httpServletRequest.setAttribute("msg","用户名密码错误" );
            return "templates/login2";
        }else {
            session.setAttribute("userId", user.getUserId());
            session.setAttribute("userType", userService.finUserTypeById(user.getUserId()));
            return "redirect:associations";
        }
    }
    //注册界面
    @GetMapping("/register")
    public String Register(Model model) {
        //model.addAttribute("user", new User());
        return "templates/register";
    }
    //进行注册
    @PostMapping("/register")
    public String Register(User user,HttpSession session, HttpServletRequest httpServletRequest, RedirectAttributes redirectAttributes) {
        User u2=userService.validUserAccount(user.getUserId());
        if(u2!=null) {//账户已存在
            httpServletRequest.setAttribute("msg","用户已存在" );
            return "templates/register";
        }
        else//进行注册
            userService.addUser(user.getUserId(), user.getPassword(), UserType.STUDENT.getUserType());
        session.setAttribute("userId", user.getUserId());
        session.setAttribute("userType", userService.finUserTypeById(user.getUserId()));
        return "redirect:associations";
    }
    //注销
    @RequestMapping("/exit")
    public String exit(HttpSession session, HttpServletRequest httpServletRequest,
                       Model model,
                       @RequestParam(name = "type", required = false,defaultValue = "1") int type) {
        httpServletRequest.setAttribute("type",type);
        httpServletRequest.setAttribute("associationsList",associationService.findAssociationsByType(type));
        model.addAttribute("signatureActivity","**大赛");
        httpServletRequest.setAttribute("lastNews",newsService.findLastNews());
        httpServletRequest.setAttribute("lastActivity",activityService.findLastActivity());
        session.invalidate();
        return "jsp/mid/index";
    }
}

五,项目总结

整个项目基本功能完整,业务逻辑清晰,有严格的审批流程,比较适合做毕业设计或课程设计使用。