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

打印 上一主题 下一主题

主题 637|帖子 637|积分 1911

开辟环境

   开辟语言: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是最好的选择。对于该系统整个的开辟、搭建、运行和维护具有极其告急的作用。
  详细视频演示

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







核心代码

  1. package com.controller;
  2. import java.io.File;
  3. import java.io.FileNotFoundException;
  4. import java.io.IOException;
  5. import java.util.Arrays;
  6. import java.util.Date;
  7. import java.util.HashMap;
  8. import java.util.List;
  9. import java.util.Map;
  10. import java.util.Random;
  11. import java.util.UUID;
  12. import org.apache.commons.io.FileUtils;
  13. import org.apache.commons.lang3.StringUtils;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.http.HttpHeaders;
  16. import org.springframework.http.HttpStatus;
  17. import org.springframework.http.MediaType;
  18. import org.springframework.http.ResponseEntity;
  19. import org.springframework.util.ResourceUtils;
  20. import org.springframework.web.bind.annotation.PathVariable;
  21. import org.springframework.web.bind.annotation.RequestBody;
  22. import org.springframework.web.bind.annotation.RequestMapping;
  23. import org.springframework.web.bind.annotation.RequestParam;
  24. import org.springframework.web.bind.annotation.RestController;
  25. import org.springframework.web.multipart.MultipartFile;
  26. import com.annotation.IgnoreAuth;
  27. import com.baomidou.mybatisplus.mapper.EntityWrapper;
  28. import com.entity.ConfigEntity;
  29. import com.entity.EIException;
  30. import com.service.ConfigService;
  31. import com.utils.R;
  32. /**
  33. * 上传文件映射表
  34. */
  35. @RestController
  36. @RequestMapping("file")
  37. @SuppressWarnings({"unchecked","rawtypes"})
  38. public class FileController{
  39.         @Autowired
  40.     private ConfigService configService;
  41.         /**
  42.          * 上传文件
  43.          */
  44.         @RequestMapping("/upload")
  45.     @IgnoreAuth
  46.         public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
  47.                 if (file.isEmpty()) {
  48.                         throw new EIException("上传文件不能为空");
  49.                 }
  50.                 String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
  51.                 File path = new File(ResourceUtils.getURL("classpath:static").getPath());
  52.                 if(!path.exists()) {
  53.                     path = new File("");
  54.                 }
  55.                 File upload = new File(path.getAbsolutePath(),"/upload/");
  56.                 if(!upload.exists()) {
  57.                     upload.mkdirs();
  58.                 }
  59.                 String fileName = new Date().getTime()+"."+fileExt;
  60.                 File dest = new File(upload.getAbsolutePath()+"/"+fileName);
  61.                 file.transferTo(dest);
  62.                 /**
  63.                    * 如果使用idea或者eclipse重启项目,发现之前上传的图片或者文件丢失,将下面一行代码注释打开
  64.                     * 请将以下的"D:\\springbootq33sd\\src\\main\\resources\\static\\upload"替换成你本地项目的upload路径,
  65.                  * 并且项目路径不能存在中文、空格等特殊字符
  66.                  */
  67. //                FileUtils.copyFile(dest, new File("D:\\springbootq33sd\\src\\main\\resources\\static\\upload"+"/"+fileName)); /**修改了路径以后请将该行最前面的//注释去掉**/
  68.                 if(StringUtils.isNotBlank(type) && type.equals("1")) {
  69.                         ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
  70.                         if(configEntity==null) {
  71.                                 configEntity = new ConfigEntity();
  72.                                 configEntity.setName("faceFile");
  73.                                 configEntity.setValue(fileName);
  74.                         } else {
  75.                                 configEntity.setValue(fileName);
  76.                         }
  77.                         configService.insertOrUpdate(configEntity);
  78.                 }
  79.                 return R.ok().put("file", fileName);
  80.         }
  81.        
  82.         /**
  83.          * 下载文件
  84.          */
  85.         @IgnoreAuth
  86.         @RequestMapping("/download")
  87.         public ResponseEntity<byte[]> download(@RequestParam String fileName) {
  88.                 try {
  89.                         File path = new File(ResourceUtils.getURL("classpath:static").getPath());
  90.                         if(!path.exists()) {
  91.                             path = new File("");
  92.                         }
  93.                         File upload = new File(path.getAbsolutePath(),"/upload/");
  94.                         if(!upload.exists()) {
  95.                             upload.mkdirs();
  96.                         }
  97.                         File file = new File(upload.getAbsolutePath()+"/"+fileName);
  98.                         if(file.exists()){
  99.                                 /*if(!fileService.canRead(file, SessionManager.getSessionUser())){
  100.                                         getResponse().sendError(403);
  101.                                 }*/
  102.                                 HttpHeaders headers = new HttpHeaders();
  103.                             headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);   
  104.                             headers.setContentDispositionFormData("attachment", fileName);   
  105.                             return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
  106.                         }
  107.                 } catch (IOException e) {
  108.                         e.printStackTrace();
  109.                 }
  110.                 return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
  111.         }
  112.        
  113. }
复制代码
  1. package com.controller;
  2. import java.math.BigDecimal;
  3. import java.text.SimpleDateFormat;
  4. import java.text.ParseException;
  5. import java.util.ArrayList;
  6. import java.util.Arrays;
  7. import java.util.Calendar;
  8. import java.util.Map;
  9. import java.util.HashMap;
  10. import java.util.Iterator;
  11. import java.util.Date;
  12. import java.util.List;
  13. import javax.servlet.http.HttpServletRequest;
  14. import com.utils.ValidatorUtils;
  15. import org.apache.commons.lang3.StringUtils;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.transaction.annotation.Transactional;
  18. import org.springframework.format.annotation.DateTimeFormat;
  19. import org.springframework.web.bind.annotation.PathVariable;
  20. import org.springframework.web.bind.annotation.RequestBody;
  21. import org.springframework.web.bind.annotation.RequestMapping;
  22. import org.springframework.web.bind.annotation.RequestParam;
  23. import org.springframework.web.bind.annotation.RestController;
  24. import com.baomidou.mybatisplus.mapper.EntityWrapper;
  25. import com.baomidou.mybatisplus.mapper.Wrapper;
  26. import com.annotation.IgnoreAuth;
  27. import com.entity.ForumEntity;
  28. import com.entity.view.ForumView;
  29. import com.service.ForumService;
  30. import com.service.TokenService;
  31. import com.utils.PageUtils;
  32. import com.utils.R;
  33. import com.utils.MD5Util;
  34. import com.utils.MPUtil;
  35. import com.utils.CommonUtil;
  36. import java.io.IOException;
  37. /**
  38. * 交流论坛
  39. * 后端接口
  40. * @author
  41. * @email
  42. * @date 2023-03-05 11:20:58
  43. */
  44. @RestController
  45. @RequestMapping("/forum")
  46. public class ForumController {
  47.     @Autowired
  48.     private ForumService forumService;
  49.    
  50.     /**
  51.      * 后端列表
  52.      */
  53.     @RequestMapping("/page")
  54.     public R page(@RequestParam Map<String, Object> params,ForumEntity forum,
  55.                 HttpServletRequest request){
  56.             if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
  57.                     forum.setUserid((Long)request.getSession().getAttribute("userId"));
  58.             }
  59.         EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>();
  60.                 PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params));
  61.         return R.ok().put("data", page);
  62.     }
  63.    
  64.     /**
  65.      * 前端列表
  66.      */
  67.     @RequestMapping("/list")
  68.     public R list(@RequestParam Map<String, Object> params,ForumEntity forum,
  69.                 HttpServletRequest request){
  70.             if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
  71.                     forum.setUserid((Long)request.getSession().getAttribute("userId"));
  72.             }
  73.         EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>();
  74.                 PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params));
  75.         return R.ok().put("data", page);
  76.     }
  77.         /**
  78.      * 列表
  79.      */
  80.     @IgnoreAuth
  81.     @RequestMapping("/flist")
  82.     public R flist(@RequestParam Map<String, Object> params,ForumEntity forum, HttpServletRequest request){
  83.         EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>();
  84.             PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params));
  85.         return R.ok().put("data", page);
  86.     }
  87.          /**
  88.      * 查询
  89.      */
  90.     @RequestMapping("/query")
  91.     public R query(ForumEntity forum){
  92.         EntityWrapper< ForumEntity> ew = new EntityWrapper< ForumEntity>();
  93.                 ew.allEq(MPUtil.allEQMapPre( forum, "forum"));
  94.                 ForumView forumView =  forumService.selectView(ew);
  95.                 return R.ok("查询交流论坛成功").put("data", forumView);
  96.     }
  97.        
  98.     /**
  99.      * 后端详情
  100.      */
  101.     @RequestMapping("/info/{id}")
  102.     public R info(@PathVariable("id") Long id){
  103.         ForumEntity forum = forumService.selectById(id);
  104.         return R.ok().put("data", forum);
  105.     }
  106.     /**
  107.      * 前端详情
  108.      */
  109.         @IgnoreAuth
  110.     @RequestMapping("/detail/{id}")
  111.     public R detail(@PathVariable("id") Long id){
  112.         ForumEntity forum = forumService.selectById(id);
  113.         return R.ok().put("data", forum);
  114.     }
  115.    
  116.         /**
  117.      * 论坛详情
  118.      */
  119.         @IgnoreAuth
  120.     @RequestMapping("/list/{id}")
  121.     public R list(@PathVariable("id") String id){
  122.         ForumEntity forum = forumService.selectById(id);
  123.         getChilds(forum);
  124.         return R.ok().put("data", forum);
  125.     }
  126.    
  127.         private ForumEntity getChilds(ForumEntity forum) {
  128.             List<ForumEntity> childs = new ArrayList<ForumEntity>();
  129.             childs = forumService.selectList(new EntityWrapper<ForumEntity>().eq("parentid", forum.getId()));
  130.             if(childs == null || childs.size()==0) {
  131.                     return null;
  132.             }
  133.             forum.setChilds(childs);
  134.             for(ForumEntity forumEntity : childs) {
  135.                     getChilds(forumEntity);
  136.             }
  137.             return forum;
  138.     }
  139.     /**
  140.      * 后端保存
  141.      */
  142.     @RequestMapping("/save")
  143.     public R save(@RequestBody ForumEntity forum, HttpServletRequest request){
  144.             forum.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
  145.             //ValidatorUtils.validateEntity(forum);
  146.             forum.setUserid((Long)request.getSession().getAttribute("userId"));
  147.         forumService.insert(forum);
  148.         return R.ok();
  149.     }
  150.    
  151.     /**
  152.      * 前端保存
  153.      */
  154.     @RequestMapping("/add")
  155.     public R add(@RequestBody ForumEntity forum, HttpServletRequest request){
  156.             forum.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
  157.             //ValidatorUtils.validateEntity(forum);
  158.             forum.setUserid((Long)request.getSession().getAttribute("userId"));
  159.         forumService.insert(forum);
  160.         return R.ok();
  161.     }
  162.     /**
  163.      * 修改
  164.      */
  165.     @RequestMapping("/update")
  166.     @Transactional
  167.     public R update(@RequestBody ForumEntity forum, HttpServletRequest request){
  168.         //ValidatorUtils.validateEntity(forum);
  169.         forumService.updateById(forum);//全部更新
  170.         return R.ok();
  171.     }
  172.    
  173.     /**
  174.      * 删除
  175.      */
  176.     @RequestMapping("/delete")
  177.     public R delete(@RequestBody Long[] ids){
  178.         forumService.deleteBatchIds(Arrays.asList(ids));
  179.         return R.ok();
  180.     }
  181.    
  182.     /**
  183.      * 提醒接口
  184.      */
  185.         @RequestMapping("/remind/{columnName}/{type}")
  186.         public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
  187.                                                  @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
  188.                 map.put("column", columnName);
  189.                 map.put("type", type);
  190.                
  191.                 if(type.equals("2")) {
  192.                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  193.                         Calendar c = Calendar.getInstance();
  194.                         Date remindStartDate = null;
  195.                         Date remindEndDate = null;
  196.                         if(map.get("remindstart")!=null) {
  197.                                 Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
  198.                                 c.setTime(new Date());
  199.                                 c.add(Calendar.DAY_OF_MONTH,remindStart);
  200.                                 remindStartDate = c.getTime();
  201.                                 map.put("remindstart", sdf.format(remindStartDate));
  202.                         }
  203.                         if(map.get("remindend")!=null) {
  204.                                 Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
  205.                                 c.setTime(new Date());
  206.                                 c.add(Calendar.DAY_OF_MONTH,remindEnd);
  207.                                 remindEndDate = c.getTime();
  208.                                 map.put("remindend", sdf.format(remindEndDate));
  209.                         }
  210.                 }
  211.                
  212.                 Wrapper<ForumEntity> wrapper = new EntityWrapper<ForumEntity>();
  213.                 if(map.get("remindstart")!=null) {
  214.                         wrapper.ge(columnName, map.get("remindstart"));
  215.                 }
  216.                 if(map.get("remindend")!=null) {
  217.                         wrapper.le(columnName, map.get("remindend"));
  218.                 }
  219.                 int count = forumService.selectCount(wrapper);
  220.                 return R.ok().put("count", count);
  221.         }
  222.        
  223. }
复制代码
系统功能测试

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

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

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

李优秀

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表