基于java web的计算机office课程平台设计与实现

news2024/9/28 4:31:31

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


目录

一、项目简介

二、系统功能

三、系统项目截图

学生信息管理

教师信息管理

课程信息管理

试题信息管理

考试信息管理

四、核心代码

登录相关

文件上传

封装


一、项目简介

使用旧方法对课程进行系统化管理已经不再让人们信赖了,把现在的网络信息技术运用在课程的管理上面可以解决许多信息管理上面的难题,比如处理数据时间很长,数据存在错误不能及时纠正等问题。

这次开发的计算机office课程平台有管理员,教师,学生。管理员功能有个人中心,学生管理,教师管理,课程类型管理,课程信息管理,作业信息管理,作业提交管理,留言板管理,在线论坛,系统管理等。教师功能有有个人中心,课程信息管理,作业信息管理,作业提交管理,试卷管理,试题管理,考试管理等。学生功能有个人中心,作业提交管理,留言板管理,我的收藏管理,考试管理。经过前面自己查阅的网络知识,加上自己在学校课堂上学习的知识,决定开发系统选择B/S模式这种高效率的模式完成系统功能开发。这种模式让操作员基于浏览器的方式进行网站访问,采用的主流的Java语言这种面向对象的语言进行计算机office课程平台程序的开发,在数据库的选择上面,选择功能强大的MySQL数据库进行数据的存放操作。

计算机office课程平台被人们投放于现在的生活中进行使用,该款管理类软件就可以让管理人员处理信息的时间介于十几秒之间。在这十几秒内就能完成信息的编辑等操作。有了这样的管理软件,课程的管理就离无纸化办公的目标更贴近了。


二、系统功能

下图就是系统功能结构图。



三、系统项目截图

学生信息管理

管理员管理学生信息,可以添加,修改,删除学生信息信息。下图就是学生信息管理页面。

教师信息管理

管理员管理教师信息,可以添加,修改,删除教师信息信息。下图就是教师信息管理页面。

 

课程信息管理

教师管理课程信息,可以添加,修改,删除课程信息信息。下图就是课程信息管理页面。

试题信息管理

管理员管理试题信息,可以添加,修改,删除试题信息信息。下图就是试题信息管理页面。

 

考试信息管理

学生登录可以在试卷里面进行考试。下图就是考试信息管理页面。

 


四、核心代码

登录相关


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

文件上传

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

封装

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/1181594.html

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

相关文章

linux入门---消费者生产者模型模拟实现

目录标题 消费者生产者模型的理解单生产单消费模拟实现blockqueue.cpp准备工作MainCp.cpp的准备工作构造函数和析构函数的模拟实现push函数的实现pop函数的实现poductor_func函数的实现consumer_func函数的实现程序的测试程序改进一程序的改进二程序的改进三 多生产多消费模拟实…

什么是CCS Concepts

在撰写论文时&#xff0c;看到了CCS Concepts&#xff0c;注意这是对自己论文的分类&#xff0c;不能随便填写。 在ACM的网页"http://dl.acm.org/ccs/ccs.cfm"中选择自己论文的分类&#xff1a; 然后点击左侧的“Assign This CCS Concept”&#xff0c;再选择相关性…

【TDK 电容 】介电质 代码 对应温度及变化率

JB 电解质是什么&#xff1f;没找到&#xff0c;只有TDK有&#xff0c;也只有这个温度的区别&#xff0c;并且已经停产在售。 对比发现是mouser网站关于电容的描述错误。下图显示正确的&#xff0c;再然后是错误的。 在TDK官网&#xff0c;这样的描述 温度特性 分类标准代码温…

制作电子画册的有好帮手---FLBOOK

随着互联网的发展&#xff0c;越来越多的人开始使用电子书来阅读书籍。而将PDF文件转换成在线翻页电子书&#xff0c;则是一种非常方便的方式。今天&#xff0c;给大家推荐一个可以将PDF转在线翻页电子书的网站。 这个网站就是FLBOOK在线制作电子杂志平台&#xff0c;只需要三步…

C++——类和对象(初始化列表、匿名对象、static成员、类的隐式类型转换和explicit关键字、内部类)

初始化列表、匿名对象、static成员、类的隐式类型转换和explicit关键字、内部类 本章思维导图&#xff1a; 注&#xff1a;本章思维导图对应的xmind文件和.png文件都已同步导入至资源 文章目录 初始化列表、匿名对象、static成员、类的隐式类型转换和explicit关键字、内部类1.…

案例-注册页面(css)

html页面用css控制样式&#xff0c;画一个注册页面。 页面最终效果如下&#xff1a; 页面代码&#xff1a; <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>注册页面</title> <style>*{…

文献阅读 - JADE:具有可选外部存档的自适应差分进化

文章目录 标题摘要关键字结论研究背景I. INTRODUCTION 常用基础理论知识II. BASIC OPERATIONS OF DEIII. ADAPTIVE DE ALGORITHMSA. DESAPB. FADEC. SaDED. jDE 研究内容、成果IV. JADEA. DE/Current-to-pbestB. Parameter AdaptationC. Explanations of the Parameter Adaptat…

WSGI与ASGI:两种Python Web服务器网关接口的比较

在当今的Web开发领域&#xff0c;选择合适的服务器网关接口&#xff08;Server Gateway Interface&#xff0c;简称SGI&#xff09;对于提高Web应用程序的性能和并发性至关重要。在Python中&#xff0c;有两种常见的SGI&#xff1a;WSGI和ASGI。本文将深入探讨这两种SGI的异同点…

中国人民大学与加拿大女王大学金融硕士——在职读研,让人生的火花迸发

每个人都像是一块未经雕琢的宝石&#xff0c;隐藏着无尽的光芒。然而&#xff0c;生活、工作中的困难、挫折和压力&#xff0c;就像尘土一样&#xff0c;掩盖了我们的闪亮之处。只有当我们冲破这些阻碍&#xff0c;才能让内在的光芒照亮世界。中国人民大学与加拿大女王大学金融…

Q-Vision+CANpro Max总线解决方案

智能联网技术在国内的发展势头迅猛&#xff0c;随着汽车智能化、网联化发展大潮的到来&#xff0c;智能网联汽车逐步成为汽车发展的主要趋势。越来越多整车厂诉求&#xff0c;希望可以提供本土的测量软件&#xff0c;特别是关于ADAS测试。而风丘科技推出的Q-Vision软件不仅可支…

一键批量剪辑:视频随机分割新玩法,高效剪辑不再难

随着视频内容的日益丰富&#xff0c;人们对于视频剪辑的需求也日益增长。而传统的视频剪辑方式往往需要耗费大量的时间和精力&#xff0c;让许多非专业人士望而却步。然而&#xff0c;现在有一款名为“云炫AI智剪”的软件&#xff0c;它为我们提供了一种全新的视频剪辑方式——…

数据结构:AVL树的旋转(平衡搜索二叉树)

1、AVL树简介 AVL树是最先发明的自平衡二叉查找树。在AVL树中任何节点的两个子树的高度最大差别为1&#xff0c;所以它也被称为高度平衡树。增加和删除可能需要通过一次或多次树旋转来重新平衡这个树。AVL树得名于它的发明者G. M. Adelson-Velsky和E. M. Landis&#xff0c;他们…

uniapp原生插件之安卓串口操作原生插件

插件介绍 安卓串口操作原生插件&#xff0c;支持设置串口&#xff0c;波特率&#xff0c;停止位&#xff0c;数据位&#xff0c;校验位&#xff0c;流控以及延迟&#xff0c;支持粘包处理解决分包问题&#xff0c;支持多串口操作&#xff0c;无需root 插件地址 安卓串口操作…

2023年【危险化学品经营单位安全管理人员】考试资料及危险化学品经营单位安全管理人员考试试卷

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 2023年危险化学品经营单位安全管理人员考试资料为正在备考危险化学品经营单位安全管理人员操作证的学员准备的理论考试专题&#xff0c;每个月更新的危险化学品经营单位安全管理人员考试试卷祝您顺利通过危险化学品经…

【深度神经网络(DNN)】实现车牌识别

文章目录 前言一、数据集介绍二、步骤1.导包2.参数配置3.数据处理4.模型定义5.模型训练6.模型预测 总结 前言 课内实践作业 车牌识别 一、数据集介绍 1.车牌识别数据集&#xff1a;VehicleLicense车牌识别数据集包含16151张单字符数据&#xff0c;所有的单字符均为严格切割且…

力扣:67.二进制求和

class Solution { public:string addBinary(string a, string b) {string ans;reverse(a.begin(), a.end()); // 将字符串a反转reverse(b.begin(), b.end()); // 将字符串b反转int n max(a.size(), b.size()), carry 0; // 获取a和b的最大长度&#xff0c;并初始化进位为0for…

Python合并拼接图片

目录 图片二维合并拼接&#xff08;类似九宫格&#xff09;图片纵向合并拼接举例18张图片合并为2张九宫格图片18张图片合并为2张纵向图片 使用前需要安装PIL库&#xff0c;以下代码使用的Pillow(10.1.0) pip install pillow图片二维合并拼接&#xff08;类似九宫格&#xff09…

趣玩行为商城:用智能消费行为开启财富新生活!

随着当前的消费主力转移至90后和Z时代&#xff0c;购物和消费习惯已经发生了翻天覆地的变化。以往那种大超市&#xff0c;线下大卖场、超级Mall综合体逐渐式微&#xff0c;以“健康生活”、“智能消费”“社区直达”为主的消费理念逐渐兴盛&#xff0c;消费者开始更多地关注此类…

sqli-labs-1

文章目录 Less-01Less-02Less-03Less-04 Less-01 1.输入不同的id值&#xff0c;可以获取不同的用户信息&#xff1a; 2.在sql后拼接’or11–&#xff0c;并没有获取到所有用户的信息&#xff0c;猜测可能用了limit语句 3.构造错误的sql语句&#xff0c;果然有limit报错: …

简历考察点1_《基于 VUE2.0 前后端分离的个人博客系统》

项目名称&#xff1a;《基于 Vue2.0①前后端分离的个人博客系统》 项目描述&#xff1a;提供最新技术资讯、开发知识和分享的博客平台&#xff0c;功能模块包括&#xff1a;支持不同用户登录注册、编辑并发布博客、上传图片、评论留言、根据访问量查询最热文章和标签、根据日期…