• 基于SpringBoot的美容院管理系统设计与实现


    目录

    前言

     一、技术栈

    二、系统功能介绍

    管理员功能实现

    美容部位管理

    销量信息统计

    已支付订单

    技师功能实现

    统计美容用品库存

    预约信息管理

    前台功能实现

    普通用户管理

    会员管理

    普通用户功能实现

    美容用品

    购物车

    我的订单

    会员功能实现

    美容项目

     预约信息管理

    三、核心代码

    1、登录模块

     2、文件上传模块

    3、代码封装


    前言

    如今的信息时代,对信息的共享性,信息的流通性有着较高要求,因此传统管理方式就不适合。为了让美容院信息的管理模式进行升级,也为了更好的维护美容院信息,美容院管理系统的开发运用就显得很有必要。并且通过开发美容院管理系统,不仅可以让所学的SpringBoot框架得到实际运用,也可以掌握MySQL的使用方法,对自身编程能力也有一个检验和提升的过程。尤其是通过实践,可以对系统的开发流程加深印象,无论是前期的分析与设计,还是后期的编码测试等环节,都可以有一个深刻的了解。

    美容院管理系统根据调研,确定其实现的功能主要包括美容用品管理,美容项目管理,美容部位管理,销量信息管理,订单管理,美容项目预约信息管理等功能。

    借助于美容院管理系统这样的工具,让信息系统化,流程化,规范化是最终的发展结果,让其遵循实际操作流程的情况下,对美容院信息实施规范化处理,让美容院信息通过电子的方式进行保存,无论是管理人员检索美容院信息,维护美容院信息都可以便利化操作,真正缩短信息处理时间,节省人力和信息管理的成本。

     一、技术栈

    末尾获取源码
    SpringBoot+Vue+JS+ jQuery+Ajax...

    二、系统功能介绍

    管理员功能实现

    美容部位管理

    实现管理员权限的美容部位管理功能,其运行效果见下图。管理员修改美容部位信息,删除美容部位信息,新增美容部位信息。

    销量信息统计

    实现管理员权限的销量信息统计功能,其运行效果见下图。管理员通过销量统计报表查看各种美容用品的销量信息。

     

    已支付订单

    实现管理员权限的已支付订单功能,其运行效果见下图。管理员查看已支付订单信息,查看下单人提供的收货地址,然后进行订单发货。

     

    技师功能实现

    统计美容用品库存

    实现技师权限的统计美容用品库存功能,其运行效果见下图。技师可以通过统计报表查看各种美容用品对应的现有库存量。

     

    预约信息管理

    实现技师权限的预约信息管理功能,其运行效果见下图。会员预约技师提供的美容项目,技师则需要进行查看和审核。

     

    前台功能实现

    普通用户管理

    实现前台权限的普通用户管理功能,其运行效果见下图。普通用户的基本信息也能让前台进行增删改查管理。

     

    会员管理

    实现前台权限的会员管理功能,其运行效果见下图。会员的基本信息可以让前台进行修改,也能让前台进行查询或删除。

     

    普通用户功能实现

    美容用品

    实现普通用户权限的美容用品功能,其运行效果见下图。普通用户查看美容用品,在本页面购买美容用品,或把美容用品添加购物车。

     

    购物车

    实现普通用户权限的购物车功能,其运行效果见下图。普通用户在本模块购买美容用品,需要提供收货地址,然后选择支付方式支付订单。

     

    我的订单

    实现普通用户权限的我的订单功能,其运行效果见下图。普通用户在本模块查看不同状态的订单,已支付订单在未发货前也能退款。

     

    会员功能实现

    美容项目

    实现会员权限的美容项目功能,其运行效果见下图。会员查看美容项目介绍,预约美容项目。

     

     预约信息管理

    实现会员权限的预约信息管理功能,其运行效果见下图。会员提交了美容项目预约信息之后,需要到自己的后台查看预约项目审核情况。

     

    三、核心代码

    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. }

     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. }

    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. }

  • 相关阅读:
    JavaScript面向对象学习构造函数、静态成员和实例成员(二)
    高压配电柜电力安全监控解决方案
    聊聊Java的单元测试
    WebSocket
    初识 python 装饰器
    rtthread下基于spi device架构MCP25625驱动
    莫兰指数-计算步骤、数据&事件研究Stata代码
    数据分析(1)——如何用postgres快速找出数据库中所有表格包含空值的列
    解决前端可以进入首页,菜单导航无法加载
    ChatGPT用10秒画完一张UML流程图,而我用了。。。
  • 原文地址:https://blog.csdn.net/2301_77541824/article/details/133362560