前言
该系统利用Java语言、MySQL数据库,结合目前流行的 B/S架构,将智能家政保洁预约管理的各个方面都集中到数据库中,以便于用户的需要。该系统在确保系统稳定的前提下,能够实现多功能模块的设计和应用。该系统由管理员功能模块、家政人员功能模块和用户模块组成。不同角色的准入制度是有严格区别的。各功能模块的设计也便于以后的系统升级和维护。该系统采用了软件组件化、精化体系结构、分离逻辑和数据等方法。
关键字:Java技术;家政保洁;MySQL;B/S结构
一、项目介绍
系统的目标是为管理员,家政人员和用户搭建一个网上沟通平台,保证双方的安全,并使双方的利益最大化。
3.3.1管理员需求分析
管理员端的功能主要是开放给系统的管理人员使用,能够对个人中心、用户管理、服务类型管理、家政人员管理、家政服务管理、家政预约管理、服务评价管理、家政合同管理、合同签订管理、系统留言、系统管理等进行查询,修改和删除等,对系统整体运行情况进行了解。
管理员用例分析图,如图3-1所示。
图3-1管理员用例分析图
3.3.2家政人员需求分析
家政人员的功能主要是对个人中心、家政服务管理、服务预约管理、服务评价管理、合同签订管理等功能进行操作管理。家政人员用例分析图,如图3-2所示。
图3-2家政人员用例分析图
3.3.3用户需求分析
用户的功能主要是对个人中心、家政预约管理、服务评价管理、家政合同管理、合同签订管理进行操作管理。用户用例分析图,如图3-3所示。
图3-3用户用例分析图
二、开发环境
开发语言:Java
框架:ssm
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven
————————————————
三、功能介绍
对本系统进行全面的系统功能的分析,可以得出系统的功能模块图,如图4-1所示。
图4-1 系统功能模块图
四、核心代码
部分代码:
package com.example.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.example.common.Result;
import com.example.common.ResultCode;
import com.example.entity.Caiwu;
import com.example.exception.CustomException;
import com.example.service.CaiwuService;
import com.example.utils.MapWrapperUtils;
import com.example.utils.jwt.JwtUtil;
import com.example.vo.CaiwuVo;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/caiwu")
public class CaiwuController {
@Resource
private CaiwuService caiwuService;
@PostMapping
public Result<Caiwu> add(@RequestBody CaiwuVo caiwu) {
caiwuService.add(caiwu);
return Result.success(caiwu);
}
@PostMapping("/deleteList")
public Result<Caiwu> deleteList(@RequestBody CaiwuVo caiwu) {
caiwuService.deleteList(caiwu.getList());
return Result.success();
}
@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
caiwuService.delete(id);
return Result.success();
}
@PutMapping
public Result update(@RequestBody CaiwuVo caiwu) {
caiwuService.update(caiwu);
return Result.success();
}
@GetMapping("/{id}")
public Result<Caiwu> detail(@PathVariable Integer id) {
Caiwu caiwu = caiwuService.findById(id);
return Result.success(caiwu);
}
@GetMapping
public Result<List<Caiwu>> all() {
return Result.success(caiwuService.list());
}
@PostMapping("/page")
public Result<CaiwuVo> page(@RequestBody CaiwuVo caiwuVo) {
return Result.success(caiwuService.findPage(caiwuVo));
}
@PostMapping("/login")
public Result login(@RequestBody Caiwu caiwu, HttpServletRequest request) {
if (StrUtil.isBlank(caiwu.getZhanghao()) || StrUtil.isBlank(caiwu.getMima())) {
throw new CustomException(ResultCode.PARAM_LOST_ERROR);
}
Caiwu login = caiwuService.login(caiwu);
// if(!login.getStatus()){
// return Result.error("1001","状态限制,无法登录系统");
// }
if(login != null) {
HashMap hashMap = new HashMap();
hashMap.put("user", login);
Map<String, Object> map = MapWrapperUtils.builder(MapWrapperUtils.KEY_USER_ID,caiwu.getId());
String token = JwtUtil.creatToken(map);
hashMap.put("token", token);
return Result.success(hashMap);
}else {
return Result.error();
}
}
@PutMapping("/updatePassword")
public Result updatePassword(@RequestBody Caiwu info, HttpServletRequest request) {
Caiwu caiwu = caiwuService.findById(info.getId());
String oldPassword = SecureUtil.md5(info.getMima());
if (!oldPassword.equals(caiwu.getMima())) {
return Result.error(ResultCode.PARAM_PASSWORD_ERROR.code, ResultCode.PARAM_PASSWORD_ERROR.msg);
}
info.setMima(SecureUtil.md5(info.getNewPassword()));
Caiwu caiwu1 = new Caiwu();
BeanUtils.copyProperties(info, caiwu1);
caiwuService.update(caiwu1);
return Result.success();
}
}
五、效果图
六、文章目录
目 录
1绪 论 1
1.1研究背景 1
1.2开发目的与意义 2
1.2.1开发目的 2
1.2.2开发意义 2
1.3本文研究内容 2
2开发技术 3
2.1 Java介绍 3
2.2 MySql简介 3
2.3 SSM框架 3
2.4 B/S架构 4
2.5 Tomcat简介 4
3系统分析 5
3.1系统可行性分析 5
3.1.1技术可行性分析 5
3.1.2经济可行性分析 5
3.1.3法律可行性分析 5
3.2系统性能分析 5
3.3功能需求分析 6
3.3.1管理员需求分析 6
3.3.2家政人员需求分析 6
3.3.3用户需求分析 7
3.4系统流程分析 7
4系统设计 9
4.1功能模块设计 9
4.2数据库设计 9
4.2.1数据库设计原则 9
4.2.2系统E-R图 10
4.2.3数据库表设计 11
5系统实现 18
5.1系统功能实现 18
5.2后台模块实现 20
5.2.1管理员功能实现 21
5.2.2家政人员功能实现 26
5.2.3用户功能实现 27
6系统测试 29
6.1系统测试内容 29
6.1.1登录测试 29
6.1.2 角色测试 29
6.1.3 性能测试 30
6.2测试用例执行结果 30
结 论 31
参考文献 32
致 谢 33