基于SpringBoot的实习管理系统

news2024/10/7 16:19:57

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SpringBoot
前端:Vue、HTML
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能

三、系统项目截图

3.1前台首页

3.2后台管理

四、核心代码

4.1登录相关

4.2文件上传

4.3封装


一、项目简介

基于SpringBoot的实习管理系统利用网络沟通、计算机信息存储管理,有着与传统的方式所无法替代的优点。比如计算检索速度特别快、可靠性特别高、存储容量特别大、保密性特别好、可保存时间特别长、成本特别低等。在工作效率上,能够得到极大地提高,延伸至服务水平也会有好的收获,有了网络,基于SpringBoot的实习管理系统的各方面的管理更加科学和系统,更加规范和简便。


二、系统功能

基于SpringBoot的实习管理系统主要包括四大功能模块,即管理员、教师、实习单位和学生。

(1)管理员模块:首页、个人中心、班级管理、学生管理、教师管理、实习单位管理、实习作业管理、教师评分管理、单位成绩管理、系统管理。

(2)教师:首页、个人中心、实习作业、教师评分。

(3)实习单位:首页、个人中心、实习作业管理、单位成绩管理。

(4)学生:首页、个人中心、实习作业管理、教师评分管理、单位成绩管理。



三、系统项目截图

3.1前台首页

 前台学生注册页面

教师、学生和实习单位登录页面

 登录以后可以在前台个人中心查看自己的信息,还有首页、系统公告、后台管理这几个功能。

 在学生的后台中有首页、个人中心、实习作业管理、教师评分管理、单位成绩管理。

 在实习作业学生可以通过这个模块上传自己的实习报告。

3.2后台管理

 管理员后台登录。

管理员登录以后有首页、个人中心、班级管理、学生管理、教师管理、实习单位管理、实习作业管理、教师评分管理、单位成绩管理、系统管理。

 管理员可以查看目前已经有的实习单位并且可以对实习单位进行增删查改。


四、核心代码

4.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();
    }
}

4.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);
	}
	
}

4.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/45597.html

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

相关文章

Unity与IOS⭐Xcode打包,上架TestFlight的完整教程

文章目录 🟥 本章注意事项1️⃣ 证书及Archive2️⃣ 更新版本及加密规则🟧 Xcode打包出ipa文件🟨 将ipa上传到App Store Connect🟥 本章注意事项 1️⃣ 证书及Archive 上架TestFlight需要苹果企业版证书,而不是个人版证书。Archive时必须插上手机,否则会失败。2️⃣…

Prometheus 采集rabbitmq监控数据

Prometheus采集主机监控参考部署下载&#xff0c;图形生成 系统安装Grafana downloadWindows参考图形生成参考win_exporterLinux参考node_exporterMysql参考Mysql_exporterSQL Server参考SQL exporterRedis 参考Redis_exportercadvisor参考cadvisorrabbitmq参考参考rabbitmq s…

众多互联网公司都在用的Elasticsearch还不会?熬夜整理基于 Elasticsearch 7.x 版本的核心知识学习手册,值得拥有!

简介 简单来说 ElasticSearch 就是一个搜索框架。对于搜索这个词我们并不陌生&#xff0c;当我们输入关键词后&#xff0c;返回含有该关键词的所有信息结果。 在我们平时用到最多的便是数据库搜索&#xff1a; SELECT * FROM USE WHERE NAME LIKE %小菜%但是用数据库做搜索存…

Scala函数至简原则

一、Scala中的函数基础知识 1、基本语法 【函数和方法的区别】 【核心概念】 &#xff08;1&#xff09;为完成某一功能的程序语句的集合&#xff0c;称为函数。 &#xff08;2&#xff09;类中的函数称之方法。 【案例实操】 &#xff08;1&#xff09;Scala 语言可以在任何…

THP Maleimide,1314929-99-1,THP-Mal凯新生物双功能螯合剂

一、产品描述&#xff1a; THP-Mal 双功能螯合剂。肽和抗体标记。对SH基团的特异性反应&#xff0c;如半胱氨酸。炔烃马来酰亚胺是一种双功能接头试剂&#xff0c;可将末端炔烃连接到各种含硫醇分子&#xff0c;例如含有半胱氨酸残基的蛋白质&#xff0c;然后可以通过铜催化的…

2022腾讯全球数字生态大会【存储专场】它来了|预约有礼

它来了&#xff01;它来了&#xff01; 2022腾讯全球数字生态大会【存储专场】它来了&#xff01; 作为腾讯集团产业互联网规格最高、规模最大、覆盖面最广的年度盛会 今年存储专场与您一起探讨 分布式高性能存储与数据分析处理的科技创新和最新成果 存储会场六大亮点&…

java 基于 SpringMVC+Mybaties+ Html5 + Vue 前后端分离 房地产管理系统 的 设计与实现

一.项目介绍 本系统分为 两大块 前端 和 后端 &#xff08;前后端分离&#xff09; 角色分为三类&#xff1a; 管理员 销售 以及 普通用户 前端模块有&#xff1a;首页、房屋中心、关于大厦、新闻资讯、个人中心、后台管理、客服售后 其中个人中心&#xff1a;个人中心、我的收…

1.线性代数基础

1.矩阵 2. 特殊矩阵 正交矩阵 AATE&#xff08;E为单位矩阵&#xff0c;AT表示“矩阵A的转置矩阵”。&#xff09;或ATAE&#xff0c;则n阶实矩阵A称为正交矩阵 正交矩阵有如下性质&#xff1a; A是正交矩阵&#xff0c;AT也是正交矩阵A的各行是单位向量且两两正交&#xff0…

Google Earth Engine(GEE)——NASA NEX GDPDDP CMIP5数据集中的问题

问题&#xff1a; 我正在使用 NASA NEX GDPDDP CMIP5 集合。我注意到模型“GFDL-CM3”似乎缺少场景 RCP4.5 的 2096-2099 年。 您可以通过此脚本查看丢失的图像&#xff0c;并与模型 ACCESS1-0 进行比较&#xff1a; https://code.earthengine.google.com/7b505c81a59f10ba5…

[附源码]Python计算机毕业设计Django的高校车辆租赁管理系统

项目运行 环境配置&#xff1a; Pychram社区版 python3.7.7 Mysql5.7 HBuilderXlist pipNavicat11Djangonodejs。 项目技术&#xff1a; django python Vue 等等组成&#xff0c;B/S模式 pychram管理等等。 环境需要 1.运行环境&#xff1a;最好是python3.7.7&#xff0c;…

学习笔记11月27日

Infant Brain Deformable Registration Using Global and Local Label-Driven Deep Regression Learning 文章来源&#xff1a;谷歌学术 一、摘要 婴儿大脑磁共振&#xff08;MR&#xff09;图像的可变形配准具有挑战性&#xff0c;因为&#xff1a;(1)这些纵向图像存在较大的…

【MySQL】读写分离主从复制

1. 原理篇 1.1 读写分离问题场景&#xff1a; 高并发场景&#xff0c;读数据操作远高于写数据操作 —— 为了实现读写分离&#xff0c;我们使用数据库的主从复制&#xff1a; 1.2 主从复制&#xff1a; 实现主从复制的流程如下&#xff1a; MySQL 的主从复制实现机制如下&am…

shell基本命令

shell基本命令 echo&#xff1a; -n&#xff1a;取消输出后行末的换行符号 -e&#xff1a;支持反斜线控制的字符转换 echo -e "\a":输出警告声 echo -e "\e[1;31m abcd \e[0m"&#xff1a;输出带颜色的信息bash执行方法&#xff1a; 给bash文件添加执行…

《龙湖地产》企业门户网站前端设计(Html,CSS,JavaScript,jQuery)

目 录 引言 1 一、企业网站建设方案 2 &#xff08;一&#xff09;搭建网站的必要性和可行性 2 &#xff08;二&#xff09;网站建设的目的 2 &#xff08;三&#xff09;网站设计原则 2 二、企业网站开发工具的选择和介绍 4 &#xff08;一&#xff09; HTML概述 4 &#xff0…

上市公司共同机构所有权数据-附顶刊《管理世界》数据应用示例

1、数据来源&#xff1a;见数据说明文件 2、时间跨度&#xff1a;2003-2020 3、区域范围&#xff1a;所有上海、深圳证券交易所A股主板、中小企业板、科创板、创业板上市公司 4、指标说明&#xff1a; 具体计算方式详见分享文件夹文本文档 描述性统计如下&#xff1a; 部分…

Docker容器学习笔记(看了狂神视频)

狂神的笔记更加系统详细&#xff0c;推荐大家可以去看狂神的视频教程和笔记。我这里仅根据我自己的需求写的笔记&#xff0c;对于需要快速掌握docker的使用的朋友可以参考学习。 Docker 背景需求 之前&#xff0c;开发一套环境&#xff0c;上线一套环境&#xff0c;环境配置十…

STM32滴答定时器SysTick精准延时,兼容HAL库和标准库

STM32手册资料下载&#xff1a;STM32资料Github链接&#xff1b;STM32资料Gitee链接&#xff1b; 注意&#xff1a;Github是国外的&#xff0c;要翻墙&#xff0c;Gitee是国内的&#xff0c;无需翻墙。 目录 滴答定时器的功能 模块化思想 什么叫做模块化 如何利用keil实现…

用 Wireshark 让你看见 TCP 到底是什么样!

本文为掘金社区首发签约文章&#xff0c;14天内禁止转载&#xff0c;14天后未获授权禁止转载&#xff0c;侵权必究&#xff01; 莫听穿林打叶声&#xff0c;何妨吟啸且徐行。 前言 当你看到这篇文章时&#xff0c;你只能看到已经渲染好的文字和图像&#xff0c;而网络数据的交…

rk3588硬件构成-rock5b

前言 rk3588是瑞芯微的一套新的arm64的板子&#xff0c;上一代用的比较多的是rk3399&#xff0c;新的硬件设备比之前更强大&#xff0c;接口更多&#xff0c;本系列就是介绍相关的硬件软件的一些资料&#xff0c;后面会根据不同的使用进行分篇的介绍 很多资料官网有提供&…

深度学习与总结JVM专辑(四):类文件结构(图文+代码)

类文件结构概述无关性的基石Class类文件结构前言字节码文件结构属性魔数与Class文件的版本号魔数版本号常量池反编译软件访问标志类索引&#xff0c;父类索引与接口索引集合字段表集合方法表集合属性表集合Code属性attribute_name_indexmax_stackmax_localscode_length和codeja…