Java全栈项目-学生创新创业项目管理系统
项目简介
本项目是一个基于Spring Boot + Vue.js的前后端分离项目,旨在为高校学生创新创业项目提供全流程管理平台。系统集成了项目申报、审核、过程管理、成果展示等功能模块。
技术栈
后端技术
- Spring Boot 2.7.x
- Spring Security
- MyBatis Plus
- MySQL 8.0
- Redis
- JWT认证
前端技术
- Vue 3
- Element Plus
- Axios
- Vuex
- Vue Router
核心功能模块
-
用户权限管理
- 多角色管理(学生、教师、管理员)
- 基于RBAC的权限控制
- JWT token认证
-
项目管理
- 项目申报
- 项目审核
- 项目进度跟踪
- 项目文档管理
-
团队协作
- 团队组建
- 成员管理
- 任务分配
- 进度反馈
-
资源管理
- 项目资料上传下载
- 项目经费管理
- 设备资源申请
核心代码示例
后端JWT认证配置
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/api/auth/**").permitAll()
.anyRequest().authenticated();
http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
}
}
前端项目列表组件
<template>
<div class="project-list">
<el-table :data="projectList" style="width: 100%">
<el-table-column prop="name" label="项目名称"></el-table-column>
<el-table-column prop="leader" label="负责人"></el-table-column>
<el-table-column prop="status" label="状态"></el-table-column>
<el-table-column label="操作">
<template #default="scope">
<el-button @click="handleEdit(scope.row)">编辑</el-button>
<el-button type="danger" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
项目特点
-
前后端分离架构
- 提高开发效率
- 便于维护和扩展
- 更好的用户体验
-
安全性设计
- JWT token认证
- 角色权限控制
- 数据加密传输
-
高性能
- Redis缓存
- MyBatis Plus性能优化
- 前端组件懒加载
-
易用性
- 直观的用户界面
- 完善的操作指引
- 响应式设计
部署方案
-
后端部署
- 使用Docker容器化部署
- Nginx反向代理
- MySQL主从复制
-
前端部署
- Nginx静态资源服务器
- CDN加速
- 生产环境代码压缩
总结
本项目采用主流的Java全栈技术栈,实现了一个功能完善的学生创新创业项目管理系统。通过前后端分离的架构设计,确保了系统的可扩展性和维护性。项目的实现过程中注重了性能优化和安全性设计,为用户提供了良好的使用体验。
学生创新创业项目管理系统详细设计
一、用户权限管理模块
1. 数据库设计
-- 用户表
CREATE TABLE sys_user (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(50) NOT NULL,
password VARCHAR(100) NOT NULL,
real_name VARCHAR(50),
email VARCHAR(100),
phone VARCHAR(20),
status TINYINT DEFAULT 1,
create_time DATETIME,
update_time DATETIME
);
-- 角色表
CREATE TABLE sys_role (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
role_name VARCHAR(50) NOT NULL,
role_code VARCHAR(50) NOT NULL,
description VARCHAR(200),
status TINYINT DEFAULT 1
);
-- 权限表
CREATE TABLE sys_permission (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
permission_name VARCHAR(50) NOT NULL,
permission_code VARCHAR(50) NOT NULL,
url VARCHAR(200),
type TINYINT,
status TINYINT DEFAULT 1
);
-- 用户角色关联表
CREATE TABLE sys_user_role (
user_id BIGINT,
role_id BIGINT,
PRIMARY KEY (user_id, role_id)
);
-- 角色权限关联表
CREATE TABLE sys_role_permission (
role_id BIGINT,
permission_id BIGINT,
PRIMARY KEY (role_id, permission_id)
);
2. 核心业务实体
@Data
@TableName("sys_user")
public class User implements Serializable {
private Long id;
private String username;
private String password;
private String realName;
private String email;
private String phone;
private Integer status;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}
3. JWT认证实现
@Component
public class JwtTokenUtil {
@Value("${jwt.secret}")
private String secret;
@Value("${jwt.expiration}")
private Long expiration;
public String generateToken(UserDetails userDetails) {
Map<String, Object> claims = new HashMap<>();
claims.put("username", userDetails.getUsername());
claims.put("created", new Date());
return generateToken(claims);
}
private String generateToken(Map<String, Object> claims) {
return Jwts.builder()
.setClaims(claims)
.setExpiration(new Date(System.currentTimeMillis() + expiration * 1000))
.signWith(SignatureAlgorithm.HS512, secret)
.compact();
}
}
4. 权限控制实现
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Autowired
private RoleMapper roleMapper;
@Override
@Transactional
public void assignRole(Long userId, List<Long> roleIds) {
// 删除原有角色
userMapper.deleteUserRoles(userId);
// 分配新角色
if (!CollectionUtils.isEmpty(roleIds)) {
roleIds.forEach(roleId -> {
userMapper.insertUserRole(userId, roleId);
});
}
}
}
二、项目管理模块
1. 数据库设计
-- 项目表
CREATE TABLE project (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
project_name VARCHAR(100) NOT NULL,
project_code VARCHAR(50) NOT NULL,
description TEXT,
leader_id BIGINT,
teacher_id BIGINT,
status TINYINT,
start_time DATETIME,
end_time DATETIME,
create_time DATETIME,
update_time DATETIME
);
-- 项目成员表
CREATE TABLE project_member (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
project_id BIGINT,
user_id BIGINT,
role_type TINYINT,
join_time DATETIME
);
-- 项目文档表
CREATE TABLE project_document (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
project_id BIGINT,
doc_name VARCHAR(100),
doc_type VARCHAR(50),
file_path VARCHAR(200),
upload_user_id BIGINT,
upload_time DATETIME
);
-- 项目进度表
CREATE TABLE project_progress (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
project_id BIGINT,
title VARCHAR(100),
content TEXT,
completion_rate INT,
reporter_id BIGINT,
report_time DATETIME
);
2. 项目申报流程
@Service
public class ProjectApplyServiceImpl implements ProjectApplyService {
@Autowired
private ProjectMapper projectMapper;
@Override
@Transactional
public void applyProject(ProjectApplyDTO applyDTO) {
// 1. 基本信息验证
validateProjectInfo(applyDTO);
// 2. 保存项目信息
Project project = convertToEntity(applyDTO);
projectMapper.insert(project);
// 3. 保存团队成员信息
saveProjectMembers(project.getId(), applyDTO.getMembers());
// 4. 发送审核通知
sendApprovalNotification(project);
}
}
3. 项目审核流程
@Service
public class ProjectApprovalServiceImpl implements ProjectApprovalService {
@Override
@Transactional
public void approveProject(Long projectId, ApprovalDTO approvalDTO) {
// 1. 验证审核权限
validateApprovalPermission(approvalDTO.getApproverId());
// 2. 更新项目状态
Project project = projectMapper.selectById(projectId);
project.setStatus(approvalDTO.getApprovalStatus());
project.setUpdateTime(LocalDateTime.now());
projectMapper.updateById(project);
// 3. 记录审核日志
saveApprovalLog(projectId, approvalDTO);
// 4. 发送审核结果通知
sendApprovalResultNotification(project, approvalDTO);
}
}
4. 项目进度管理
@RestController
@RequestMapping("/api/project/progress")
public class ProjectProgressController {
@PostMapping("/report")
public Result reportProgress(@RequestBody ProgressReportDTO reportDTO) {
progressService.saveProgress(reportDTO);
return Result.success();
}
@GetMapping("/list/{projectId}")
public Result getProjectProgress(@PathVariable Long projectId) {
List<ProgressVO> progressList = progressService.getProgressByProject(projectId);
return Result.success(progressList);
}
}
5. 文档管理实现
@Service
public class ProjectDocumentServiceImpl implements ProjectDocumentService {
@Value("${file.upload.path}")
private String uploadPath;
@Override
public String uploadDocument(MultipartFile file, Long projectId, Long userId) {
// 1. 文件格式验证
validateFileFormat(file);
// 2. 生成文件存储路径
String filePath = generateFilePath(projectId, file.getOriginalFilename());
// 3. 保存文件
saveFile(file, filePath);
// 4. 记录文档信息
ProjectDocument document = new ProjectDocument();
document.setProjectId(projectId);
document.setDocName(file.getOriginalFilename());
document.setFilePath(filePath);
document.setUploadUserId(userId);
document.setUploadTime(LocalDateTime.now());
documentMapper.insert(document);
return filePath;
}
}
三、前端实现示例
1. 项目申报表单
<template>
<el-form :model="projectForm" :rules="rules" ref="projectForm">
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="projectForm.projectName"></el-input>
</el-form-item>
<el-form-item label="项目描述" prop="description">
<el-input type="textarea" v-model="projectForm.description"></el-input>
</el-form-item>
<el-form-item label="指导教师" prop="teacherId">
<el-select v-model="projectForm.teacherId">
<el-option
v-for="teacher in teacherList"
:key="teacher.id"
:label="teacher.realName"
:value="teacher.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm">提交申请</el-button>
</el-form-item>
</el-form>
</template>
2. 项目进度跟踪
<template>
<div class="progress-tracking">
<el-timeline>
<el-timeline-item
v-for="(progress, index) in progressList"
:key="index"
:timestamp="progress.reportTime"
:type="getProgressType(progress.completionRate)">
<h4>{{ progress.title }}</h4>
<p>{{ progress.content }}</p>
<el-progress
:percentage="progress.completionRate"
:status="getProgressStatus(progress.completionRate)">
</el-progress>
</el-timeline-item>
</el-timeline>
</div>
</template>
以上是系统核心模块的详细设计和实现示例。每个模块都包含了必要的数据库设计、后端服务实现和前端界面展示。系统通过RBAC模型实现权限控制,使用JWT进行身份认证,确保了系统的安全性。项目管理模块则实现了完整的项目生命周期管理,包括申报、审核、进度跟踪和文档管理等功能。
学生创新创业项目管理系统详细设计(续)
一、团队协作模块
1. 数据库设计
-- 团队表
CREATE TABLE team (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
team_name VARCHAR(100) NOT NULL,
project_id BIGINT,
leader_id BIGINT,
description TEXT,
status TINYINT,
create_time DATETIME,
update_time DATETIME
);
-- 团队任务表
CREATE TABLE team_task (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
team_id BIGINT,
task_name VARCHAR(100),
description TEXT,
assignee_id BIGINT,
priority TINYINT,
status TINYINT,
start_time DATETIME,
end_time DATETIME,
create_time DATETIME
);
-- 任务反馈表
CREATE TABLE task_feedback (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
task_id BIGINT,
content TEXT,
completion_rate INT,
submitter_id BIGINT,
submit_time DATETIME
);
2. 团队组建与成员管理
@Service
public class TeamServiceImpl implements TeamService {
@Autowired
private TeamMapper teamMapper;
@Override
@Transactional
public void createTeam(TeamCreateDTO teamDTO) {
// 1. 创建团队基本信息
Team team = new Team();
BeanUtils.copyProperties(teamDTO, team);
team.setCreateTime(LocalDateTime.now());
team.setStatus(TeamStatusEnum.ACTIVE.getCode());
teamMapper.insert(team);
// 2. 添加团队成员
addTeamMembers(team.getId(), teamDTO.getMembers());
// 3. 发送团队创建通知
sendTeamNotification(team, teamDTO.getMembers());
}
@Override
public void updateTeamMember(Long teamId, List<TeamMemberDTO> members) {
// 验证权限
validatePermission(teamId);
// 更新成员
teamMapper.deleteTeamMembers(teamId);
addTeamMembers(teamId, members);
}
}
3. 任务管理实现
@Service
public class TaskServiceImpl implements TaskService {
@Autowired
private TaskMapper taskMapper;
@Override
public void assignTask(TaskAssignDTO taskDTO) {
TeamTask task = new TeamTask();
BeanUtils.copyProperties(taskDTO, task);
// 设置任务状态
task.setStatus(TaskStatusEnum.PENDING.getCode());
task.setCreateTime(LocalDateTime.now());
taskMapper.insert(task);
// 发送任务分配通知
notifyTaskAssignment(task);
}
@Override
public void submitTaskFeedback(TaskFeedbackDTO feedbackDTO) {
TaskFeedback feedback = new TaskFeedback();
BeanUtils.copyProperties(feedbackDTO, feedback);
feedback.setSubmitTime(LocalDateTime.now());
taskFeedbackMapper.insert(feedback);
// 更新任务完成进度
updateTaskProgress(feedbackDTO.getTaskId(), feedbackDTO.getCompletionRate());
}
}
二、资源管理模块
1. 数据库设计
-- 项目资料表
CREATE TABLE project_material (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
project_id BIGINT,
material_name VARCHAR(100),
file_path VARCHAR(200),
file_size BIGINT,
file_type VARCHAR(50),
upload_user_id BIGINT,
upload_time DATETIME
);
-- 项目经费表
CREATE TABLE project_fund (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
project_id BIGINT,
amount DECIMAL(10,2),
fund_type TINYINT,
description VARCHAR(200),
status TINYINT,
applicant_id BIGINT,
apply_time DATETIME,
approve_time DATETIME
);
-- 设备资源表
CREATE TABLE equipment (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
equipment_name VARCHAR(100),
equipment_code VARCHAR(50),
status TINYINT,
description TEXT
);
-- 设备申请记录表
CREATE TABLE equipment_apply (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
equipment_id BIGINT,
project_id BIGINT,
applicant_id BIGINT,
start_time DATETIME,
end_time DATETIME,
purpose VARCHAR(200),
status TINYINT,
apply_time DATETIME
);
2. 项目资料管理
@Service
public class MaterialServiceImpl implements MaterialService {
@Value("${material.upload.path}")
private String uploadPath;
@Override
public MaterialVO uploadMaterial(MultipartFile file, Long projectId, Long userId) {
// 1. 文件存储
String filePath = FileUtil.saveFile(file, uploadPath);
// 2. 记录资料信息
ProjectMaterial material = new ProjectMaterial();
material.setProjectId(projectId);
material.setMaterialName(file.getOriginalFilename());
material.setFilePath(filePath);
material.setFileSize(file.getSize());
material.setFileType(FileUtil.getFileType(file.getOriginalFilename()));
material.setUploadUserId(userId);
material.setUploadTime(LocalDateTime.now());
materialMapper.insert(material);
return convertToVO(material);
}
@Override
public void downloadMaterial(Long materialId, HttpServletResponse response) {
ProjectMaterial material = materialMapper.selectById(materialId);
FileUtil.downloadFile(material.getFilePath(), material.getMaterialName(), response);
}
}
3. 经费管理实现
@Service
public class FundServiceImpl implements FundService {
@Override
@Transactional
public void applyFund(FundApplyDTO applyDTO) {
// 验证项目经费额度
validateFundLimit(applyDTO.getProjectId(), applyDTO.getAmount());
ProjectFund fund = new ProjectFund();
BeanUtils.copyProperties(applyDTO, fund);
fund.setStatus(FundStatusEnum.PENDING.getCode());
fund.setApplyTime(LocalDateTime.now());
fundMapper.insert(fund);
// 发送经费申请通知
sendFundApplyNotification(fund);
}
@Override
public void approveFund(Long fundId, Boolean approved, String comment) {
ProjectFund fund = fundMapper.selectById(fundId);
fund.setStatus(approved ? FundStatusEnum.APPROVED.getCode() :
FundStatusEnum.REJECTED.getCode());
fund.setApproveTime(LocalDateTime.now());
fundMapper.updateById(fund);
// 更新项目经费使用记录
if (approved) {
updateProjectFundUsage(fund.getProjectId(), fund.getAmount());
}
}
}
4. 设备资源申请
@Service
public class EquipmentServiceImpl implements EquipmentService {
@Override
public void applyEquipment(EquipmentApplyDTO applyDTO) {
// 检查设备可用性
checkEquipmentAvailability(applyDTO.getEquipmentId(),
applyDTO.getStartTime(),
applyDTO.getEndTime());
EquipmentApply apply = new EquipmentApply();
BeanUtils.copyProperties(applyDTO, apply);
apply.setStatus(EquipmentApplyStatusEnum.PENDING.getCode());
apply.setApplyTime(LocalDateTime.now());
equipmentApplyMapper.insert(apply);
// 发送设备申请通知
notifyEquipmentApplication(apply);
}
@Override
public List<EquipmentVO> getAvailableEquipments(LocalDateTime startTime,
LocalDateTime endTime) {
return equipmentMapper.selectAvailableEquipments(startTime, endTime);
}
}
三、前端实现示例
1. 团队任务管理
<template>
<div class="task-management">
<el-card>
<template #header>
<div class="card-header">
<span>任务管理</span>
<el-button type="primary" @click="showAddTaskDialog">新建任务</el-button>
</div>
</template>
<el-table :data="taskList" style="width: 100%">
<el-table-column prop="taskName" label="任务名称"></el-table-column>
<el-table-column prop="assigneeName" label="负责人"></el-table-column>
<el-table-column prop="status" label="状态">
<template #default="scope">
<el-tag :type="getStatusType(scope.row.status)">
{{ getStatusText(scope.row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="endTime" label="截止时间"></el-table-column>
<el-table-column label="操作">
<template #default="scope">
<el-button @click="showFeedbackDialog(scope.row)">提交反馈</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
2. 经费管理界面
<template>
<div class="fund-management">
<el-row :gutter="20">
<el-col :span="8">
<el-card class="fund-statistics">
<div class="fund-total">
<div class="label">总经费</div>
<div class="amount">¥ {{ totalAmount }}</div>
</div>
<el-progress
:percentage="usagePercentage"
:format="percentageFormat">
</el-progress>
</el-card>
</el-col>
</el-row>
<el-card class="fund-list">
<template #header>
<div class="card-header">
<span>经费申请记录</span>
<el-button type="primary" @click="showApplyDialog">申请经费</el-button>
</div>
</template>
<el-table :data="fundList">
<el-table-column prop="amount" label="申请金额"></el-table-column>
<el-table-column prop="fundType" label="用途"></el-table-column>
<el-table-column prop="status" label="状态"></el-table-column>
<el-table-column prop="applyTime" label="申请时间"></el-table-column>
</el-table>
</el-card>
</div>
</template>
3. 设备资源申请
<template>
<div class="equipment-apply">
<el-form :model="applyForm" :rules="rules" ref="applyForm">
<el-form-item label="设备选择" prop="equipmentId">
<el-select v-model="applyForm.equipmentId">
<el-option
v-for="item in equipmentList"
:key="item.id"
:label="item.equipmentName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="使用时间" prop="timeRange">
<el-date-picker
v-model="applyForm.timeRange"
type="datetimerange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="使用目的" prop="purpose">
<el-input
type="textarea"
v-model="applyForm.purpose">
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitApply">提交申请</el-button>
</el-form-item>
</el-form>
</div>
</template>
以上是团队协作和资源管理模块的详细设计和实现示例。系统通过这些模块实现了团队的组建、任务分配、进度跟踪,以及项目资源的全方位管理,包括资料管理、经费管理和设备资源申请等功能。每个功能都包含了完整的后端服务实现和前端界面展示,确保了系统的实用性和易用性。