文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

基于Springboot的高校社团管理系统的设计与实现

2024-04-02 19:55

关注

一、项目简介

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

二、环境介绍

语言环境:Java:  jdk1.8

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

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

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

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

三、系统展示

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

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

登陆注册界面

主界面

查看社团活动信息

用户管理

社团管理

审核 管理

新闻管理

团长登陆系统后

申请创建活动

管理本社团成员

审核加入社团申请

学生登陆

申请创建社团

申请加入社团

四、核心代码展示

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

以上就是基于Springboot的高校社团管理系统的设计与实现的详细内容,更多关于Springboot高校社团管理系统的资料请关注编程网其它相关文章!

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     807人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     351人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     314人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     433人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     221人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-后端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯