Java项目:ssm知识库管理系统

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

文件集中上传:系统支持单文件上传以及批量上传,系统支持zip、rar格式的压缩包导入。亮点创新 多格式文件在线预览 用户可以对所有公共文件进行浏览,支持office,pdf格式以及常见图片格式,音频格式,音频播放以流媒体服务搭载实现边下边播的用户体验。

文档链接:系统支持用户对喜爱的文档进行收藏及发送到常用文档。
文档关联:手动关联:用户可以手动对文件关联相关的文件。
自动关联:系统可以自动关联类似文档
规则使用:系统对用户上传的过大文件(视频)进行压缩来加快用户在线预览打开的速度,对文档自动提取简介和关键词。对视频、office等文件提取缩略图。
系统中可增加词典,增强分词效果
智能检索:系统包含全文检索、多重条件检索、关键词检索。同时还支持对检索结果再次附加条件检索。
用户管理:普通用户可以对自己的文件夹、收藏夹管理。用户可以分享自己的文档到公共资源库中。
管理员可以对系统中的用户管理、公共文件审核,系统分类的管理,一些数据的统计和日志记录的查看
用户评论:用户可以对文档进行评论
文本处理:能够支持中文,人名、组织机构名、时间、地名、目标类型、目标名称等实体识别,能对常见文本格式抽取。
文档推荐:系统使用协同过滤算法推荐用户可能会查看的文档
知识图谱:系统中的知识以树结构存放,可以通过知识图谱快速到达你要找的知识点。对于每个节点都有详细的介绍。
智能提取:系统结合PageRank、TF-IDF等算法组织知识点在我们的库中,用户可以通过半自动化的操作,去提取归纳知识,产生新的文档。
信息统计:系统对文档的数据进行统计分析,以图表的方式呈现。

新建文档:用户可以使用在线多功能编辑器新建文档

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目:是; 查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 

6.数据库:MySql 5.7版本;

技术栈

1. spring+spring mvc+mybatis+bootstrap+jquery

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;

3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置

4. 运行项目,在浏览器中输入http://localhost:8080/lib/login 登录

5. 登录账号:11184629@qq.com  密码:123456

注意事项

需要先安装openoffice,下载地址:http://www.openoffice.org/download/index.html

并在TranslateUtils中修改相关路径;

运行截图

相关代码 

后台登录

package com.lib.web.admin.main;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.lib.entity.UserInfo;
import com.lib.enums.Const;

/**
 * 后台登录
 * 
 * @author Yu Yufeng
 *
 */
@Controller
@RequestMapping("/admin")
public class AdminMainController {
	private final Logger LOG = LoggerFactory.getLogger(this.getClass());

	@RequestMapping(value = "/index", method = RequestMethod.GET)
	public String index(HttpSession session,HttpServletRequest req) {
		UserInfo user = (UserInfo) session.getAttribute(Const.SESSION_USER);
		LOG.info(user.getUserEmail()+"进入管理员界面,ip:"+req.getLocalAddr());
		return "admin/index";
	}

}

ClassManageController

package com.lib.web.admin.main;

import java.io.File;
import java.util.List;

import javax.servlet.http.HttpSession;

import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import com.lib.dto.FileInfoVO;
import com.lib.dto.JsonResult;
import com.lib.entity.Classification;
import com.lib.entity.FileInfo;
import com.lib.entity.UserInfo;
import com.lib.enums.Const;
import com.lib.service.admin.ClassificationService;
import com.lib.utils.StringValueUtil;

/**
 * 后台登录
 * 
 * @author Yu Yufeng
 *
 */
@Controller
@RequestMapping("/admin")
public class ClassManageController {

	@Autowired
	private ClassificationService classService;

	/**
	 * 更新缩略图
	 * 
	 * @param files
	 * @param session
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/update-classpic/{classId}", method = RequestMethod.POST)
	@ResponseBody
	public String uploadFile(@RequestParam("file") CommonsMultipartFile[] files, HttpSession session,
			@PathVariable("classId") Long classId) throws Exception {
		Classification classi = classService.findById(classId);
		String path = classi.getClassificationPicture();
		FileUtils.writeByteArrayToFile(new File(Const.ROOT_PATH + "thumbnail/" + path + ".png"), files[0].getBytes());
		return "success";
	}

	/**
	 * 修改节点
	 * 
	 * @param session
	 * @param c
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/update-classpic", method = RequestMethod.POST)
	public @ResponseBody Integer update(HttpSession session, Classification c) throws Exception {
		int res = classService.updatePicPath(c);
		return res;
	}

	/**
	 * 删除节点
	 * 
	 * @param session
	 * @param classId
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/del-classpic/{classId}", method = RequestMethod.POST)
	public @ResponseBody Integer del(HttpSession session, @PathVariable("classId") Long classId) throws Exception {
		int res = classService.delete(classId);
		return res;
	}

	/**
	 * 增加节点
	 * 
	 * @param session
	 * @param classId
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/add-classpic", method = RequestMethod.POST)
	public @ResponseBody Integer add(HttpSession session, Classification c) throws Exception {
		c.setClassificationPicture(StringValueUtil.getUUID());
		int res = classService.insert(c);
		return res;
	}

	/**
	 * 分类管理主页
	 * 
	 * @return
	 */
	@RequestMapping(value = "/class-manage-ui", method = RequestMethod.GET)
	public String ManageUI() {
		return "admin/class-manage";
	}

}

CountMainController

package com.lib.web.admin.main;

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lib.dto.ActiveUserInfo;
import com.lib.dto.ClassesClickInfo;
import com.lib.dto.ClickInfo;
import com.lib.dto.JsonResult;
import com.lib.entity.FileInfo;
import com.lib.entity.UserInfo;
import com.lib.service.admin.CountService;

/**
 * 后台数据统计
 * 
 * @author Yu Yufeng
 *
 */
@Controller
@RequestMapping("/admin")
public class CountMainController {
	
	@Autowired
	private CountService countService;
	
	@RequestMapping(value = "/count-ui", method = RequestMethod.GET)
	public String indexui() {

		return "admin/index";
	}
	
	@RequestMapping(value = "/count/index", method = RequestMethod.GET)
	public String index() {
		
		return "admin/count-index";
	}
	/**
	 * 热门文档
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/count/hot-file", method = RequestMethod.GET)
	public JsonResult< List<ClickInfo>> getHotFiles(){
		JsonResult< List<ClickInfo>> jr = null;
		try{
			 List<ClickInfo> fileList = countService.getHotFiles();
			jr = new JsonResult< List<ClickInfo>>(true, fileList);
		}catch (Exception e) {
			jr = new JsonResult< List<ClickInfo>>(false, "获取失败");
		}
		return jr;
	}
	/**
	 * 热门分类
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/count/hot-classes", method = RequestMethod.GET)
	public JsonResult< List<ClassesClickInfo>> getHotClasses(){
		JsonResult< List<ClassesClickInfo>> jr = null;
		try{
			 List<ClassesClickInfo> classesClickInfos = countService.getHotClass(1);
			jr = new JsonResult< List<ClassesClickInfo>>(true, classesClickInfos);
		}catch (Exception e) {
			jr = new JsonResult< List<ClassesClickInfo>>(false, "获取失败");
		}
		return jr;
	}
	/**
	 * 活跃用户
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/count/active-user", method = RequestMethod.GET)
	public JsonResult< List<ActiveUserInfo>> getActiveUsers(){
		JsonResult< List<ActiveUserInfo>> jr = null;
		try{
			 List<ActiveUserInfo> classesClickInfos = countService.getActiveUsers(1);
			jr = new JsonResult< List<ActiveUserInfo>>(true, classesClickInfos);
		}catch (Exception e) {
			jr = new JsonResult< List<ActiveUserInfo>>(false, "获取失败");
		}
		return jr;
	}
	/**
	 * 最近上传
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/count/recent-files", method = RequestMethod.GET)
	public JsonResult< List<Long>> getRecentUploadFiles(){
		JsonResult< List<Long>> jr = null;
		try{
			 List<Long> list = countService.getUploadTimesByTime();
			 Collections.reverse(list);//倒序排列
			jr = new JsonResult< List<Long>>(true, list);
		}catch (Exception e) {
			jr = new JsonResult< List<Long>>(false, "获取失败");
		}
		return jr;
	}
	/**
	 *推荐文档
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/recommend", method = {RequestMethod.POST,RequestMethod.GET})
	public JsonResult< List<FileInfo>> recommend(Long userId){
		JsonResult< List<FileInfo>> jr = null;
		int recomNum = 2;
		try{
			 List<FileInfo> list = countService.getFileScoreList(userId, recomNum);
			 System.out.println(list);
			jr = new JsonResult< List<FileInfo>>(true, list);
		}catch (Exception e) {
			jr = new JsonResult< List<FileInfo>>(false, "获取失败");
		}
		return jr;
	}
	/**
	 * 
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/count/click-times", method = RequestMethod.GET)
	public JsonResult< List<Long>> getClickTims(){
		JsonResult< List<Long>> jr = null;
		try{
			 List<Long> list = countService.getClickTimesByTime();
			 Collections.reverse(list);//倒序排列
			jr = new JsonResult< List<Long>>(true, list);
		}catch (Exception e) {
			jr = new JsonResult< List<Long>>(false, "获取失败");
		}
		return jr;
	}
}

InitController

package com.lib.web.admin.main;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.lib.dao.ClassificationDao;
import com.lib.dao.UserInfoDao;
import com.lib.entity.Classification;
import com.lib.entity.UserInfo;
import com.lib.service.admin.ClassificationService;
import com.lib.service.user.FileInfoService;
import com.lib.service.user.FileManageService;
import com.lib.utils.StringValueUtil;

/**
 * 后台登录
 * 
 * @author Yu Yufeng
 *
 */
@Controller
@RequestMapping("/init")
public class InitController {
	private final Logger LOG = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private UserInfoDao userDao;
	@Autowired
	private FileInfoService fileService;
	@Autowired
	private FileManageService fileManageService;
	@Autowired
	private ClassificationDao classDao;
	
	@RequestMapping(value = "/start/{validation}", method = RequestMethod.GET)
	public String start(Model model, @PathVariable("validation") String validation) {
		if (null != validation && !"".equals(validation)) {
			
			//加入超级管理员用户
			UserInfo user = new UserInfo();
			user.setUserEmail("admin@sok.com");
			user.setUserType(0);
			user.setUserName("admin");
			user.setUserPassword(StringValueUtil.getMD5("12345"));
			userDao.insertSelective(user);
			Classification c = new Classification();
			c.setClassificationId(1l);
			c.setClassificationName("所有分类");
			c.setClassificationPicture("all");
			c.setClassificationBrief("所有分类的最高父节点");
			//加入初始化分类
			classDao.insertByc(c);
			
			model.addAttribute("message", "初始化成功!<br>(管理员帐号:admin@sok.com 密码:12345 )");
		} else {
			model.addAttribute("message", "初始化失败!");
		}

		return "message";
	}

}

如果也想学习本系统,下面领取。关注并回复:039ssm 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值