文末获取源码
开发语言:Java
框架:springboot
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7/8.0
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器
一、前言介绍
随着信息互联网信息的飞速发展,无纸化作业变成了一种趋势,针对这个问题开发一个专门适应师生作业交流形式的网站。本文介绍了知识管理系统的开发全过程。通过分析企业对于知识管理系统的需求,创建了一个计算机管理知识管理系统的方案。文章介绍了知识管理系统的系统分析部分,包括可行性分析等,系统设计部分主要介绍了系统功能设计和数据库设计。
本知识管理系统有管理员和用户两个角色。管理员功能有
个人中心,用户管理,文章分类管理,文章信息管理,资料分类管理,资料下载管理,问答管理,论坛交流,留言板管理,系统管理等。用户功能有个人中心,文章信息管理,资料下载管理,问答管理,我的收藏管理。因而具有一定的实用性。
本站是一个B/S模式系统,采用Spring Boot框架作为后台开发技术,前端框架是VUE,MYSQL数据库设计开发,充分保证系统的稳定性。系统具有界面清晰、操作简单,功能齐全的特点,使得知识管理系统管理工作系统化、规范化。
二、系统结构
本系统是基于B/S架构的网站系统,设计的管理员功能结构图如下图所示:
本系统是基于B/S架构的网站系统,设计的用户功能结构图如下图所示:
三、用户模块的实现
3.1文章信息
用户可以在首页查看文章信息,也可以对文章信息进行收藏操作。界面如下图所示:
3.2资料下载
3.3论坛交流
用户可以在论坛交流里面发布信息和查看信息,发布信息需要提前登录才可以操作。界面如下图所示:
四、管理员模块的实现
4.1用户管理
知识管理系统的管理员可以对用户新增,修改,删除,查询操作。具体界面的展示如图
4.2文章分类
管理员登录可以在文章分类新增,修改,删除,查询资料分类。具体界面如图
4.3资料分类
五、部分核心代码
/*** 上传文件映射表*/
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{@Autowiredprivate 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);/*** 如果使用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);}}
RestController
@RequestMapping("/kechengchengji")
public class KechengchengjiController {@Autowiredprivate KechengchengjiService kechengchengjiService;/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,KechengchengjiEntity kechengchengji,HttpServletRequest request){String tableName = request.getSession().getAttribute("tableName").toString();if(tableName.equals("jiaoshi")) {kechengchengji.setJiaoshizhanghao((String)request.getSession().getAttribute("username"));}if(tableName.equals("xuesheng")) {kechengchengji.setXuehao((String)request.getSession().getAttribute("username"));}EntityWrapper<KechengchengjiEntity> ew = new EntityWrapper<KechengchengjiEntity>();PageUtils page = kechengchengjiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, kechengchengji), params), params));return R.ok().put("data", page);}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,KechengchengjiEntity kechengchengji, HttpServletRequest request){EntityWrapper<KechengchengjiEntity> ew = new EntityWrapper<KechengchengjiEntity>();PageUtils page = kechengchengjiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, kechengchengji), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( KechengchengjiEntity kechengchengji){EntityWrapper<KechengchengjiEntity> ew = new EntityWrapper<KechengchengjiEntity>();ew.allEq(MPUtil.allEQMapPre( kechengchengji, "kechengchengji")); return R.ok().put("data", kechengchengjiService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(KechengchengjiEntity kechengchengji){EntityWrapper< KechengchengjiEntity> ew = new EntityWrapper< KechengchengjiEntity>();ew.allEq(MPUtil.allEQMapPre( kechengchengji, "kechengchengji")); KechengchengjiView kechengchengjiView = kechengchengjiService.selectView(ew);return R.ok("查询课程成绩成功").put("data", kechengchengjiView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){KechengchengjiEntity kechengchengji = kechengchengjiService.selectById(id);return R.ok().put("data", kechengchengji);}/*** 前端详情*/@IgnoreAuth@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){KechengchengjiEntity kechengchengji = kechengchengjiService.selectById(id);return R.ok().put("data", kechengchengji);}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody KechengchengjiEntity kechengchengji, HttpServletRequest request){kechengchengji.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(kechengchengji);kechengchengjiService.insert(kechengchengji);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody KechengchengjiEntity kechengchengji, HttpServletRequest request){kechengchengji.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(kechengchengji);kechengchengjiService.insert(kechengchengji);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody KechengchengjiEntity kechengchengji, HttpServletRequest request){//ValidatorUtils.validateEntity(kechengchengji);kechengchengjiService.updateById(kechengchengji);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){kechengchengjiService.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<KechengchengjiEntity> wrapper = new EntityWrapper<KechengchengjiEntity>();if(map.get("remindstart")!=null) {wrapper.ge(columnName, map.get("remindstart"));}if(map.get("remindend")!=null) {wrapper.le(columnName, map.get("remindend"));}String tableName = request.getSession().getAttribute("tableName").toString();if(tableName.equals("jiaoshi")) {wrapper.eq("jiaoshizhanghao", (String)request.getSession().getAttribute("username"));}if(tableName.equals("xuesheng")) {wrapper.eq("xuehao", (String)request.getSession().getAttribute("username"));}int count = kechengchengjiService.selectCount(wrapper);return R.ok().put("count", count);}}