项目介绍
现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本电子书籍管理就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此电子书籍管理利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发。实现了用户在线选择试题并完成答题,在线查看考核分数。管理员管理字典管理、公告信息管理、敏感词管理、书籍管理、用户管理、章节管理、作者管理、管理员管理等功能。电子书籍管理的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。
4.2 系统功能结构设计
在分析并得出使用者对程序的功能要求时,就可以进行程序设计了。如图4.2展示的就是管理员功能结构图,管理员在后台主要管理字典管理、公告信息管理、敏感词管理、书籍管理、用户管理、章节管理、作者管理、管理员管理等。
开发环境
编程语言:Java
数据库 :Mysql
系统架构:B/S
后端框架:SSM
编译工具:idea或者eclipse,jdk1.8,maven
支持定做:java/php/python/android/小程序/vue/爬虫/c#/asp.net
系统实现
5.1 管理员功能介绍
5.1.1 书籍列表
如图5.1显示的就是书籍列表页面,此页面提供给管理员的功能有:查看书籍、新增书籍、修改书籍、删除书籍等。
图5.1 书籍列表页面
5.1.2 公告信息管理
公告信息管理页面提供的功能操作有:新增公告,修改公告,删除公告操作。下图就是公告信息管理页面。
图5.3 公告信息管理页面
5.1.3公告类型管理
公告类型管理页面显示所有公告类型,在此页面既可以让管理员添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。下图就是公告类型管理页面。
图5.4 公告类型列表页面
核心代码
package com.controller;
import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;
/**
* 书籍
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("uji")
public class ShujiController {
private static final Logger logger = LoggerFactory.getLogger(ShujiController.class);
@Autowired
private ShujiService shujiService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表service
@Autowired
private ZuozheService zuozheService;
@Autowired
private YonghuService yonghuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
PageUtils page = shujiService.queryPage(params);
//字典表数据转换
List<ShujiView> list =(List<ShujiView>)page.getList();
for(ShujiView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ShujiEntity shuji = shujiService.selectById(id);
if(shuji !=null){
//entity转view
ShujiView view = new ShujiView();
BeanUtils.copyProperties( shuji , view );//把实体数据重构到view中
//级联表
ZuozheEntity zuozhe = zuozheService.selectById(shuji.getZuozheId());
if(zuozhe != null){
BeanUtils.copyProperties( zuozhe , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setZuozheId(zuozhe.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("ve")
public R save(@RequestBody ShujiEntity shuji, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,shuji:{}",this.getClass().getName(),shuji.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
Wrapper<ShujiEntity> queryWrapper = new EntityWrapper<ShujiEntity>()
.eq("zuozhe_id", shuji.getZuozheId())
.eq("shuji_name", shuji.getShujiName())
.eq("shuji_types", shuji.getShujiTypes())
.eq("shuji_clicknum", shuji.getShujiClicknum())
.eq("shangxia_types", shuji.getShangxiaTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ShujiEntity shujiEntity = shujiService.selectOne(queryWrapper);
if(shujiEntity==null){
shuji.setShujiClicknum(1);
shuji.setShangxiaTypes(1);
shuji.setInsertTime(new Date());
shuji.setCreateTime(new Date());
shujiService.insert(shuji);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody ShujiEntity shuji, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,shuji:{}",this.getClass().getName(),shuji.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(StringUtil.isEmpty(role))
// return R.error(511,"权限为空");
//根据字段查询是否有相同数据
Wrapper<ShujiEntity> queryWrapper = new EntityWrapper<ShujiEntity>()
.notIn("id",shuji.getId())
.andNew()
.eq("zuozhe_id", shuji.getZuozheId())
.eq("shuji_name", shuji.getShujiName())
.eq("shuji_types", shuji.getShujiTypes())
.eq("shuji_clicknum", shuji.getShujiClicknum())
.eq("shangxia_types", shuji.getShangxiaTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ShujiEntity shujiEntity = shujiService.selectOne(queryWrapper);
if("".equals(shuji.getShujiPhoto()) || "null".equals(shuji.getShujiPhoto())){
shuji.setShujiPhoto(null);
}
if(shujiEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// shuji.set
// }
shujiService.updateById(shuji);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
shujiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
List<ShujiEntity> shujiList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
if(!".xls".equals(suffix)){
return R.error(511,"只支持后缀为xls的excel文件");
}else{
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
if(!file.exists()){
return R.error(511,"找不到上传文件,请联系管理员");
}else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for(List<String> data:dataList){
//循环
ShujiEntity shujiEntity = new ShujiEntity();
// shujiEntity.setZuozheId(Integer.valueOf(data.get(0))); //作者 要改的
// shujiEntity.setShujiName(data.get(0)); //书籍名称 要改的
// shujiEntity.setShujiPhoto("");//照片
// shujiEntity.setShujiTypes(Integer.valueOf(data.get(0))); //书籍类型 要改的
// shujiEntity.setShujiClicknum(Integer.valueOf(data.get(0))); //点击次数 要改的
// shujiEntity.setShangxiaTypes(Integer.valueOf(data.get(0))); //是否上架 要改的
// shujiEntity.setShujiContent("");//照片
// shujiEntity.setInsertTime(date);//时间
// shujiEntity.setCreateTime(date);//时间
shujiList.add(shujiEntity);
//把要查询是否重复的字段放入map中
}
//查询是否重复
shujiService.insertBatch(shujiList);
return R.ok();
}
}
}
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("st")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = shujiService.queryPage(params);
//字典表数据转换
List<ShujiView> list =(List<ShujiView>)page.getList();
for(ShujiView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ShujiEntity shuji = shujiService.selectById(id);
if(shuji !=null){
//点击数量加1
shuji.setShujiClicknum(shuji.getShujiClicknum()+1);
shujiService.updateById(shuji);
//entity转view
ShujiView view = new ShujiView();
BeanUtils.copyProperties( shuji , view );//把实体数据重构到view中
//级联表
ZuozheEntity zuozhe = zuozheService.selectById(shuji.getZuozheId());
if(zuozhe != null){
BeanUtils.copyProperties( zuozhe , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setZuozheId(zuozhe.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ShujiEntity shuji, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,shuji:{}",this.getClass().getName(),shuji.toString());
Wrapper<ShujiEntity> queryWrapper = new EntityWrapper<ShujiEntity>()
.eq("zuozhe_id", shuji.getZuozheId())
.eq("shuji_name", shuji.getShujiName())
.eq("shuji_types", shuji.getShujiTypes())
.eq("shuji_clicknum", shuji.getShujiClicknum())
.eq("shangxia_types", shuji.getShangxiaTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ShujiEntity shujiEntity = shujiService.selectOne(queryWrapper);
if(shujiEntity==null){
shuji.setInsertTime(new Date());
shuji.setCreateTime(new Date());
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// shuji.set
// }
shujiService.insert(shuji);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}
论文参考
目 录
目 录 III
1 绪论 1
1.1 研究背景 1
1.2 目的和意义 1
1.3 论文结构安排 2
2 相关技术 3
2.1 SSM框架介绍 3
2.2 B/S结构介绍 3
2.3 Mysql数据库介绍 4
3 系统分析 6
3.1 系统可行性分析 6
3.1.1 技术可行性分析 6
3.1.2 经济可行性分析 6
3.1.3 运行可行性分析 6
3.2 系统性能分析 7
3.2.1 易用性指标 7
3.2.2 可扩展性指标 7
3.2.3 健壮性指标 7
3.2.4 安全性指标 8
3.3 系统流程分析 8
3.3.1 操作流程分析 8
3.3.2 登录流程分析 9
3.3.3 信息添加流程分析 10
3.3.4 信息删除流程分析 11
3.4 系统功能分析 11
4 系统设计 12
4.1 系统概要设计 12
4.2 系统功能结构设计 12
4.3 数据库设计 13
4.3.1 数据库E-R图设计 13
4.3.2 数据库表结构设计 14
5 系统实现 15
5.1 管理员功能介绍 15
5.1.1 书籍列表 15
5.1.2 公告信息管理 15
5.1.3公告类型管理 16
6 系统测试 17
6.1 系统测试的特点 17
6.2 系统功能测试 18
6.2.1 登录功能测试 18
6.2.2 添加班级功能测试 18
6.3 测试结果分析 18
结 论 20
致 谢 21
参考文献 22