李优秀 发表于 2025-3-24 10:17:20

基于SpringBoot+Vue的高校实验室安全教导平台的设计与实现

开辟环境

   开辟语言:Java 框架:springboot JDK版本:JDK1.8 服务器:tomcat7
数据库:mysql5.7(一定要5.7版本) 数据库工具:Navicat11 开辟软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9 浏览器:谷歌浏览器
背景路径地址:localhost:8080/项目名称/admin/dist/index.html
前台路径地址:localhost:8080/项目名称/front/dist/index.html (无前台不需要输入)
管理员账号:admin 管理员暗码:admin
开辟技术简介

Java简介
   Java是一种面向对象的静态式编程语言。Java编程语言具有多线程和对象定向的特点。其特点是根据方案的属性将方案分为几个差别的模块,这些模块是封闭的和多样化的,在申请过程中具有很强的独立性。Java语言在盘算机软件开辟过程中的运用可以达到交互操纵的目的,通过各种情势的互换,可以有效地处理所需的数据,从而确保盘算机软件开辟的可控性和可见性。开辟java语言时,保存了网络接口,Java保存的缺省网络接口可以与web应用程序编程所依靠的类别库相匹配。为了使Java开辟的应用程序更加稳定和强健,Java会自动收集程序中的垃圾,并处理程序中存在的非常。Java语言是日常开辟过程中广泛使用的通用根本语言。其中Java语言课程库、句子、语法规则和关键字经常用于盘算机软件的开辟和编程。
面向对象编程是Java语言最显着的特点。它具有原始接口和增补接口以及继承,不仅可以实现相同类型的单个继承,而且还支持接口之间的多个继承,从而实现类、接口和接口之间以及类和接口之间的有效通信。Java的面向对象特性主要包括三个方面:继承、多态性和封装。封装是Java的核心,可以封装所有数据操纵。多态性是指由面向对象举动派生的相关举动。继承作为特殊编程模式有两种类型:父类和子类,这两种类型的属性具有相同的功能和特性。对于父类的属性特性,子类可以实现继承和优化。
Spring Boot框架先容
   SpringBoot是近几年最为流行的背景开辟框架,它的诞生一改过去Spring框架开辟中繁琐的配置,极大地简化了Spring应用的搭建和开辟。SpringBoot框架不仅保有了Spring框架中的所有良好特性,还通过使用特定的配置方式,在底层资助开辟职员在工程创建是就预先做了许多配置,如许在开辟时就不再需要开辟职员过多进行繁琐的配置了。另外在SpringBoot中集成了大量框架,这就使得开辟职员不再需要到处寻找在导入开辟中需要依靠的jar包,同时也解决了依靠包版本冲突问题,从而提高了依靠包引用的稳定性,从而实现了对Spring应用搭建和开辟过程的简化。
MySQL数据库
   MySQL是一种关系型的数据库管理系统,属于Oracle旗下的产品。MySQL的语言黑白结构化的,使用的用户可以在数据上进行工作。这个数据库管理系同一经问世就受到了社会的广泛关注。在各个方面,与同等的数据库相比,MySQL的长处极为突出,它的运行速率快,适用的范围广泛,而且数据库的安全性这一方面独树一帜。在语言结构方面,MySQL的语言简朴,其他数据库需要一大段代码来实现的操纵,MySQL仅需要一小部分代码甚至几行。综上所述,MySQL这种关系型数据库管理系统,已经成为了开辟者进行项目的数据开辟、存储的不二之选。MySQL的功能也多种多样,如数据使用和数据库的创建维护等。而且该数据库的数据共享性高、冗余度低而且容易扩充。MySQL在安全性这一方面也具有自身的特点,它应用了用户的标识和鉴别技术,对试图和数据进行加密,确保资料信息的可靠性。介于数据库系统的功能与强大等性质之间,本数据库系统的设计中主要使用了MySQL实现对数据的处理。基于Web的付费自习室管理系统运用MySQL数据库,在Web应用这一块,MySQL是最好的选择。对于该系统整个的开辟、搭建、运行和维护具有极其告急的作用。
详细视频演示

   请接洽我获取更详细的演示视频
系统功能部分效果

https://i-blog.csdnimg.cn/direct/8d4db390ed3b43519322176405b338b4.png#pic_center
https://i-blog.csdnimg.cn/direct/9f018fbfbeff4e1c8debb12e793b53ef.png#pic_center
https://i-blog.csdnimg.cn/direct/4fd4b18a115045c28a0a03b87fd4de33.png#pic_center
https://i-blog.csdnimg.cn/direct/1ce0a10a9cbe42c5854b57131e52b845.png#pic_center
https://i-blog.csdnimg.cn/direct/36a74f754ffd47cc9f4d5d55d1b372e0.png#pic_center
https://i-blog.csdnimg.cn/direct/9e624c9a275740669df9be67f6dc0e0e.png#pic_center
核心代码

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")
    @IgnoreAuth
        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);
                /**
               * 如果使用idea或者eclipse重启项目,发现之前上传的图片或者文件丢失,将下面一行代码注释打开
                  * 请将以下的"D:\\springbootq33sd\\src\\main\\resources\\static\\upload"替换成你本地项目的upload路径,
               * 并且项目路径不能存在中文、空格等特殊字符
               */
//                FileUtils.copyFile(dest, new File("D:\\springbootq33sd\\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.controller;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
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 com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.ForumEntity;
import com.entity.view.ForumView;

import com.service.ForumService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;

/**
* 交流论坛
* 后端接口
* @author
* @email
* @date 2023-03-05 11:20:58
*/
@RestController
@RequestMapping("/forum")
public class ForumController {
    @Autowired
    private ForumService forumService;


   


    /**
   * 后端列表
   */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,ForumEntity forum,
                HttpServletRequest request){
            if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
                    forum.setUserid((Long)request.getSession().getAttribute("userId"));
            }
      EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>();

                PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params));

      return R.ok().put("data", page);
    }
   
    /**
   * 前端列表
   */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,ForumEntity forum,
                HttpServletRequest request){
            if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
                    forum.setUserid((Long)request.getSession().getAttribute("userId"));
            }
      EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>();

                PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params));
      return R.ok().put("data", page);
    }

        /**
   * 列表
   */
    @IgnoreAuth
    @RequestMapping("/flist")
    public R flist(@RequestParam Map<String, Object> params,ForumEntity forum, HttpServletRequest request){
      EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>();
            PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params));
      return R.ok().put("data", page);
    }

       /**
   * 查询
   */
    @RequestMapping("/query")
    public R query(ForumEntity forum){
      EntityWrapper< ForumEntity> ew = new EntityWrapper< ForumEntity>();
                ew.allEq(MPUtil.allEQMapPre( forum, "forum"));
                ForumView forumView =forumService.selectView(ew);
                return R.ok("查询交流论坛成功").put("data", forumView);
    }
       
    /**
   * 后端详情
   */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
      ForumEntity forum = forumService.selectById(id);
      return R.ok().put("data", forum);
    }

    /**
   * 前端详情
   */
        @IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
      ForumEntity forum = forumService.selectById(id);
      return R.ok().put("data", forum);
    }
   
        /**
   * 论坛详情
   */
        @IgnoreAuth
    @RequestMapping("/list/{id}")
    public R list(@PathVariable("id") String id){
      ForumEntity forum = forumService.selectById(id);
      getChilds(forum);
      return R.ok().put("data", forum);
    }
   
        private ForumEntity getChilds(ForumEntity forum) {
            List<ForumEntity> childs = new ArrayList<ForumEntity>();
            childs = forumService.selectList(new EntityWrapper<ForumEntity>().eq("parentid", forum.getId()));
            if(childs == null || childs.size()==0) {
                    return null;
            }
            forum.setChilds(childs);
            for(ForumEntity forumEntity : childs) {
                    getChilds(forumEntity);
            }
            return forum;
    }



    /**
   * 后端保存
   */
    @RequestMapping("/save")
    public R save(@RequestBody ForumEntity forum, HttpServletRequest request){
            forum.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
            //ValidatorUtils.validateEntity(forum);
            forum.setUserid((Long)request.getSession().getAttribute("userId"));
      forumService.insert(forum);
      return R.ok();
    }
   
    /**
   * 前端保存
   */
    @RequestMapping("/add")
    public R add(@RequestBody ForumEntity forum, HttpServletRequest request){
            forum.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
            //ValidatorUtils.validateEntity(forum);
            forum.setUserid((Long)request.getSession().getAttribute("userId"));
      forumService.insert(forum);
      return R.ok();
    }



    /**
   * 修改
   */
    @RequestMapping("/update")
    @Transactional
    public R update(@RequestBody ForumEntity forum, HttpServletRequest request){
      //ValidatorUtils.validateEntity(forum);
      forumService.updateById(forum);//全部更新
      return R.ok();
    }


   

    /**
   * 删除
   */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
      forumService.deleteBatchIds(Arrays.asList(ids));
      return R.ok();
    }
   
    /**
   * 提醒接口
   */
        @RequestMapping("/remind/{columnName}/{type}")
        public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
                                               @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
                map.put("column", columnName);
                map.put("type", type);
               
                if(type.equals("2")) {
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                        Calendar c = Calendar.getInstance();
                        Date remindStartDate = null;
                        Date remindEndDate = null;
                        if(map.get("remindstart")!=null) {
                                Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
                                c.setTime(new Date());
                                c.add(Calendar.DAY_OF_MONTH,remindStart);
                                remindStartDate = c.getTime();
                                map.put("remindstart", sdf.format(remindStartDate));
                        }
                        if(map.get("remindend")!=null) {
                                Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
                                c.setTime(new Date());
                                c.add(Calendar.DAY_OF_MONTH,remindEnd);
                                remindEndDate = c.getTime();
                                map.put("remindend", sdf.format(remindEndDate));
                        }
                }
               
                Wrapper<ForumEntity> wrapper = new EntityWrapper<ForumEntity>();
                if(map.get("remindstart")!=null) {
                        wrapper.ge(columnName, map.get("remindstart"));
                }
                if(map.get("remindend")!=null) {
                        wrapper.le(columnName, map.get("remindend"));
                }


                int count = forumService.selectCount(wrapper);
                return R.ok().put("count", count);
        }
       









}

系统功能测试

本系统首先在当地服务器上进行了安装和测试,之后鉴于对系统的结构和处理方法的充分熟悉和对系统特性的充分了解,对系统进行了白盒测试和黑盒试验。
在发展软件系统的整个过程中,人们必须面对错综复杂性的实际问题,所以,在软件系统生存周期的各个过程中都一定地会形成错误。应用软件检测目的在于:出现出错并运行某个程序的步骤,而应用软件检测的最告急目的便是找到其中尚未发生的出错。
为了订定出公道的测试计划,根据以下原则开始了丈量;任何测试都要追溯到客户需要;当确定了客户使用模型后就要着手订定测试计划,并在编码以前就对整个软件测试工作做出规划和订定;御用Pareto原理,主要对占出了百分之八十九以上的最易于出错的约百分之二十的模板实施了检测,并从小规模开始逐步实施大量检测,范围一般从主要检测单编程模板再到完全集成的模板;同时经心设计了检测方法,尽可能地全面覆盖所有程序逻辑并使其满足要求的能力。
结论

本系统相对于我查阅到的其他高校实验室安全教导平台具有如下长处:其功能全面、易于日后程序更新、数据库管理容易、界面友好、操纵方便、效率高、安全性好。
本系统在技术层面具有如下长处:第一,用java实现动态页面,使软件系统具备了很好的可维护性和可复用性。其次,在本系统的编写流程中使用的是Spring Boot框架,该框架将更有效的把显示功能与逻辑分开,使得模块更易于管理,尤其适用于大型项目的编写。第三,背景使用的MySQL数据库系统,MySQL的数据库系统引擎主要集中在了对XML尺度的支持,同时具备可扩充、容易应用和安全性高的长处。
综上所述,通过这次从零开始的结业设计是一次全新的开始,也期待圆满结束。我也盼望这次的设计能通过我后期的自主学习把它趋向于完善,成为我的自主创作经验。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 基于SpringBoot+Vue的高校实验室安全教导平台的设计与实现