一、个人简介
- 💖💖作者:计算机编程果茶熊
- 💙💙个人简介:曾长期从事计算机专业培训教学,担任过编程老师,同时本人也热爱上课教学,擅长Java、微信小程序、Python、Golang、安卓Android等多个IT方向。会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我!
- 💛💛想说的话:感谢大家的关注与支持!
- 💜💜
- 网站实战项目
- 安卓/小程序实战项目
- 大数据实战项目
- 计算机毕业设计选题
- 💕💕文末获取源码联系计算机编程果茶熊
二、系统介绍
- 开发语言:Java
- 后端框架:Spring Boot(Spring+SpringMVC+Mybatis)
- 前端:Vue
- 数据库:MySQL
- 系统架构:B/S
- 开发工具:IDEA
《校园活动中心线上管理系统》是一款基于Java语言开发的综合性校园服务平台,采用Spring Boot框架构建后端服务,结合Vue前端技术和MySQL数据库,通过B/S架构为高校师生提供便捷的活动场地管理解决方案。系统整合了用户管理、场地类型管理、场地信息管理、活动分类管理、活动信息管理、场地预约管理、活动预约管理、留言板和系统管理等九大核心功能模块,实现了从用户注册认证到场地预约、活动组织的全流程数字化管理。平台支持多角色权限控制,管理员可对场地资源和活动信息进行统一维护,普通用户能够便捷地浏览场地信息、提交预约申请和参与活动报名,通过留言板功能促进用户间的交流互动。系统界面简洁友好,操作流程清晰明了,有效提升了校园活动组织的效率和场地资源的利用率,为构建智慧校园生态提供了有力支撑。
三、视频解说
四、部分功能展示
五、部分代码展示
import org.apache.spark.sql.SparkSession;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
@Service
public class VenueBookingService {
@Autowired
private VenueBookingMapper venueBookingMapper;
@Autowired
private VenueInfoMapper venueInfoMapper;
private SparkSession spark = SparkSession.builder()
.appName("Campus Activity Management System")
.master("local[*]")
.getOrCreate();
public Result submitBookingApplication(BookingApplication application) {
if (application.getVenueId() == null || application.getBookingDate() == null) {
return Result.error("场地ID和预约日期不能为空");
}
VenueInfo venue = venueInfoMapper.selectById(application.getVenueId());
if (venue == null) {
return Result.error("所选场地不存在");
}
if (venue.getStatus() != 1) {
return Result.error("该场地当前不可预约");
}
LocalDateTime startTime = application.getStartTime();
LocalDateTime endTime = application.getEndTime();
if (startTime.isAfter(endTime) || startTime.isBefore(LocalDateTime.now())) {
return Result.error("预约时间设置不合理");
}
List<VenueBooking> conflictBookings = venueBookingMapper.findConflictBookings(
application.getVenueId(), startTime, endTime);
if (!conflictBookings.isEmpty()) {
return Result.error("所选时间段已被预约,请选择其他时间");
}
VenueBooking booking = new VenueBooking();
booking.setVenueId(application.getVenueId());
booking.setUserId(application.getUserId());
booking.setBookingDate(application.getBookingDate());
booking.setStartTime(startTime);
booking.setEndTime(endTime);
booking.setBookingPurpose(application.getPurpose());
booking.setContactPhone(application.getContactPhone());
booking.setStatus(0);
booking.setCreateTime(LocalDateTime.now());
booking.setUpdateTime(LocalDateTime.now());
int result = venueBookingMapper.insert(booking);
if (result > 0) {
Dataset<Row> bookingData = spark.read()
.format("jdbc")
.option("url", "jdbc:mysql://localhost:3306/campus_activity")
.option("dbtable", "venue_booking")
.option("user", "root")
.option("password", "123456")
.load();
bookingData.filter(bookingData.col("venue_id").equalTo(application.getVenueId()))
.groupBy("booking_date")
.count()
.show();
return Result.success("预约申请提交成功,请等待审核");
}
return Result.error("预约申请提交失败");
}
public Result processActivityRegistration(ActivityRegistration registration) {
if (registration.getActivityId() == null || registration.getUserId() == null) {
return Result.error("活动ID和用户ID不能为空");
}
ActivityInfo activity = activityInfoMapper.selectById(registration.getActivityId());
if (activity == null) {
return Result.error("所选活动不存在");
}
if (activity.getRegistrationDeadline().isBefore(LocalDateTime.now())) {
return Result.error("活动报名已截止");
}
if (activity.getCurrentParticipants() >= activity.getMaxParticipants()) {
return Result.error("活动报名人数已满");
}
ActivityRegistration existingRegistration = activityRegistrationMapper.findByActivityAndUser(
registration.getActivityId(), registration.getUserId());
if (existingRegistration != null) {
return Result.error("您已报名该活动,请勿重复报名");
}
UserInfo user = userInfoMapper.selectById(registration.getUserId());
if (user == null || user.getStatus() != 1) {
return Result.error("用户状态异常,无法完成报名");
}
registration.setRegistrationTime(LocalDateTime.now());
registration.setStatus(1);
int insertResult = activityRegistrationMapper.insert(registration);
if (insertResult > 0) {
activity.setCurrentParticipants(activity.getCurrentParticipants() + 1);
activityInfoMapper.updateById(activity);
Dataset<Row> registrationData = spark.read()
.format("jdbc")
.option("url", "jdbc:mysql://localhost:3306/campus_activity")
.option("dbtable", "activity_registration")
.option("user", "root")
.option("password", "123456")
.load();
registrationData.filter(registrationData.col("activity_id").equalTo(registration.getActivityId()))
.select("user_id", "registration_time")
.orderBy("registration_time")
.show();
MessageTemplate template = new MessageTemplate();
template.setUserId(registration.getUserId());
template.setTitle("活动报名成功通知");
template.setContent("您已成功报名活动:" + activity.getActivityName());
template.setSendTime(LocalDateTime.now());
messageService.sendNotification(template);
return Result.success("活动报名成功");
}
return Result.error("活动报名失败,请重试");
}
public Result manageUserPermissions(Long userId, UserPermissionUpdate update) {
if (userId == null || update.getRoleId() == null) {
return Result.error("用户ID和角色ID不能为空");
}
UserInfo user = userInfoMapper.selectById(userId);
if (user == null) {
return Result.error("目标用户不存在");
}
RoleInfo role = roleInfoMapper.selectById(update.getRoleId());
if (role == null) {
return Result.error("指定角色不存在");
}
UserInfo currentUser = getCurrentUser();
if (currentUser.getRoleLevel() <= user.getRoleLevel()) {
return Result.error("权限不足,无法修改同级或更高级用户权限");
}
List<UserRole> existingRoles = userRoleMapper.findByUserId(userId);
for (UserRole existingRole : existingRoles) {
userRoleMapper.deleteById(existingRole.getId());
}
UserRole newUserRole = new UserRole();
newUserRole.setUserId(userId);
newUserRole.setRoleId(update.getRoleId());
newUserRole.setCreateTime(LocalDateTime.now());
newUserRole.setCreateBy(currentUser.getUserId());
int result = userRoleMapper.insert(newUserRole);
if (result > 0) {
user.setRoleLevel(role.getRoleLevel());
user.setUpdateTime(LocalDateTime.now());
user.setUpdateBy(currentUser.getUserId());
userInfoMapper.updateById(user);
Dataset<Row> userRoleData = spark.read()
.format("jdbc")
.option("url", "jdbc:mysql://localhost:3306/campus_activity")
.option("dbtable", "user_role")
.option("user", "root")
.option("password", "123456")
.load();
userRoleData.filter(userRoleData.col("user_id").equalTo(userId))
.join(spark.read().format("jdbc")
.option("url", "jdbc:mysql://localhost:3306/campus_activity")
.option("dbtable", "role_info")
.option("user", "root")
.option("password", "123456")
.load(), "role_id")
.select("user_id", "role_name", "role_level")
.show();
SystemLog log = new SystemLog();
log.setOperatorId(currentUser.getUserId());
log.setOperationType("USER_PERMISSION_UPDATE");
log.setTargetId(userId);
log.setOperationDesc("修改用户权限:" + user.getUsername() + " -> " + role.getRoleName());
log.setCreateTime(LocalDateTime.now());
systemLogMapper.insert(log);
return Result.success("用户权限修改成功");
}
return Result.error("用户权限修改失败");
}
}
六、部分文档展示
七、END
💕💕文末获取源码联系计算机编程果茶熊