功能模块需求分析
本系统最大的特点是使用操作简单、友好的提示信息。本系统将实现以下基本功能:
代码已经上传github,下载地址: https://github.com/21503882/networkbook
(1)系统具有简洁大方的页面,使用简便,友好的错误操作提示
(2)管理员用户具有图书类别管理、图书信息管理、图书信息更新管理、订单管理、会员信息管理、公告管理、系统管理功能
(3)普通用户用户具有浏览图书、图书查询、购买图书、修改个人信息等功能
(4)具有较强的安全性,避免用户的恶意操作
系统的功能结构图,分普通用户平台,管理员平台。
普通用户功能模块图说明:普通用户可以在线浏览图书,查询图书,浏览公告信息,如果要购买、下订单操作,首先需要注册一个个人账号,然后登陆到系统中,如功能图2.3所示:
2.3 普通用户用户功能模块图
管理员功能模块图说明:管理员是功能最多的一种用户角色。
(1)图书类别信息管理模块:在该模块中完成对图书类别信息的管理,包括类别录入、查询、修改、增加和删除等功能操作。其中类别信息包括类别名称、类别介绍等信息。
(2)图书信息管理模块:在该模块中定义了图书信息的管理,其功能包括图书录入、查询、删除等操作。
(3)会员管理模块:该模块中包括浏览会员信息和删除会员信息2个功能。
(4)系统管理模块:在该模块中定义了系统日常维护的功能,包括公告信息的添加和查询,修改功能,以及系统用户管理和修改密码等功能。
管理员用户功能模块图如图2.4。
图2.4 管理员用户功能模块图
图4.17 用户注册界面设计
图书详细页
购物车
提交订单
我的订单
论坛留言
管理员登录
用户管理
类别管理
添加类别
图书管理
添加图书
订单管理
网页留言管理
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.stereotype.Controller;
import com.hdxy.vehicle.base.Pagination;
import com.hdxy.vehicle.entity.Exam;
import com.hdxy.vehicle.entity.StudentInfo;
import com.hdxy.vehicle.entity.SysUser;
import com.hdxy.vehicle.service.ExamService;
import com.hdxy.vehicle.service.StudentInfoService;
import com.hdxy.vehicle.service.SysUserService;
import com.hdxy.vehicle.util.ActionResult;
/**
* TODO 类描述
*
* @version 0.0.1
* @author generator
* @date 2019-02-19
*/
@Controller
public class StudentInfoAction {
@Autowired
private StudentInfoService studentInfoService;
@Autowired
private ExamService examService;
@Autowired
private SysUserService sysUserService;
/**
* 统计信息
*
* @param entity
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/countStudentInfo")
public Pagination<StudentInfo> countStudentInfo(StudentInfo entity) {
try {
return studentInfoService.countStudentInfo(entity);
} catch (Exception e) {
e.printStackTrace();
}
return new Pagination<>(0, new ArrayList<>());
}
/**
* 显示信息并分页
*
* @param entity
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/findOutStudentInfo")
public Pagination<StudentInfo> findOutStudentInfo(StudentInfo entity, HttpSession session) {
try {
entity.setStuStatus(2);
SysUser sysUser = (SysUser) session.getAttribute("sysUser");
if (sysUser != null) {
if (sysUser.getType() == 0) {
entity.setCoach(sysUser.getId());
}
entity.setDeleted(0);
return studentInfoService.findPageByCondition(entity);
}
} catch (Exception e) {
e.printStackTrace();
}
return new Pagination<>(0, new ArrayList<>());
}
/**
* 显示所信息并分页
*
* @param entity
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/findStudentInfo")
public Pagination<StudentInfo> findStudentInfo(StudentInfo entity, HttpSession session) {
try {
SysUser sysUser = (SysUser) session.getAttribute("sysUser");
if (sysUser != null) {
if (sysUser.getType() == 0) {
entity.setCoach(sysUser.getId());
}
entity.setDeleted(0);
return studentInfoService.findPageByCondition(entity);
}
} catch (Exception e) {
e.printStackTrace();
}
return new Pagination<>(0, new ArrayList<>());
}
/**
* 删除息
*
* @param id
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/delStudentInfo")
public ActionResult delStudentInfo(StudentInfo entity) {
ActionResult res = new ActionResult();
try {
entity.setDeleted(1);
studentInfoService.updateById(entity);
res.setSuccess(true);
res.setMsg("删除成功");
} catch (Exception e) {
e.printStackTrace();
res.setMsg("出现异常,删除失败");
}
return res;
}
/**
* 跳转编辑页面
*
* @param id
* @return
*/
@RequestMapping("/isAdmin/forwardEditStudentInfo")
public ModelAndView forwardEditStudentInfo(Integer id) {
ModelAndView model = new ModelAndView();
model.setViewName("backstage/editStudentInfo");
try {
StudentInfo studentInfo = studentInfoService.findById(id);
SysUser sysUser = new SysUser();
sysUser.setType(0);
sysUser.setState(1);
List<SysUser> coachList = sysUserService.findByCondition(sysUser);
model.addObject("studentInfoEdit", studentInfo);
model.addObject("coachList", coachList);
} catch (Exception e) {
e.printStackTrace();
}
return model;
}
/**
* 修改学员信息
*
* @param entity
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/upStudentInfo")
public ActionResult upStudentInfo(StudentInfo entity, HttpSession session) {
ActionResult res = new ActionResult();
try {
entity.setUpdateDate(new Date());
entity.setUpdateUser(((SysUser) session.getAttribute("sysUser")).getId());
studentInfoService.updateById(entity);
res.setSuccess(true);
res.setMsg("修改成功");
} catch (Exception e) {
e.printStackTrace();
res.setMsg("出现异常,修改失败");
}
return res;
}
/**
* 通过科目考试信息
*
* @param entity
* @return
*/
@ResponseBody
@RequestMapping("/isAdmin/studentInfoAudit")
public ActionResult studentInfoAudit(StudentInfo entity, Double score, HttpSession session) {
ActionResult res = new ActionResult();
try {
if ("001".equals(entity.getCurrentSub())) {
entity.setCurrentSub("002");
} else if ("002".equals(entity.getCurrentSub())) {
entity.setCurrentSub("003");
} else if ("003".equals(entity.getCurrentSub())) {
entity.setCurrentSub("004");
} else if ("004".equals(entity.getCurrentSub())) {
entity.setStuStatus(1);
}
entity.setUpdateDate(new Date());
entity.setUpdateUser(((SysUser) session.getAttribute("sysUser")).getId());
studentInfoService.updateById(entity);
// 插入成绩
Exam exam = new Exam();
exam.setUserId(entity.getUpdateUser());
exam.setScore(score);
exam.setCurrentSub(entity.getCurrentSub());
exam.setExamDate(new Date());
exam.setDeleted(0);
examService.save(exam);
;
res.setSuccess(true);
res.setMsg("操作成功");
} catch (Exception e) {
e.printStackTrace();
res.setMsg("出现异常,操作失败");
}
return res;
}
}
代码已经上传github,下载地址: https://github.com/21503882/networkbook