BIT校园失物招领系统
文章目录
-
- 一.用例图
- 二.静态UML
- 三.动态UML
- 四.需求规格说明文档
- 五.系统演示
一.用例图





二.静态UML




三.动态UML

四.需求规格说明文档
系统总体功能

需求分析
需求分析涉及三个方面的内容:首先是针对系统设计专业学生及校园管理人员的需求展开分析;其次是对其原始需求进行系统性分类并加以总结;再次是绘制用户典型用例图;最后还需要从性能角度对系统的需求进行全面评估,并确保其在功能性和性能方面均能够充分满足实际应用的需求
功能需求分析
本次设计的北京理工大学失物招领系统用户分为两类:大学生及其家属和校园管理人员。以下是各类用户的详细需求分析:
用例分析
通过需求研究, 我们深入探讨了不同类型的用户及其在系统中的活动. 为了清晰展示系统的功能模块间的关系, 我们采用用例图来说明这些要素间的相互作用. 基于以上研究结果, 我们可以绘制相应的用户体验图:


非功能需求分析
从系统性能和正常运行角度出发进行非功能需求分析。本次系统的肺功能需求包括以下几点:
(1)系统的稳定性要求:正式投入运营的肺部健康管理系统必须具备良好的稳定性,在开发过程中需对每个功能进行全面测试,并进行压力测试以确保多人在线情况下系统的良好表现。
(2)系统的拓展性要求:在肺部健康管理系统的设计阶段需充分考虑后期维护和技术升级的需求,并规划多数据库的数据结构文档,并编写规范的代码注释以提高代码的可扩展性。
(3)系统的可操作性要求:从用户体验出发设计肺部健康管理系统界面时应充分考虑用户实际操作体验的需求,并尽量简化操作流程;同时应确保各类信息展示直观清晰,并结合校园文化特色设计页面风格;此外应在系统平台提供全面的操作指南以方便操作者查询相关信息并获得技术支持。
(4)系统的安全性要求:肺部健康管理系统必须具备完善的数据安全保护措施以保障数据存储和传输的安全性;同时应制定定期备份制度并确保在现有网络设备条件下能够实现数据的有效安全存储与快速恢复
可行性分析
经过对系统的开发需求全面分析后, 须对系统的可行性进行评估, 并从多维度对本次设计的系统进行全面评估, 仅在系统具备可行性条件后方可开展下一步的设计功能规划.
技术可行性分析
本次开发主要利用Java开发技术和数据库相关知识,在专业课程中有学习过这些内容。而且本次开发应用的技术均为当前主流技术。遇到问题时能够迅速找到相应的解决办法。
五.系统演示
1.首页实现
首页不仅呈现了最新的招领信息与寻物信息,并且列举了系统通知公告相关信息,并配备了便捷的操作功能。从本页面的角度来看,在Action方面实现了对数据的封装,并通过SpringMvc完成了数据交互,在JSP标签的支持下实现了数据绑定功能。
<ul class="nav nav-tabs" style="font-weight:bold;font-family:微软雅黑;font-size:16px;background:white;">
<li class="active">
<a id="shia" onclick="this.style.backgroundColor='whiteSmoke';xuna.style.backgroundColor='white';"
onmouseover="this.style.backgroundColor='whiteSmoke';xuna.style.backgroundColor='white';"
style="background:whiteSmoke;" href="${path}/index.html#find" data-toggle="tab">
<i class="icon-picture"></i>
<h2 style="font-size:16px;display:inline;line-height:16px;">最新招领信息</h2>
</a>
</li>
<li>
<a id="xuna" onclick="this.style.backgroundColor='whiteSmoke';shia.style.backgroundColor='white';"
onmouseover="this.style.backgroundColor='whiteSmoke';shia.style.backgroundColor='white';"
href="${path}/index.html#lost" data-toggle="tab"><i class="icon-zoom-in"></i>
<h2 style="font-size:16px;display:inline;line-height:16px;">最新寻物信息</h2>
</a>
</li>
</ul>
2.发布寻物实现

大学生可以在登录系统时上传 lost items information. 这些 information 包括 item name, lost time, location, type category, related description, 和 images. 当用户点击保存客户端后, 系统将 item information 被提交到 backend controller. controller 将获取 current user's ID. 然后系统 will record the front-end message and user information into the 'lost' table via a put operation. 核心代码如下:
// 丢失东西发帖
@SystemControllerLog(description = "发寻物贴")
@Token(remove=true)
@RequestMapping(value = { "/lost-publish.html" }, method = RequestMethod.POST)
public String publishPickThings(LostThings lostThings, @RequestParam(value = "Img", required = false) MultipartFile multipartFile,
HttpServletRequest request) {
lostThings.setPublishTime(new Date());
lostThings.setStatus(Constants.THINGS_STATE_PUBLISHED);
System.out.println("lost-publish.html..." + lostThings);
// 通过上下文取获取我们的虚拟路径的实际地址
String basePath = super.getUploadBasePath(request) + "/lost";
basePath = MakeFolderUtil.makeDir(basePath, new Date(), lostThings.getUserName());
String fileName = "";
if (multipartFile.getOriginalFilename() != null
&& !"".equals(multipartFile.getOriginalFilename()))
fileName = super.upload(multipartFile, request, basePath);
if (fileName == null) {
request.setAttribute("lostThings", lostThings);
request.setAttribute("upErr", "图片上传失败!");
return "user/lost-publish";
}
if(!"".equals(fileName)) {
String savePath = basePath.substring(basePath.indexOf("static"));
savePath = savePath + "/" + fileName;
lostThings.setThingsImg(savePath);
}
if (!lostThingsService.add(lostThings)) {
request.setAttribute("lostThings", lostThings);
request.setAttribute("saveErr", "发帖失败!");
return "user/lost-publish";
}
return "user/user-center";
}
3.发布招领实现

该系统可为学生提供信息发布功能,并采用与寻物信息展示机制相似的设计方案,在此处不做详细说明。核心代码如下:
// 捡到东西发帖
@SystemControllerLog(description = "发招领贴")
@Token(remove=true)
@RequestMapping(value = { "/find-publish.html" }, method = RequestMethod.POST)
public String publishPickThings(PickThings pickThings, @RequestParam(value = "Img", required = false) MultipartFile multipartFile,
HttpServletRequest request) {
pickThings.setPublishTime(new Date());
pickThings.setStatus(Constants.THINGS_STATE_PUBLISHED);
System.out.println("find-publish..." + pickThings);
// 通过上下文取获取我们的虚拟路径的实际地址
String basePath = super.getUploadBasePath(request) + "/find";
basePath = MakeFolderUtil.makeDir(basePath, new Date(), pickThings.getUserName());
String fileName = "";
if (multipartFile.getOriginalFilename() != null
&& !"".equals(multipartFile.getOriginalFilename()))
fileName = super.upload(multipartFile, request, basePath);
if (fileName == null) {
request.setAttribute("pickThings", pickThings);
request.setAttribute("upErr", "图片上传失败!");
return "user/find-publish";
}
if(!"".equals(fileName)){
String savePath = basePath.substring(basePath.indexOf("static"));
savePath = savePath + "/" + fileName;
pickThings.setThingsImg(savePath);
}
if (!pickThingsService.add(pickThings)) {
request.setAttribute("pickThings", pickThings);
request.setAttribute("saveErr", "发帖失败!");
return "user/find-publish";
}
return "user/user-center";
}
4.感谢管理实现

通过登录系统平台,大学生能够便捷地发布感谢信息。当输入内容完成后,在线提交后即可成功展示该感谢留言。核心代码如下:
// 查询所有
@SuppressWarnings("unchecked")
@Override
public List<ExpressThanks> findAll(String key, Integer pageIndex,
Integer pageSize, String sortField, String sortOrder) {
Session session = super.getSession();
String hql = "from ExpressThanks thanks ";
if (key != null && key != "")
hql += "where thanks.title like '%" + key + "%' or thanks.userName like '%" + key + "%'";
if (StringUtil.isNullOrEmpty(sortField) == false) {
if ("desc".equals(sortOrder) == false) {
sortOrder = "asc";
}
hql += " order by " + sortField + " " + sortOrder;
} else {
hql += " order by thanks.leaveTime desc";
}
Query query = session.createQuery(hql);
query.setFirstResult(pageIndex * pageSize).setMaxResults(pageSize);
return query.list();
}
通过登录系统可以管理用户的各项数据,并支持从Excel中导入数据进行批量处理。核心代码如下:
// 批量导入用户
@RequestMapping(value = { "/user-import.do" }, method = RequestMethod.POST)
public @ResponseBody Map<String, String> toImportUser(HttpServletRequest request, HttpServletResponse respons) throws InvalidFormatException {
Map<String, String> map = new HashMap<String, String>();
MultipartHttpServletRequest mulRequest = (MultipartHttpServletRequest) request;
MultipartFile file = mulRequest.getFile("excelFile");
String filename = file.getOriginalFilename();
String extension = filename.substring(filename.lastIndexOf("."));
if(!".xls".equals(extension) && !".xlsx".equals(extension)) {
map.put("mesg", "请选择excel格式的文件!");
return map;
}
// 如果文件名为空则什么都不做
if (filename != null && !"".equals(filename)) {
try {
InputStream in = file.getInputStream();
Workbook workBook = null;
if (!in.markSupported()) {
in = new PushbackInputStream(in, 8);
}
// 读写xls和xlsx格式时,HSSFWorkbook针对xls,XSSFWorkbook针对xlsx
if (POIFSFileSystem.hasPOIFSHeader(in)) {
workBook = new HSSFWorkbook(in);
} else if (POIXMLDocument.hasOOXMLHeader(in)) {
workBook = new XSSFWorkbook(OPCPackage.open(in));
}
List<User> userList = ExcelImportUtil.exportListFromExcel(workBook);
userService.addUser(userList);
//System.out.println("获取到的数据:" + userList.size());
} catch (IOException e) {
e.printStackTrace();
map.put("mesg", "导入数据失败!");
return map;
}
}
map.put("mesg", "导入数据成功!");
return map;
}
