基于SpringBoot的导师双选系统设计与实现

news2024/10/6 18:25:43

目录

前言

 一、技术栈

二、系统功能介绍

管理员功能实现

导师信息管理

导师选择统计报表

学员管理

导师功能实现

项目信息管理

项目提交管理

学员功能实现

导师信息管理

项目信息管理

指导项目查看

三、核心代码

1、登录模块

 2、文件上传模块

3、代码封装


前言

如今的信息时代,对信息的共享性,信息的流通性有着较高要求,因此传统管理方式就不适合。为了让导师选择信息的管理模式进行升级,也为了更好的维护导师选择信息,卓越导师双选系统的开发运用就显得很有必要。并且通过开发卓越导师双选系统,不仅可以让所学的SpringBoot框架得到实际运用,也可以掌握MySQL的使用方法,对自身编程能力也有一个检验和提升的过程。尤其是通过实践,可以对系统的开发流程加深印象,无论是前期的分析与设计,还是后期的编码测试等环节,都可以有一个深刻的了解。

卓越导师双选系统根据调研,确定管理员管理学员,导师,管理项目信息,管理项目提交,管理指导项目信息。导师管理导师选择信息,管理项目,管理项目提交并对学员提交的项目进行指导。学员选择导师,查看项目,提交已完成的项目文件,查看导师对项目的指导信息。

借助于卓越导师双选系统这样的工具,让信息系统化,流程化,规范化是最终的发展结果,让其遵循实际操作流程的情况下,对导师选择信息实施规范化处理,让导师选择信息通过电子的方式进行保存,无论是管理人员检索导师选择信息,维护导师选择信息都可以便利化操作,真正缩短信息处理时间,节省人力和信息管理的成本。

 一、技术栈

末尾获取源码
SpringBoot+Vue+JS+ jQuery+Ajax...

二、系统功能介绍

管理员功能实现

导师信息管理

实现管理员权限的导师信息管理功能,其运行效果见下图。管理员修改导师所教科目信息,电话,邮箱,教师姓名等信息,可以删除指定的导师信息。

导师选择统计报表

实现管理员权限的导师选择统计报表功能,其运行效果见下图。管理员查看导师选择统计报表信息,查看选择各位导师的学员人数信息。

 

学员管理

实现管理员权限的学员管理功能,其运行效果见下图。管理员查看学员信息,对学员的资料进行修改,查询,删除等操作。

导师功能实现

项目信息管理

实现导师权限的项目信息管理功能,其运行效果见下图。导师新增项目,上传项目文件,修改项目信息,在本页面删除指定的项目信息。

 

项目提交管理

实现导师权限的项目提交管理功能,其运行效果见下图。导师下载学员提交的已完成的项目文件,导师点击指导项目按钮可以对学员提交的项目进行指导。

学员功能实现

导师信息管理

实现学员权限的导师信息管理功能,其运行效果见下图。学员查看导师所教科目,邮箱以及电话等信息,可以点击右侧的选择导师按钮对该导师进行选择。

 

项目信息管理

实现学员权限的项目信息管理功能,其运行效果见下图。学员查看项目信息,在规定时间内完成导师布置的项目,并在当前页面提交已完成的项目文件。

 

指导项目查看

实现学员权限的指导项目查看功能,其运行效果见下图。学员查看导师对自己提交的项目的指导信息。

 

三、核心代码

1、登录模块

 
package com.controller;
 
 
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
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.bind.annotation.RestController;
 
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;
 
/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;
 
	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }
 
	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }
 
	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }
 
    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
 
    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }
 
    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }
 
    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

 2、文件上传模块

package com.controller;
 
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
 
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;
 
/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

3、代码封装

package com.utils;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}
 
	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}
 
	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1084344.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

使用Java的GeoTools地理库计算某个点是否在多边形内,经纬度数组转换为wkt格式数据

前言 本章讲解使用Java的GeoTools地理库计算某个点是否在多边形内。 本章适用于后台服务的GIS电子围栏计算。 GeoTools介绍 GeoTools是开源的Java地理信息计算库。GeoServer地图引擎就是基于GeoTools库构建得地图服务,可以说非常强大。 官网地址:https://docs.geotools.or…

2023年【公路水运工程施工企业安全生产管理人员】考试题及公路水运工程施工企业安全生产管理人员操作证考试

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 公路水运工程施工企业安全生产管理人员考试题考前必练&#xff01;安全生产模拟考试一点通每个月更新公路水运工程施工企业安全生产管理人员操作证考试题目及答案&#xff01;多做几遍&#xff0c;其实通过公路水运工…

SpringBoot注解篇之@Resource与@Autowired

大家好&#xff0c;我是AK&#xff0c;最近在整理Java相关技术知识体系化&#xff1b;本篇主要介绍Resource 注解和 Autowired的区别以及使用&#xff0c;适合学习spring框架小伙伴了解学习。 目录 一、Resource与Autowired的区别二、Resource详解三、Autowired详解 一、Resour…

13SpringMVC中拦截器的配置(拦截规则)和多个拦截器的preHandle,postHandle执行顺序原理详解

拦截器 Servlet中的过滤器的实现及其原理,参考文章 配置一个拦截器 SpringMVC中请求的处理流程: 用户请求—>listener—>filter—>DispatcherServlet—>filter—>preHandle—>controller—>postHandle 第一步: 编写一个Java类实现HandlerInterceptor(…

基于SpringBoot的在线教育系统

目录 前言 一、技术栈 二、系统功能介绍 普通管理员管理 课程管理员管理 课程信息管理 用户信息管理 讲师信息管理 课程信息查看 讲师信息查看 三、核心代码 1、登录模块 2、文件上传模块 3、代码封装 前言 随着信息技术在管理上越来越深入而广泛的应用&#xff0c…

EDUSRC-记一个SHELL捡漏

目录 ​编辑 Jenkins - println绕过到shell命令执行 语法 Jenkins未授权访问(捡漏失败) Jenkins捡漏 弱口令 脚本执行(println失败) CHATGPT调教绕过 hack渗透视频教程&#xff0c;扫码免费领 Jenkins - println绕过到shell命令执行 语法 org"China Education and…

【excel技巧】如何在Excel表格中添加选项按钮?

不知道大家是否会9遇到需要勾中选项的情况&#xff0c;我们可以在电子表格中制作出可以勾选、选中的选项按钮&#xff0c;今天我们一起学习一下设置方法。 首先&#xff0c;我们需要先在excel工具栏中添加一个功能模块&#xff1a;开发工具 依次点击excel中的文件 – 选项 –…

【问题思考总结】二次型和二次曲面的关系【常数项的改变对曲面的影响】【图文】

问题 今天做到一个题的时候发现&#xff0c;之前记的结论记错了&#xff0c;一个方程本来应该是双叶双曲面我记得&#xff0c;结果答案竟然是圆锥面&#xff0c;后来发现原因是常数项等于0或者不等于0的差别。因此&#xff0c;就这个问题我们来通过图文的方式探讨一下两种情况…

【广州华锐互动】VR建筑施工事故体验:提高工人安全意识和责任感

VR建筑施工事故体验的意义在于通过模拟真实场景和情况&#xff0c;帮助人们更好地理解建筑施工中的安全问题&#xff0c;并提供一种安全、有效的方式来学习和掌握安全技能。 建筑施工是一项高风险的工作&#xff0c;涉及各种复杂的工作环境和操作过程。在现实中&#xff0c;建筑…

剧院建筑三维可视化综合管控平台提高安全管理效率

随着数字孪生技术的高速发展&#xff0c;智慧楼宇也被提上日程&#xff0c;以往楼宇管理存在着设备故障排查困难、能源浪费与管理不足、安全性和风险高等问题&#xff0c;而智慧楼宇数字孪生可视化中控平台&#xff0c;打造智慧楼宇管理一张图&#xff0c;实现了智慧建筑和楼宇…

资深8年测试整理,接口测试必备-加密与签名,让你不再走弯路...

目录&#xff1a;导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结&#xff08;尾部小惊喜&#xff09; 前言 1、接口加密解密 …

四.镜头知识之放大倍率

四.镜头知识之放大倍率 文章目录 四.镜头知识之放大倍率4.0 前言4.1 镜头的光学放大倍率的计算方法4.2 显示器的电子放大倍率4.2.1 智能硬件产品的显示放大倍率计算案例 4.3 系统放大倍率4.4 智能硬件产品的系统放大倍率计算案例4.4 智能硬件产品的系统放大倍率计算案例 4.0 前…

成绩分析数据的重要性,老师们一定要看过来!

成绩分析数据在教育领域中具有重要性&#xff0c;对于教师们来说是一项必不可少的工具。下面将详细介绍成绩分析数据的重要性&#xff0c;并强调为什么老师们一定要关注和利用这些数据。 **1. 了解学生的学习情况** 成绩分析数据可以帮助教师全面了解学生的学习情况。通过分析…

Jenkins发布失败记录

Exception when publishing, exception message [Exec exit status not zero. Status [127]] 见链接&#xff1a;Jenkins发布时常见异常&#xff08;持续更新...&#xff09;_exception when publishing, exception message [exec_码农StayUp的博客-CSDN博客 The remote end hu…

mysql sql语句遍历树结构

mysqlsql语句遍历树结构 MySQL SQL语句遍历树结构实现步骤 理解树结构和遍历算法 在开始之前&#xff0c;我们首先需要了解什么是树结构以及如何遍历树结构。树结构是一种常用的数据结构&#xff0c;由各个节点和节点之间的关系构成。树结构的一个重要应用是表示具有层级关系…

winscope使用方法

Ubuntu下Android T的winscope工具使用方法 1. 在Android的项目源码中&#xff0c;prebuilts/misc/common/winscope目录下 直接使用chrome浏览器打开文件winscope.html 2. 可能会提示adb问题 进入目录development/tools/winscope/adb_proxy&#xff0c;有文件winscope_proxy.…

地球系统模式的应用与进阶丨CESM丨Linux丨CLM丨代码修改等

目录 第一部分 运行前的准备 第二部分 Linux系统及编译 第三部分 CESM原理、结构 第四部分 CESM程序获取、结构及其功能 第五部分 CESM 移植、安装及快速运行 第六部分 CESM 配置选项及数据文件制备 第七部分 CESM单模块运行——以CLM为例 第八部分 CESM 的部分耦合运行…

TOGAF(企业架构)

TOGAF 核心概念&#xff08;官方原版&#xff09; 什么是TOGAF&#xff1f; TOGAF?是一种经验证的企业架构方法和框架&#xff0c;被世界领先的组织用于提高业务效率。它是一个企业架构标准&#xff0c;确保企业架构专业人员之间的标准、方法和通信一致&#xff0c;以便我们…

CentOS 7 服务器上创建新用户及设置用户密码有效期

一、创建用户 1、以 root 用户身份登录到 CentOS 服务器 2、运行以下命令以创建新用户&#xff1a; useradd -m -s /bin/bash username其中&#xff0c;username 是您要创建的新用户的用户名。该命令将创建一个新用户并为其分配一个主目录。3、运行以下命令以设置新用户的密码…

泛微低代码平台应用合集,开箱即用,助力组织快速数字化

随着数字化进程的不断深入&#xff0c;各行业对数字化转型的认知不断加深&#xff0c;组织数字化的步伐越来越快。 数字化对组织创新能力加强、生产效率提升、运营成本下降等方面有显著成效&#xff0c;但是组织数字化转型之路面临不少挑战&#xff1a; 数字化挑战 1、数字化…