• 基于Springboot+vue开发实现自行车租赁管理系统


    作者主页:编程千纸鹤

    作者简介:Java、前端、Pythone开发多年,做过高程,项目经理,架构师

    主要内容:Java项目开发、毕业设计开发、面试技术整理、最新技术分享

    收藏点赞不迷路  关注作者有好处

    项目编号:BS-XX-156

    一,项目简介

    近年来随着科技技术的进步与发展,“共享”、“租车”等相关的APP陆续出现在我们的生活中。随着城市机动车数量的增加,环境污染、交通拥堵等问题日渐严重,因此,发展新的绿色出行模式,引导人们减少机动车出行成为解决这一问题的新思路。在这种背景下,“公共自行车+公共交通”的出行模式逐渐在我国发展起来,它鼓励人们更多的采用公共自行车这一出行工具。相较于机动车出行,这种方式在节能减排的同时,也能提高居民的出行效率,已经在我国许多城市流行起来。

    基于这种背景,设计和开发一个功能全面,界面友好、稳定高效的自行车租赁管理系统。本文主要论述了一个基于JAVAWEB技术的自行车租赁管理系统,概述了课题研究背景、国内外发展现状,以及系统的设计原理、设计思想和具体实现过程。对在设计过程中涉及到的关键设计思想及重要作业流程做了具体分析和介绍,并对系统各个模块的设计思想及设计过程做了详细阐述。

    本系统设计采用了JAVAWEB技术,使用SpringBoot框架,以Mysql5.0作为数据库支撑平台,应用到的技术包括JAVA、MyBatis、Vue、软件工程思想等

    本系统使用B/S结构,配合MySql数据库开发,以IDEA开发平台为主导的系统。可实现在线管理自行车、在线选择自行车、数据分析对比等功能,让用户选择自己喜欢的自行车。系统涉及到的技术主要由Vue制作前端页面和Java作为后端主要技术,并采用SpringBoot、Mybatis后端架构。

    本自行车租赁管理系统,系统主要分为用户权限和管理员权限,权限不一样对应的功能也不一样,大致分为:自行车模块、信息模块、租赁地址模块、订单模块等,各模块预计功能概述如下:

    自行车管理:此模块对于系统管理员,主要可以添加自行车删除自行车等功能。对于用户,可以浏览自己喜欢的自行车查看具体自行车信息。

    信息管理:此模块对于系统管理员,既可以查看修改自己的个人信息,也可以查看用户的信息,还可以对用户的权限进行修改,可以将普通用户的权限提高至系统管理员。对于用户,只能查看或者修改自己的个人信息。

    订单管理:此模块对于系统管理员和用户,都可以查看订单明细,申请退单,对订单进行评价等操作。

    问题反馈管理:此模块包括用户在租赁过程中出现的问题进行提交、管理员针对相关问题进行用户反馈的操作。

    卡券包管理:此模块对于系统管理员,可以发放一些优惠券,对于用户可以查询自己的所有卡券,可以使用这些卡券。

    地址管理:对于系统管理员,可以新添加地址和废除不使用的地址,对于用户,可以查询所有地址信息,根据自己的位置选定最适合的地址进行取车和还车。

    信息统计管理:此模块对于系统管理员,对用户信息、自行车信息、地址信息等进行可视化数据分析。对于用户,对订单,历史记录、钱包等进行可视化的数据分析。

    二,环境介绍

    语言环境:Java:  jdk1.8

    数据库:Mysql: mysql5.7

    应用服务器:Tomcat:  tomcat8.5.31

    开发工具:IDEA或eclipse

    后台开发技术:Springboot+mybatis+springmvc+swagger

    前台开发技术:Vue+ElementUI+Axios

    其它:支付宝沙箱支付

    三,系统展示

    管理员登陆系统进行管理

    用户管理

    自行车管理

    自行车回收

    故障车维护

    地址管理

    优惠卷管理

    用户投诉

    订单管理

    退款处理

    用户注册登陆后进行租车

    用户注册登陆后进行租车

    租车

    还车

    支付:注册支付宝沙箱账户进行支付

    购买优惠卷

    上报故障

    投诉建议

    四,核心代码展示

    1. package com.wxh.bicyclerental.controller;
    2. import com.github.pagehelper.PageHelper;
    3. import com.github.pagehelper.PageInfo;
    4. import com.wxh.bicyclerental.entity.Advise;
    5. import com.wxh.bicyclerental.entity.User;
    6. import com.wxh.bicyclerental.service.IAdviseService;
    7. import com.wxh.bicyclerental.service.IUserService;
    8. import com.wxh.bicyclerental.utils.Result;
    9. import io.swagger.annotations.Api;
    10. import io.swagger.annotations.ApiOperation;
    11. import org.springframework.beans.factory.annotation.Autowired;
    12. import org.springframework.web.bind.annotation.*;
    13. import java.util.HashMap;
    14. import java.util.Map;
    15. /**
    16. * 投诉意见管理
    17. */
    18. @Api
    19. @RestController
    20. @RequestMapping("/advise")
    21. @CrossOrigin
    22. public class AdviseController {
    23. @Autowired
    24. private IAdviseService adviseService;
    25. @Autowired
    26. private IUserService userService;
    27. /**
    28. * 添加新投诉
    29. */
    30. @PostMapping("/addAdvise")
    31. @ApiOperation("添加新投诉")
    32. public Result addAdvise(@RequestBody Advise advise,@RequestParam String username) {
    33. //根据用户名查询用户id
    34. User user = userService.selectByUserName(username);
    35. Integer id = user.getId();
    36. advise.setUserId(id);
    37. //设置状态为0
    38. advise.setState(0);
    39. if(adviseService.insert(advise) > 0) {
    40. return Result.ok().data("添加成功");
    41. }else {
    42. return Result.error().data("添加失败");
    43. }
    44. }
    45. /**
    46. * 根据状态分页查询投诉建议
    47. */
    48. @GetMapping("/findByState")
    49. @ApiOperation("根据状态分页查询投诉建议")
    50. public Result findByState(@RequestParam Integer state, @RequestParam int pageNo, @RequestParam int pageSize) {
    51. Map map = new HashMap<>();
    52. //使用PageHelper分页插件
    53. PageHelper.offsetPage(pageNo, pageSize);
    54. PageInfo adviseList = PageInfo.of(adviseService.select(state));
    55. map.put("total", adviseList.getTotal());
    56. map.put("data", adviseList.getList());
    57. return Result.ok().data(map);
    58. }
    59. /**
    60. * 修改投诉状态
    61. */
    62. @PostMapping("/updateState")
    63. @ApiOperation("修改投诉状态")
    64. public Result updateState(@RequestBody Advise advise) {
    65. Integer id = advise.getId();
    66. if(adviseService.delete(id) > 0) {
    67. return Result.ok().data("修改成功");
    68. }else {
    69. return Result.error().data("修改失败");
    70. }
    71. }
    72. }

    1. package com.wxh.bicyclerental.controller;
    2. import com.github.pagehelper.PageHelper;
    3. import com.github.pagehelper.PageInfo;
    4. import com.wxh.bicyclerental.entity.Bicycle;
    5. import com.wxh.bicyclerental.service.IBicycleService;
    6. import com.wxh.bicyclerental.utils.CodeUtil;
    7. import com.wxh.bicyclerental.utils.Result;
    8. import com.wxh.bicyclerental.utils.StringUtils;
    9. import io.swagger.annotations.Api;
    10. import io.swagger.annotations.ApiOperation;
    11. import org.springframework.beans.factory.annotation.Autowired;
    12. import org.springframework.web.bind.annotation.*;
    13. import java.util.HashMap;
    14. import java.util.Map;
    15. /**
    16. * 自行车管理
    17. */
    18. @Api
    19. @RestController
    20. @RequestMapping("/bicycle")
    21. @CrossOrigin
    22. public class BicycleController {
    23. @Autowired
    24. private IBicycleService bicycleService;
    25. /**
    26. * 新车录入
    27. */
    28. @PostMapping("/addBicycle")
    29. @ApiOperation("新车录入")
    30. public Result addBicycle(@RequestBody Bicycle bicycle) {
    31. //设置状态为1
    32. bicycle.setState(1);
    33. //生成16位id
    34. Long id = CodeUtil.RundCode();
    35. bicycle.setBicycleCode(id);
    36. if(bicycleService.insert(bicycle) > 0) {
    37. return Result.ok().data("添加成功");
    38. }else {
    39. return Result.error().data("添加失败");
    40. }
    41. }
    42. /**
    43. * 查询所有自行车信息
    44. */
    45. @GetMapping("/findAll")
    46. @ApiOperation("查询所有自行车信息")
    47. public Result findAll() {
    48. return Result.ok().data(bicycleService.select());
    49. }
    50. /**
    51. * 分页查询自行车信息
    52. */
    53. @GetMapping("/pageQueryBicycle")
    54. @ApiOperation("分页查询自行车信息")
    55. public Result pageQueryBicycle(@RequestParam int pageNo, @RequestParam int pageSize) {
    56. Map map = new HashMap<>();
    57. //使用PageHelper分页插件
    58. PageHelper.offsetPage(pageNo, pageSize);
    59. PageInfo bicycleList = PageInfo.of(bicycleService.select());
    60. map.put("total", bicycleList.getTotal());
    61. map.put("data", bicycleList.getList());
    62. return Result.ok().data(map);
    63. }
    64. /**
    65. * 根据自行车编码查询自行车信息
    66. */
    67. @PostMapping("/findByCode")
    68. @ApiOperation("根据自行车编码查询自行车信息")
    69. public Result findByCode(@RequestBody Bicycle bicycle) {
    70. if(StringUtils.isNull(bicycle)) {
    71. return Result.error().data("失败");
    72. }else {
    73. Long bicycleCode = bicycle.getBicycleCode();
    74. return Result.ok().data(bicycleService.selectOne(bicycleCode));
    75. }
    76. }
    77. /**
    78. * 将自行车状态设为2(报废)删除操作
    79. */
    80. @GetMapping("/removeBicycle")
    81. @ApiOperation("删除自行车")
    82. public Result removeBicycle(@RequestParam Long bicycleCode) {
    83. if(bicycleService.removeBicycle(bicycleCode) > 0) {
    84. return Result.ok().data("删除成功");
    85. }else {
    86. return Result.error().data("删除失败");
    87. }
    88. }
    89. }
    1. package com.wxh.bicyclerental.controller;
    2. import com.github.pagehelper.PageHelper;
    3. import com.github.pagehelper.PageInfo;
    4. import com.wxh.bicyclerental.entity.Coupon;
    5. import com.wxh.bicyclerental.entity.Order;
    6. import com.wxh.bicyclerental.entity.User;
    7. import com.wxh.bicyclerental.entity.UserCoupon;
    8. import com.wxh.bicyclerental.service.ICouponService;
    9. import com.wxh.bicyclerental.service.IUserCouponService;
    10. import com.wxh.bicyclerental.service.IUserService;
    11. import com.wxh.bicyclerental.utils.CodeUtil;
    12. import com.wxh.bicyclerental.utils.Result;
    13. import io.swagger.annotations.Api;
    14. import io.swagger.annotations.ApiOperation;
    15. import org.springframework.beans.factory.annotation.Autowired;
    16. import org.springframework.web.bind.annotation.*;
    17. import java.util.HashMap;
    18. import java.util.Map;
    19. /**
    20. * 优惠券管理
    21. */
    22. @Api
    23. @RestController
    24. @RequestMapping("/coupon")
    25. @CrossOrigin
    26. public class CouponController {
    27. @Autowired
    28. private ICouponService couponService;
    29. @Autowired
    30. private IUserService userService;
    31. @Autowired
    32. private IUserCouponService userCouponService;
    33. /**
    34. * 发布新优惠券
    35. */
    36. @PostMapping("/addCoupon")
    37. @ApiOperation("发布新优惠券")
    38. public Result addCoupon(@RequestBody Coupon coupon) {
    39. //设置状态为1
    40. coupon.setState(1);
    41. //生成16位id
    42. Long id = CodeUtil.RundCode();
    43. coupon.setCouponId(id);
    44. if (couponService.insert(coupon) > 0) {
    45. return Result.ok().data("添加成功");
    46. } else {
    47. return Result.error().data("添加失败");
    48. }
    49. }
    50. /**
    51. * 分页查询所有优惠券
    52. */
    53. @GetMapping("/findAllCoupon")
    54. @ApiOperation("分页查询所有优惠券")
    55. public Result findAllCoupon(@RequestParam Integer state, @RequestParam int pageNo, @RequestParam int pageSize) {
    56. Map map = new HashMap<>();
    57. //使用PageHelper分页插件
    58. PageHelper.offsetPage(pageNo, pageSize);
    59. PageInfo couponList = PageInfo.of(couponService.selectByState(state));
    60. map.put("total", couponList.getTotal());
    61. map.put("data", couponList.getList());
    62. return Result.ok().data(map);
    63. }
    64. /**
    65. * 查询所有优惠券
    66. */
    67. @GetMapping("/findAll")
    68. @ApiOperation("查询所有优惠券")
    69. public Result findAll() {
    70. return Result.ok().data(couponService.select());
    71. }
    72. /**
    73. * 根据id查询优惠券
    74. */
    75. @PostMapping("/findByCouponId")
    76. @ApiOperation("根据id查询优惠券")
    77. public Result findByCouponId(@RequestBody Coupon coupon) {
    78. Long couponId = coupon.getCouponId();
    79. return Result.ok().data(couponService.selectOne(couponId));
    80. }
    81. /**
    82. * 更改优惠券状态
    83. */
    84. @PostMapping("/updateCouponState")
    85. @ApiOperation("更改优惠券状态")
    86. public Result updateCouponState(@RequestBody Coupon coupon) {
    87. if (couponService.update(coupon) > 0) {
    88. return Result.ok().data("修改成功");
    89. } else {
    90. return Result.error().data("修改失败");
    91. }
    92. }
    93. /**
    94. * 购买优惠券
    95. */
    96. @PostMapping("/buyCoupon")
    97. @ApiOperation("购买优惠券")
    98. public Result buyCoupon(@RequestBody Coupon coupon,@RequestParam String username) {
    99. //向中间表中插入数据
    100. UserCoupon userCoupon = new UserCoupon();
    101. //根据用户名查询用户id
    102. User user = userService.selectByUserName(username);
    103. Integer userId = user.getId();
    104. Long couponId = coupon.getCouponId();
    105. userCoupon.setCouponId(couponId);
    106. userCoupon.setUserId(userId);
    107. //将状态设置成未支付
    108. userCoupon.setState(2);
    109. int result = userCouponService.insert(userCoupon);
    110. if(result>0){
    111. return Result.ok().data("成功");
    112. }else {
    113. return Result.error().data("失败");
    114. }
    115. }
    116. }
    1. package com.wxh.bicyclerental.controller;
    2. import com.alibaba.fastjson.JSONArray;
    3. import com.alibaba.fastjson.JSONObject;
    4. import com.github.pagehelper.PageHelper;
    5. import com.github.pagehelper.PageInfo;
    6. import com.wxh.bicyclerental.entity.User;
    7. import com.wxh.bicyclerental.service.IUserService;
    8. import com.wxh.bicyclerental.utils.JwtUtils;
    9. import com.wxh.bicyclerental.utils.Result;
    10. import com.wxh.bicyclerental.utils.StringUtils;
    11. import io.swagger.annotations.Api;
    12. import io.swagger.annotations.ApiOperation;
    13. import org.springframework.beans.factory.annotation.Autowired;
    14. import org.springframework.web.bind.annotation.*;
    15. import javax.servlet.http.HttpServletRequest;
    16. import java.util.*;
    17. /**
    18. * 用户管理
    19. */
    20. @Api
    21. @RestController
    22. @RequestMapping("/user")
    23. @CrossOrigin
    24. public class UserController {
    25. @Autowired
    26. private IUserService userService;
    27. /**
    28. * 新用户注册
    29. */
    30. @PostMapping("/register")
    31. @ApiOperation("注册")
    32. public Result registerUser(@RequestBody User user) {
    33. if (StringUtils.isNull(userService.selectByUserName(user.getUsername()))) {
    34. //默认是用户注册
    35. user.setIdentity("user");
    36. userService.insert(user);
    37. return Result.ok().data("注册成功");
    38. }
    39. return Result.error().data("该用户已存在");
    40. }
    41. /**
    42. * 用户登录
    43. */
    44. @PostMapping("/login")
    45. @ApiOperation("登录")
    46. public Result login(@RequestBody User requestUser) {
    47. String username = requestUser.getUsername();
    48. String password = requestUser.getPassword();
    49. User user = userService.selectByUserName(username);
    50. if (StringUtils.isNotNull(user)) {
    51. String id = user.getId().toString();
    52. String psw = user.getPassword();
    53. if (password.equals(psw)) {
    54. String token = JwtUtils.getJwtToken(id, username);
    55. Map map = new HashMap(16);
    56. map.put("token", token);
    57. return Result.ok().data(map);
    58. } else {
    59. return Result.error().data("密码错误");
    60. }
    61. }
    62. return Result.error().data("用户名输入错误");
    63. }
    64. /**
    65. * 获取用户信息
    66. *
    67. * @return
    68. */
    69. @GetMapping("info")
    70. @ApiOperation("获取用户信息")
    71. public Result getInfo(HttpServletRequest request) {
    72. // 获取jwt解析的信息(用户的id)
    73. Integer memberIdByJwtToken = Integer.parseInt(JwtUtils.getMemberIdByJwtToken(request));
    74. // 根据id,查询用户的信息,并将他放入data数据中
    75. User user = userService.selectOne(memberIdByJwtToken);
    76. Map map = new HashMap<>();
    77. ArrayList rolesList = new ArrayList();
    78. if (StringUtils.isNotNull(user)) {
    79. rolesList.add(user.getIdentity());
    80. map.put("roles", JSONArray.parseArray(JSONObject.toJSONString(rolesList)));
    81. map.put("password", user.getPassword());
    82. map.put("name", user.getUsername());
    83. map.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    84. return Result.ok().data(map);
    85. }
    86. return Result.error();
    87. }
    88. /**
    89. * 授权为系统管理员或取消管理员权限
    90. */
    91. @PostMapping("/updateIdentity")
    92. @ApiOperation("授权或取消权限")
    93. public Result updateIdentity(@RequestBody User params) {
    94. Integer id = params.getId();
    95. String identity = params.getIdentity();
    96. User user = new User();
    97. user.setId(id);
    98. user.setIdentity(identity);
    99. if (userService.updateIdentity(user) != 0) {
    100. return Result.ok().data("更新成功");
    101. }
    102. return Result.error();
    103. }
    104. /**
    105. * 分页查询指定权限用户信息
    106. */
    107. @GetMapping("/pageQueryUser")
    108. @ApiOperation("分页查询指定权限用户信息")
    109. public Result pageQueryUser(@RequestParam int pageNo, @RequestParam int pageSize, @RequestParam String identity) {
    110. Map map = new HashMap<>();
    111. //使用PageHelper分页插件
    112. PageHelper.offsetPage(pageNo, pageSize);
    113. PageInfo userList = PageInfo.of(userService.selectUserByIdentity(identity));
    114. map.put("total", userList.getTotal());
    115. map.put("data", userList.getList());
    116. return Result.ok().data(map);
    117. }
    118. /**
    119. * 查询所有用户信息
    120. */
    121. @GetMapping("/queryUser")
    122. @ApiOperation("查询所有用户信息")
    123. public Result queryUser() {
    124. List userList = userService.select();
    125. if (null == userList || userList.size() == 0) {
    126. return Result.error().data("查询失败");
    127. } else {
    128. return Result.ok().data(userList);
    129. }
    130. }
    131. /**
    132. * 根据用户名查询用户信息
    133. */
    134. @GetMapping("/queryUserByUserName")
    135. @ApiOperation("根据用户名查询用户信息")
    136. public Result queryUserByUserName(@RequestParam String username) {
    137. User user = userService.selectByUserName(username);
    138. if(StringUtils.isNotNull(user)) {
    139. return Result.ok().data(user);
    140. }else {
    141. return Result.error().data("查询失败");
    142. }
    143. }
    144. /**
    145. * 更新用户信息
    146. */
    147. @PostMapping("/updateUser")
    148. @ApiOperation("更新用户信息")
    149. public Result updateUser(@RequestBody User params) {
    150. if(userService.update(params)>0) {
    151. return Result.ok().data("更新成功");
    152. }else {
    153. return Result.error().data("更新失败");
    154. }
    155. }
    156. }

    五,项目总结

    首先,原有单个区域自行车租赁管理系统在跨区域网点的管理能力上相对薄弱。由于不同自行车租赁区域的计费方式往往是不同的,原有系统经常会发生计费规则混用,导致扣款(或扣诚信分)错误,因此,用户投诉也比较多。除此之外,对于一些完全独立的小型自行车租赁区域,采用原有系统过于庞大和显得累赘。因此,迫切需要一套在运营规模上具有较大伸缩性,既可用于完全独立的小型自行车租赁区域的运营管理,又可以用于将相对独立的各运营区域租赁子系统组合起来集中管理的应用平台。

    目前市面上虽然出现了很多共享单车的app,骑车租赁的系统,但是关于自行车租赁的系统还很少。其次,现有存在的系统技术相对落后,在当前大数据的时代,分布式,微服务的开发架构中,这些系统技术落后,对于一些复杂的、高并发的场景并不能很好的处理。本文主要研究的内容是,开发一个技术较新、扩展性更好、综合性更强、业务较为完善的自行车租赁管理系统,一方面方便人们的出行,为城市节能减排做更多的贡献,另一方面,提高自行车租赁管理系统的管理效率和服务水平。

    本文主要完成自行车租赁管理系统的设计与开发工作,站在用户和管理员的角度,根据真实的用户使用体验,采用模块化和层次化的设计思想,结合计算机软件、计算机网络、信息安全、数据库等先进技术,开发一个功能全面、界面友好、稳定高效的综合业务租赁管理系统,为自行车租赁系统运营提供强健的业务管理支撑。

  • 相关阅读:
    mybatis单框架通用mapper使用(二)
    ISP图像信号处理——平场校正介绍以及C++实现
    ArcGIS的地理空间大数据的数据分析图
    数字经济和法治背景下国企合规数字化转型思考
    软件测试内卷?都停一停,我测试员要出圈......
    Docker学习系列3:常用命令之容器命令
    Java(SpringBoot06)
    Hack_Kid
    计算机设计大赛 深度学习疲劳检测 驾驶行为检测 - python opencv cnn
    代码随想录算法训练营第五十天|123.买卖股票的最佳时机Ⅲ、188.买卖股票的最佳时机Ⅳ
  • 原文地址:https://blog.csdn.net/BS009/article/details/127948106