基于ssm校园学生协会管理系统jsp校园社团管理系统源码和论文

news/2025/1/15 14:08:01/

1、开发环境
(1)操作系统: Windows10
(2)数据库与数据库管理工具: MySQL 5.7.19、Navicat for MySQL
(3)Web服务器: Tomcat8.5.38
(4)开发工具与技术: Eclipse IDEA、SSM框架、Ajax

2、数据库部署:
(1)安装MySQL 5.7.19
(2)安装并打开Navicat for MySQL数据库可视化工具
(3)创建一个新的数据库,启动数据库,运行SQL源码文件

3、后台部署:
(1)安装ECLIPSE,配制支持动态网页开发。
(2)导入代码文件
(3)配置Tomcat,并将附件导入Tomcat本地存储文件夹。
(4)配置application.properties中的相关信息。

演示视频:

【java毕业设计】基于ssm校园学生协会管理系统jsp校园社团管理系统源码和论文

 

 

package com.association.controller;import java.io.File;
import java.util.ArrayList;
import java.util.List;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.multipart.MultipartFile;import com.association.po.Admin;
import com.association.po.Apply;
import com.association.po.AssShow;
import com.association.po.Assall;
import com.association.po.Association;
import com.association.po.Inform;
import com.association.po.Member;
import com.association.po.VMember;
import com.association.service.AssociationService;
import com.zhenzi.sms.ZhenziSmsClient;@Controller
@RequestMapping("/association")
public class AssociationController {@Autowiredprivate AssociationService associationService;// 管理员查询所有协会@RequestMapping("/findAllAssociation")public String findAllAssociation(Model model) {List<Association> as = associationService.findAllAssociation();List<Association> association = new ArrayList<>();Association ass;for(int i=0;i<as.size();i++) {ass = new Association();ass.setAss_id(as.get(i).getAss_id());ass.setAss_name(as.get(i).getAss_name());String member_id=as.get(i).getMember_id();//获得会长IDass.setMember_id(member_id);if(member_id!=null && member_id.length()!=0){	ass.setMember_name(associationService.findhuizhangById(member_id).getMember_name());//根据id查询出会长名						}else{ass.setMember_name("无");				}ass.setAss_qqgroup(as.get(i).getAss_qqgroup());ass.setAss_img(as.get(i).getAss_img());ass.setAss_show(as.get(i).getAss_show());ass.setAss_email(as.get(i).getAss_email());ass.setAss_asset(as.get(i).getAss_asset());ass.setAss_introduce(as.get(i).getAss_introduce());ass.setAss_state(as.get(i).getAss_state());association.add(ass);}model.addAttribute("association", association);return "association/association-list";}// 管理员查询所有 新 协会@RequestMapping("/findAllnewAssociation")public String findAllnewAssociation(Model model) {List<Association> newassociation = associationService.findAllnewAssociation();model.addAttribute("newassociation", newassociation);return "association/NewAssociation-list";}// 前端查询所有协会会@RequestMapping("/findAllAssociationWeb")public String findAllAssociationWeb(Model model,HttpSession session) {		List<Association> association = associationService.findAllAssociationWeb();Member self = (Member) session.getAttribute("self");			List<Apply> apply = null;List<Association> assid = null;//如果有成员信息,通过成员id查找申请表if(self != null) {apply = associationService.findMemberAssociationApply(self.getMember_id());//查找出该会员申请信息assid = associationService.findAssidbyMid(self.getMember_id());//查找出该会员已在协会信息,防止重复申请相同协会}model.addAttribute("apply", apply);model.addAttribute("assid", assid);model.addAttribute("association", association);return "web/association-apply";}// 前端根据协会名查询所有协会会@RequestMapping("/findUpAssByTitleWeb")public String findUpAssByTitleWeb(Model model,HttpSession session,HttpServletRequest request) {	String ass_name=request.getParameter("input");List<Association> association = associationService.findUpAssByTitleWeb(ass_name);Member self = (Member) session.getAttribute("self");			List<Apply> apply = null;List<Association> assid = null;//如果有成员信息,通过成员id查找申请表if(self != null) {apply = associationService.findMemberAssociationApply(self.getMember_id());//查找出该会员申请信息assid = associationService.findAssidbyMid(self.getMember_id());//查找出该会员已在协会信息,防止重复申请相同协会}model.addAttribute("apply", apply);model.addAttribute("assid", assid);model.addAttribute("association", association);return "web/association-apply";}//协会的升级与降级@RequestMapping("/updatestate")@ResponseBodypublic int updatestate(HttpServletRequest request) {int i;String ass_state = request.getParameter("ass_state");String ass_id = request.getParameter("ass_id");try {i = associationService.updatestate(ass_id, ass_state);} catch (Exception e) {e.printStackTrace();i = 0;}return i;}//协会的升级与降级@RequestMapping("/updatestate2")@ResponseBodypublic int updatestate2(HttpServletRequest request) {int i;String ass_show = request.getParameter("ass_show");String ass_id = request.getParameter("ass_id");try {i = associationService.updatestate2(ass_id, ass_show);} catch (Exception e) {e.printStackTrace();i = 0;}return i;}//查找出该协会的成员(发送通知处)@RequestMapping("/findMemberByassId")@ResponseBodypublic List<Member> findMemberByassId(Model model,HttpServletRequest request) {String id = request.getParameter("ass_id");List<Member> member = associationService.findMemberByAssociation(id);return member;}// 跳转指定协会修改信息界面,查出所有对应协会成员提供修改会长功能@RequestMapping("/toUpdateAssociation")public String toUpdateAssociation(Model model, HttpServletRequest request) {String id = request.getParameter("ass_id");Association association = associationService.findAssociationById(id);List<Member> member = associationService.findMemberByAssociation(id);model.addAttribute("association", association);model.addAttribute("member", member);return "association/association-edit";}//跳转指定 新 协会修改信息界面,查找出有资格成为会长的——协会数量小于2,且不是任一协会的会长@RequestMapping("/toUpdatenewAssociation")public String toUpdatenewAssociation(Model model, HttpServletRequest request) {String id = request.getParameter("ass_id");Association association = associationService.findAssociationById(id);List<Member> member = associationService.findMembercanLeader(id);model.addAttribute("association", association);model.addAttribute("member", member);return "association/Newassociation-edit";}// 修改协会信息 包括换会长功能@RequestMapping("/updateAssociation")@ResponseBodypublic int updateAssociation(Model model, Association association, HttpServletRequest request, HttpSession session) {int i;Admin admin= (Admin) session.getAttribute("adminSelf");			//为了获得admin_id	int adminid=admin.getAdmin_id();		//为了获得admin_id	String member_id=request.getParameter("member_id");//所选的会员IDString tel = associationService.findMember(member_id).getMember_phone();//新会长手机String assname=association.getAss_name();Association as =associationService.findAssociationByById(association.getAss_id());String oldMember_id=as.getMember_id();//原先会长IDVMember member = associationService.findMember(oldMember_id);String oldphone=member.getMember_phone();//老会长手机List<Member> leader = associationService.findleaderbyid(member_id);//用id从会长视图中查找是否存在System.out.println(member_id+":::"+oldMember_id+":::"+leader.size());try {if(member_id.equals(oldMember_id)) {//会长没变i = associationService.updateAssociation(association);}else {//会长变了if(leader.size()==0) { //确保他不是其他协会会长i = associationService.updateAssociation(association);if(tel!=null) {				//向新会长发送成为会长信息	Inform inform = new Inform();int mid=Integer.parseInt(member_id);		 //转换member_id		inform.setAdmin_id(adminid);inform.setMember_id(mid);inform.setInform_title("会长任命");inform.setInform_content("你好,你已成为" + assname + "的会长。详情请登录学生协会管理系统查看");associationService.addInform(inform);sendMessageUp(tel,assname);}if(oldphone!=null) {		//向老会长发送会长变更信息			Inform inform2 = new Inform();int mid2=Integer.parseInt(oldMember_id);		 //转换member_id		inform2.setAdmin_id(adminid);inform2.setMember_id(mid2);inform2.setInform_title("会长退任");inform2.setInform_content("你好,你已退任" + assname + "会长的职位。详情请登录学生协会管理系统查看");associationService.addInform(inform2);sendMessage(oldphone,assname);}}elsei=2;//存在不可修改     }} catch (Exception e) {i = 0;}return i;}// 修改 新 协会信息 包括换会长功能@RequestMapping("/updatenewAssociation")@ResponseBodypublic int updatenewAssociation(Model model, Association association, HttpServletRequest request, HttpSession session) {int i;String member_id = request.getParameter("member_id");String tel = associationService.findMember(member_id).getMember_phone();String assname=association.getAss_name();String ass_id = request.getParameter("ass_id");int member_state=associationService.findMember(member_id).getMember_state();try {		i =associationService.addMemberState(member_id,member_state);//该成员协会数量信息i += associationService.updatenewAssociation(association);//修改协会信息i += associationService.addMember_ass(member_id, ass_id);//增加信息到协会——成员表if(tel!=null) {Inform inform = new Inform();Admin admin= (Admin) session.getAttribute("adminSelf");			//为了获得admin_id	int adminid=admin.getAdmin_id();		//为了获得admin_id			int mid=Integer.parseInt(member_id);		 //转换member_id		inform.setAdmin_id(adminid);inform.setMember_id(mid);inform.setInform_title("会长任命");inform.setInform_content("你好,你已成为" + assname + "的会长。详情请登录学生协会管理系统查看");associationService.addInform(inform);sendMessageUp(tel,assname);}} catch (Exception e) {i = 0;}return i;}// 发送手机短信通知成为会长public void sendMessageUp(String tel,String assname) {try {final String apiUrl = "https://sms_developer.zhenzikj.com";// 短信API请求地址final String appId = "103901";// 短信API产品idfinal String appSecret = "6fa889bf-a4e6-4c2a-9c78-833952fdbf7a";// 短信APIZhenziSmsClient client = new ZhenziSmsClient(apiUrl, appId, appSecret);String result = client.send(tel, "你好,你已成为" + assname + "的会长。详情请登录学生协会管理系统查看");				System.out.println(result);} catch (Exception e) {e.printStackTrace();}}// 发送手机短信通知会长变更public void sendMessage(String tel,String assname) {try {final String apiUrl = "https://sms_developer.zhenzikj.com";// 短信API请求地址final String appId = "103901";// 短信API产品idfinal String appSecret = "6fa889bf-a4e6-4c2a-9c78-833952fdbf7a";// 短信APIZhenziSmsClient client = new ZhenziSmsClient(apiUrl, appId, appSecret);String result = client.send(tel, "你好,你已退任"+assname +"会长的职位。详情请登录学生协会管理系统查看");				System.out.println(result);} catch (Exception e) {e.printStackTrace();}}// 发送手机短信通知退会public void sendMessagetuihui(String tel,String assname) {try {final String apiUrl = "https://sms_developer.zhenzikj.com";// 短信API请求地址final String appId = "103901";// 短信API产品idfinal String appSecret = "6fa889bf-a4e6-4c2a-9c78-833952fdbf7a";// 短信APIZhenziSmsClient client = new ZhenziSmsClient(apiUrl, appId, appSecret);String result = client.send(tel, "你好,你已被" + assname + "退会。如有疑问,请联系会长。");				System.out.println(result);} catch (Exception e) {e.printStackTrace();}}// 修改协会信息(前端)@RequestMapping("/updateAssociationWeb")public String updateAssociationWeb(Model model, Association association,@RequestParam("file") MultipartFile file,HttpServletRequest request) {try {if (!file.isEmpty()) {// 上传文件路径String path = request.getServletContext().getRealPath("/AssShow");// 上传文件名String filename = file.getOriginalFilename();File filepath = new File(path, filename);// 判断路径是否存在,如果不存在就创建一个if (!filepath.getParentFile().exists()) {filepath.getParentFile().mkdirs();}// 将上传文件保存到一个目标文件夹里file.transferTo(new File(path + File.separator + filename));association.setAss_img(filename);}int i = associationService.updateAssociationWeb(association);if (i == 1) {model.addAttribute("msg", "修改成功!");} elsemodel.addAttribute("msg", "修改失败!");} catch (Exception e) {e.printStackTrace();}return "activity/msg";}//跳转添加协会界面@RequestMapping("/toaddAssociation")public String toaddAssociation() {return "association/association-add";}// 添加协会@RequestMapping("/addAssociation")@ResponseBodypublic int addAssociation(Model model, Association association) {int i;try {i = associationService.addAssociation(association);System.out.println(i);} catch (Exception e) {e.printStackTrace();i = 0;}return i;}// 展示会长信息@RequestMapping("/showhuizhang")public String showhuizhang(Model model, HttpServletRequest request) {String id = request.getParameter("member_id");VMember member = associationService.findhuizhangById(id);model.addAttribute("member", member);return "association/showhuizhang";}// 会员申请协会@RequestMapping("/applyAssociation")@ResponseBodypublic int applyAssociation(HttpServletRequest request, HttpSession session) {String id = request.getParameter("ass_id");int i = 0;Member self = (Member) session.getAttribute("self");if(self==null||self.equals("")) { //登陆否i=8;		}else {List<Association> ass = null;try {if (associationService.findApplyByMemberId(self.getMember_id())==null) {// 没有入会申请在审批中int count=associationService.findAsscount(self.getMember_id());//得出加入协会数量ass = associationService.findAssidbyMid(self.getMember_id());//查找出该会员已在协会id,防止重复申请相同协会for(int j=0;j<ass.size();j++) {String assid=ass.get(j).getAss_id();if(assid.equals(id)) {i=9;break;}}if(i!=9) {if(count<2) {//如果没有加入两个协会及以上i = associationService.addApply(id, self.getMember_id());//添加申请信息}else  i=0;}}else {i=0;}}catch(Exception e){e.printStackTrace();}			}return i;}// 我的协会(前端)@RequestMapping("/myAssociation")public String findAllAssociationMemberWeb(Model model, HttpSession session) {Member self = (Member) session.getAttribute("self");//获得会员信息List <Association> associationList = associationService.findAssidbyMid(self.getMember_id());//通过member id从v_ass查找assList<Assall> AssallList = new ArrayList<>();Assall all;for (int i=0;i<associationList.size();i++) {all = new Assall();all.setXiehui_people(associationService.findAllAssociationMember(associationList.get(i).getAss_id()));//通过ass id从v member查找出该协会成员/* 遍历设置协会信息 */all.setAss_id(associationList.get(i).getAss_id());all.setAss_name(associationList.get(i).getAss_name());String leader=associationList.get(i).getLeader();//获得会长IDall.setMember_id(leader);all.setLeadername(associationService.findhuizhangById(leader).getMember_name());//根据id查询出会长名all.setAss_state(associationList.get(i).getAss_state());all.setAss_qqgroup(associationList.get(i).getAss_qqgroup());all.setAss_email(associationList.get(i).getAss_email());all.setAss_asset(associationList.get(i).getAss_asset());all.setAss_introduce(associationList.get(i).getAss_introduce());all.setAss_img(associationList.get(i).getAss_img());AssallList.add(all);}			model.addAttribute("ass",AssallList);return "web/myAssociation";}// 显示前端优秀协会代表@RequestMapping("/AssShow")@ResponseBodypublic List<Association> AssShow(Model model) {List<Association> assShow = null;try {assShow = associationService.findAllAssociationToShow();} catch (Exception e) {e.printStackTrace();}return assShow;}	// 会长修改协会信息前端@RequestMapping("/toUpdateAssociationWeb")public String toUpdateAssociationWeb(Model model, HttpServletRequest request) {String id = request.getParameter("ass_id");Association association = associationService.findAssociationByById(id);model.addAttribute("ass", association);return "web/association-edit-web";}// 退会@RequestMapping("/delMemberass")@ResponseBodypublic int delMemberass(HttpServletRequest request) {int i = 0;String ass_id=request.getParameter("ass_id");String member_id=request.getParameter("member_id");int member_state=associationService.findMember(member_id).getMember_state();String tel=associationService.findMember(member_id).getMember_phone();//获得手机号Association association =associationService.findAssociationById(ass_id);String assname=association.getAss_name();//得到协会名String leader=association.getMember_id();//得到会长idtry {		if (!member_id.equals(leader)) {//不为会长i=associationService.deleteMemberass(member_id, ass_id);//删掉member_assassociationService.updateMemberState(member_id,member_state);//member_state - 1if(tel!=null) {					Inform inform = new Inform();int mid=Integer.parseInt(member_id);		 //转换member_id		inform.setAdmin_id(1);inform.setMember_id(mid);inform.setInform_title("退会通知");inform.setInform_content("你好,你已被" + assname + "退会。如有疑问,请联系会长。");associationService.addInform(inform);sendMessagetuihui(tel,assname);}}else i=0;}catch (Exception e) {e.printStackTrace();i=0;}return i;}
}


http://www.ppmy.cn/news/18944.html

相关文章

【HBase入门】2. 集群搭建

安装 上传解压HBase安装包 tar -xvzf hbase-2.1.0.tar.gz -C ../server/ 修改HBase配置文件 hbase-env.sh cd /export/server/hbase-2.1.0/conf vim hbase-env.sh # 第28行 export JAVA_HOME/export/server/jdk1.8.0_241/ export HBASE_MANAGES_ZKfalsehbase-site.xml vim…

CSS 特效之心形-彩虹-加载动画

CSS 特效之心形-彩虹-加载动画&#xff08;居中抖动问题&#xff09;参考描述效果HTMLCSS重置元素的部分默认样式bodyli动画定义指定animationul居中抖动问题代码总汇参考 项目描述搜索引擎BingMDNMDN Web Docs 描述 项目描述Edge109.0.1518.61 (正式版本) (64 位) 效果 HTML…

海湾化学冲刺上交所上市:计划募资30亿元,华融曾是其股东

近日&#xff0c;青岛海湾化学股份有限公司&#xff08;下称“海湾化学”&#xff09;预披露招股书&#xff0c;准备在上海证券交易所主板上市。本次冲刺上市&#xff0c;海湾化学计划募资30亿元&#xff0c;将于37.5万吨/年环氧氯丙烷绿色循环经济项目&#xff08;一期&#x…

eBPF 入门开发实践指南二:在 eBPF 中使用 kprobe 监测捕获 unlink 系统调用

eBPF (Extended Berkeley Packet Filter) 是 Linux 内核上的一个强大的网络和性能分析工具。它允许开发者在内核运行时动态加载、更新和运行用户定义的代码。 本文是 eBPF 入门开发实践指南的第二篇&#xff0c;在 eBPF 中使用 kprobe 捕获 unlink 系统调用。 kprobes技术背景…

mysql面试

MySQL 一、MySQL存储引擎 1.MySQL体系结构 体系结构的概念 任何一套系统当中,每个部件都能起到一定的作用!例如:汽车。虽然由成千上万的零件构成,但是最重要的肯定是发动机。普通家用车:发动机排量在0.5 ~ 2.0升之间,买菜用。豪华跑车:发动机排量在2.0升以上,撩妹用。…

学习记录668@项目管理之项目沟通管理和干系人管理

书上这部分的内容很无趣、很花里花哨、很杂乱&#xff0c;所以本文只摘取我认为比较有用和有意义的片段。 沟通方式 在发送方自认为已经掌握了足够的信息&#xff0c;有了自己的想法且不需要进一步听取多方意见时&#xff0c;往往选择控制力极强、参与程度最弱的“叙述方式”&a…

CSS3基础内容

目录 CSS基本样式 选择器分类 标签选择器 类选择器 利用类选择器画三个盒子 多类名 id选择器 id选择器和类选择器的区别 通配符选择器 CSS字体属性 字体粗细font-weight 字体样式 CSS文本属性 CSS的引入方式 行内样式表&#xff08;行内式&#xff09; 内部样式表…

十大经典排序算法【算法思想+图解+代码】【数据结构与算法笔记】

前言&#xff1a;文中大部分为本人收集整理&#xff0c;综合学习资料&#xff0c;个人理解……。希望能帮助你少掉写头发&#xff0c;早日走出理解的深渊。因为写作较为仓促文中内容难免会有纰漏&#xff0c;发现可评论区回复&#xff08;无奖&#xff09;。排序(Sort)分析排序…