• 基于SSM的家政服务网站


    末尾获取源码
    开发语言:Java
    Java开发工具:JDK1.8
    后端框架:SSM
    前端:采用JSP技术开发
    数据库:MySQL5.7和Navicat管理工具结合
    服务器:Tomcat8.5
    开发软件:IDEA / Eclipse
    是否Maven项目:是


            


    一、项目简介

    随着社会的发展,社会的各行各业都在利用信息化时代的优势。计算机的优势和普及使得各种信息系统的开发成为必需。

    家政服务网站,主要的模块包括查看管理员;个人中心、用户管理、服务类型管理、家政类型管理、家政评价管理、家政资讯管理、家政服务管理、家政预约管理、系统管理,用户;个人中心、家政评价管理、家政预约管理、前台首页;首页、家政资讯、家政服务、我的、跳转到后台等功能。系统中管理员主要是为了安全有效地存储和管理各类信息,还可以对系统进行管理与更新维护等操作,并且对后台有相应的操作权限。

    要想实现家政服务网站的各项功能,需要后台数据库的大力支持。管理员验证注册信息,收集的用户信息,并由此分析得出的关联信息等大量的数据都由数据库管理。本文中数据库服务器端采用了Mysql作为后台数据库,使Web与数据库紧密联系起来。在设计过程中,充分保证了系统代码的良好可读性、实用性、易扩展性、通用性、便于后期维护、操作方便以及页面简洁等特点。

    本系统的开发使获取家政服务网站信息能够更加方便快捷,同时也使家政服务网站信息变的更加系统化、有序化。系统界面较友好,易于操作。


    二、论文



    三、系统项目截图

    3.1管理员功能

    管理员登录,管理员通过输入用户名、密码等信息进行系统登录

    管理员登录进入家政服务网站可以查看个人中心、用户管理、服务类型管理、家政类型管理、家政评价管理、家政资讯管理、家政服务管理、家政预约管理、系统管理等内容

     

    用户管理,在用户管理页面可以填写用户名、密码、用户姓名、性别、头像、用户手机等内容,并可根据需要对用户管理进行查看,修改或删除等操作

     

    服务类型管理,在服务类型管理页面可以填写服务类型等内容,并可根据需要对服务类型管理进行修改或删除等操作

     

    家政类型管理,在家政类型管理页面可以填写家政类型等进行添加、修改、删除内容等操作

     家政评价管理,在家政评价管理页面可以查看预约编号、家政姓名、服务类型、用户名、用户姓名、用户手机、满意度、评价内容等内容,并可根据需要对家政评价管理信息进行查看、修改,删除内容等操作

    家政资讯管理 ,在家政资讯管理页面可以查看资讯标题、封面图片、内容、发布时间、发布者、来源、资讯类型等内容,并可根据需要对家政资讯管理进行查看、修改、删除内容等操作

     

    家政服务管理;在家政服务管理页面可以查看家政姓名、性别、年龄、服务类型、家政类型、服务费用、联系方式、工作年数、家政图片、个人简介、工作内容等内容,并可根据需要对家政服务管理进行查看、修改、删除内容等操作

     

    家政预约管理,在家政预约管理页面可以查看预约编号、家政姓名、家政图片、服务费用、服务类型、家政类型、用户名、用户姓名、用户手机、地址、预约手机、是否审核、审核回复、是否支付等内容,并可根据需要对家政预约管理进行审核、查看、修改,删除等操作

     

    3.2用户功能模块

    用户登录进入家政服务网站可以查看个人中心、家政评价管理、家政预约管理等内容

    个人中心,在个人中心页面通过填写用户名、密码、用户姓名、性别、头像、用户手机等内容并可根据需要对个人中心信息进行提交操作

     

    家政预约管理,在家政预约管理页面可以填写预约编号、家政姓名、家政图片、服务费用、服务类型、家政类型、用户名、用户姓名、用户手机、地址、预约手机、是否审核、审核回复、是否支付等内容,并可根据需要对家政预约管理进行家政评价、查看,删除等操作

     

    家政评价管理,在家政评价管理页面可以查看预约编号、家政姓名、服务类型、用户名、用户姓名、用户手机、满意度、评价内容等内容,并可根据需要对家政评价管理进行查看,修改、删除等操作

     

    用户登录进入家政服务网站可以查看首页、家政资讯、家政服务、我的、跳转到后台等内容

     

    用户注册,在用户注册页面通过填写用户名、密码、姓名、手机等信息进行注册

     

    用户登录,在用户登录页面可以填写账号、密码等内容,进行登录

     

    家政服务信息,在家政服务信息页面可以填写家政姓名、性别、年龄、服务类型、家政类型、服务费用、联系方式、工作年数、个人简介、工作内容等内容,并可根据需要对家政服务信息进行家政预约或点我收藏等操作

     

    个人中心信息,在个人中心页面可以填写用户名、密码、用户姓名、性别、头像、用户手机等内容,并可根据需要对个人中心信息进行上传图片、更新信息或退出登录等操作

     


    四、核心代码

    4.1登录相关

    1. package com.controller;
    2. import java.util.Arrays;
    3. import java.util.Calendar;
    4. import java.util.Date;
    5. import java.util.Map;
    6. import javax.servlet.http.HttpServletRequest;
    7. import org.springframework.beans.factory.annotation.Autowired;
    8. import org.springframework.stereotype.Controller;
    9. import org.springframework.web.bind.annotation.GetMapping;
    10. import org.springframework.web.bind.annotation.PathVariable;
    11. import org.springframework.web.bind.annotation.PostMapping;
    12. import org.springframework.web.bind.annotation.RequestBody;
    13. import org.springframework.web.bind.annotation.RequestMapping;
    14. import org.springframework.web.bind.annotation.RequestParam;
    15. import org.springframework.web.bind.annotation.ResponseBody;
    16. import org.springframework.web.bind.annotation.RestController;
    17. import com.annotation.IgnoreAuth;
    18. import com.baomidou.mybatisplus.mapper.EntityWrapper;
    19. import com.entity.TokenEntity;
    20. import com.entity.UserEntity;
    21. import com.service.TokenService;
    22. import com.service.UserService;
    23. import com.utils.CommonUtil;
    24. import com.utils.MD5Util;
    25. import com.utils.MPUtil;
    26. import com.utils.PageUtils;
    27. import com.utils.R;
    28. import com.utils.ValidatorUtils;
    29. /**
    30. * 登录相关
    31. */
    32. @RequestMapping("users")
    33. @RestController
    34. public class UserController{
    35. @Autowired
    36. private UserService userService;
    37. @Autowired
    38. private TokenService tokenService;
    39. /**
    40. * 登录
    41. */
    42. @IgnoreAuth
    43. @PostMapping(value = "/login")
    44. public R login(String username, String password, String captcha, HttpServletRequest request) {
    45. UserEntity user = userService.selectOne(new EntityWrapper().eq("username", username));
    46. if(user==null || !user.getPassword().equals(password)) {
    47. return R.error("账号或密码不正确");
    48. }
    49. String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
    50. return R.ok().put("token", token);
    51. }
    52. /**
    53. * 注册
    54. */
    55. @IgnoreAuth
    56. @PostMapping(value = "/register")
    57. public R register(@RequestBody UserEntity user){
    58. // ValidatorUtils.validateEntity(user);
    59. if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) {
    60. return R.error("用户已存在");
    61. }
    62. userService.insert(user);
    63. return R.ok();
    64. }
    65. /**
    66. * 退出
    67. */
    68. @GetMapping(value = "logout")
    69. public R logout(HttpServletRequest request) {
    70. request.getSession().invalidate();
    71. return R.ok("退出成功");
    72. }
    73. /**
    74. * 密码重置
    75. */
    76. @IgnoreAuth
    77. @RequestMapping(value = "/resetPass")
    78. public R resetPass(String username, HttpServletRequest request){
    79. UserEntity user = userService.selectOne(new EntityWrapper().eq("username", username));
    80. if(user==null) {
    81. return R.error("账号不存在");
    82. }
    83. user.setPassword("123456");
    84. userService.update(user,null);
    85. return R.ok("密码已重置为:123456");
    86. }
    87. /**
    88. * 列表
    89. */
    90. @RequestMapping("/page")
    91. public R page(@RequestParam Map params,UserEntity user){
    92. EntityWrapper ew = new EntityWrapper();
    93. PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
    94. return R.ok().put("data", page);
    95. }
    96. /**
    97. * 列表
    98. */
    99. @RequestMapping("/list")
    100. public R list( UserEntity user){
    101. EntityWrapper ew = new EntityWrapper();
    102. ew.allEq(MPUtil.allEQMapPre( user, "user"));
    103. return R.ok().put("data", userService.selectListView(ew));
    104. }
    105. /**
    106. * 信息
    107. */
    108. @RequestMapping("/info/{id}")
    109. public R info(@PathVariable("id") String id){
    110. UserEntity user = userService.selectById(id);
    111. return R.ok().put("data", user);
    112. }
    113. /**
    114. * 获取用户的session用户信息
    115. */
    116. @RequestMapping("/session")
    117. public R getCurrUser(HttpServletRequest request){
    118. Long id = (Long)request.getSession().getAttribute("userId");
    119. UserEntity user = userService.selectById(id);
    120. return R.ok().put("data", user);
    121. }
    122. /**
    123. * 保存
    124. */
    125. @PostMapping("/save")
    126. public R save(@RequestBody UserEntity user){
    127. // ValidatorUtils.validateEntity(user);
    128. if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) {
    129. return R.error("用户已存在");
    130. }
    131. userService.insert(user);
    132. return R.ok();
    133. }
    134. /**
    135. * 修改
    136. */
    137. @RequestMapping("/update")
    138. public R update(@RequestBody UserEntity user){
    139. // ValidatorUtils.validateEntity(user);
    140. userService.updateById(user);//全部更新
    141. return R.ok();
    142. }
    143. /**
    144. * 删除
    145. */
    146. @RequestMapping("/delete")
    147. public R delete(@RequestBody Long[] ids){
    148. userService.deleteBatchIds(Arrays.asList(ids));
    149. return R.ok();
    150. }
    151. }

    4.2文件上传

    1. package com.controller;
    2. import java.io.File;
    3. import java.io.FileNotFoundException;
    4. import java.io.IOException;
    5. import java.util.Arrays;
    6. import java.util.Date;
    7. import java.util.HashMap;
    8. import java.util.List;
    9. import java.util.Map;
    10. import java.util.Random;
    11. import java.util.UUID;
    12. import org.apache.commons.io.FileUtils;
    13. import org.apache.commons.lang3.StringUtils;
    14. import org.springframework.beans.factory.annotation.Autowired;
    15. import org.springframework.http.HttpHeaders;
    16. import org.springframework.http.HttpStatus;
    17. import org.springframework.http.MediaType;
    18. import org.springframework.http.ResponseEntity;
    19. import org.springframework.util.ResourceUtils;
    20. import org.springframework.web.bind.annotation.PathVariable;
    21. import org.springframework.web.bind.annotation.RequestBody;
    22. import org.springframework.web.bind.annotation.RequestMapping;
    23. import org.springframework.web.bind.annotation.RequestParam;
    24. import org.springframework.web.bind.annotation.RestController;
    25. import org.springframework.web.multipart.MultipartFile;
    26. import com.annotation.IgnoreAuth;
    27. import com.baomidou.mybatisplus.mapper.EntityWrapper;
    28. import com.entity.ConfigEntity;
    29. import com.entity.EIException;
    30. import com.service.ConfigService;
    31. import com.utils.R;
    32. /**
    33. * 上传文件映射表
    34. */
    35. @RestController
    36. @RequestMapping("file")
    37. @SuppressWarnings({"unchecked","rawtypes"})
    38. public class FileController{
    39. @Autowired
    40. private ConfigService configService;
    41. /**
    42. * 上传文件
    43. */
    44. @RequestMapping("/upload")
    45. public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
    46. if (file.isEmpty()) {
    47. throw new EIException("上传文件不能为空");
    48. }
    49. String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
    50. File path = new File(ResourceUtils.getURL("classpath:static").getPath());
    51. if(!path.exists()) {
    52. path = new File("");
    53. }
    54. File upload = new File(path.getAbsolutePath(),"/upload/");
    55. if(!upload.exists()) {
    56. upload.mkdirs();
    57. }
    58. String fileName = new Date().getTime()+"."+fileExt;
    59. File dest = new File(upload.getAbsolutePath()+"/"+fileName);
    60. file.transferTo(dest);
    61. FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
    62. if(StringUtils.isNotBlank(type) && type.equals("1")) {
    63. ConfigEntity configEntity = configService.selectOne(new EntityWrapper().eq("name", "faceFile"));
    64. if(configEntity==null) {
    65. configEntity = new ConfigEntity();
    66. configEntity.setName("faceFile");
    67. configEntity.setValue(fileName);
    68. } else {
    69. configEntity.setValue(fileName);
    70. }
    71. configService.insertOrUpdate(configEntity);
    72. }
    73. return R.ok().put("file", fileName);
    74. }
    75. /**
    76. * 下载文件
    77. */
    78. @IgnoreAuth
    79. @RequestMapping("/download")
    80. public ResponseEntity<byte[]> download(@RequestParam String fileName) {
    81. try {
    82. File path = new File(ResourceUtils.getURL("classpath:static").getPath());
    83. if(!path.exists()) {
    84. path = new File("");
    85. }
    86. File upload = new File(path.getAbsolutePath(),"/upload/");
    87. if(!upload.exists()) {
    88. upload.mkdirs();
    89. }
    90. File file = new File(upload.getAbsolutePath()+"/"+fileName);
    91. if(file.exists()){
    92. /*if(!fileService.canRead(file, SessionManager.getSessionUser())){
    93. getResponse().sendError(403);
    94. }*/
    95. HttpHeaders headers = new HttpHeaders();
    96. headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
    97. headers.setContentDispositionFormData("attachment", fileName);
    98. return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
    99. }
    100. } catch (IOException e) {
    101. e.printStackTrace();
    102. }
    103. return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
    104. }
    105. }

    4.3封装

    1. package com.utils;
    2. import java.util.HashMap;
    3. import java.util.Map;
    4. /**
    5. * 返回数据
    6. */
    7. public class R extends HashMap {
    8. private static final long serialVersionUID = 1L;
    9. public R() {
    10. put("code", 0);
    11. }
    12. public static R error() {
    13. return error(500, "未知异常,请联系管理员");
    14. }
    15. public static R error(String msg) {
    16. return error(500, msg);
    17. }
    18. public static R error(int code, String msg) {
    19. R r = new R();
    20. r.put("code", code);
    21. r.put("msg", msg);
    22. return r;
    23. }
    24. public static R ok(String msg) {
    25. R r = new R();
    26. r.put("msg", msg);
    27. return r;
    28. }
    29. public static R ok(Map map) {
    30. R r = new R();
    31. r.putAll(map);
    32. return r;
    33. }
    34. public static R ok() {
    35. return new R();
    36. }
    37. public R put(String key, Object value) {
    38. super.put(key, value);
    39. return this;
    40. }
    41. }

    五、系统测试

    程序设计不能保证没有错误,这是一个开发过程,在错误或错误的过程中都是难以避免的。虽然这是不可避免的,但我们不能使这些错误始终存在于系统中,错误可能会造成无法估量的后果,如系统崩溃,安全信息泄露,系统无法正常启动等,为了避免这些问题我们需要测试程序,在测试过程中发现问题并纠正它们,从而使系统更长时间稳定成熟。

    本章的作用是发现这些问题,并对其进行修改,虽然耗时费力,但对于长期使用而言是非常重要和必要系统的开发。

    软件在设计后必须进行测试,调试过程中使用的方法是软件测试方法。在开发新软件时,系统测试是检查软件是否合格的关键步骤,以及是否符合设计目标的参考。测试主要是查看软件中数据的准确性,正确的操作与否,以及操作的结果,还有哪些方面需要改进。

    家政服务网站的实现,对于系统中功能模块的实现及操作都必须通过测试进行来评判系统是否可以准确的实现。在家政服务网站正式上传使用之前必须做的一步就是系统测试,对于测试发现的错误及时修改处理,保证系统准确无误的供给用户使用。

  • 相关阅读:
    Pycharm 远程连接服务器(ssh)运行深度学习代码 | 详细步骤
    ThreadLocal 源码分析
    【紧急情况】:回宿舍放下书包的我,花了20分钟敲了一个抢购脚本
    【MySQL】_自连接与子查询
    Android实时通信:WebSocket与WebRTC的应用与优化
    Appium的使用教程
    婴幼儿母婴商城购物系统(Java+Web+SSH+MySQL)
    C#批量视频处理工具
    测试老鸟整理,从手工测试到自动化测试的进阶全程...
    掌握功能优化=学会面试
  • 原文地址:https://blog.csdn.net/weixin_52721608/article/details/132751696