• 毕业设计:基于Springboot+Vue+ElementUI实现疫情社区管理系统


    作者主页:编程千纸鹤

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

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

    项目编号:BS-XX-132

    一,项目简介

       本次开发设计的社区疫情管理系统,主要为一线的社区人员更好的管理辖区内人员疫情风险信息提供信息化的管理手段。本系统基于Springboot+Vue开发实现了用于疫情防控的信息化管理系统。系统功能完整,界面简洁大方。系统用户主要分为居民用户和管理员用户:

    居民注册登陆后主要可以在线提交自己的报备信息,在线购买防疫物资,查看系统通告,查看外来人员不同风险区的要求通知,管理购物车,查看订单信息,实现在付款、退款、退货、在线充值的功能,以及对商品的点赞和己购买商品的评价操作等。

    管理员登陆后可以实现的主要功能有,管理员管理,用户管理,在线交流管理,人员检测信息管理,外来人员报备管理,防疫须知管理,公告管理,商品类型管理,防疫商品管理,订单管理,评价管理等等。

    二,环境介绍

    语言环境:Java:  jdk1.8

    数据库:Mysql: mysql5.7

    应用服务器:Tomcat:  tomcat8.5.31

    开发工具:IDEA或eclipse

    后台开发技术:Springboot+Mybatis

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

    三,系统展示

    下面展示一下社区疫情防控系统:

    外来人员报备

    防疫须知

    购物车管理

    订单管理

    商品评价:对己完成订单的商品进行评价

    个人信息管理及充值

    后台管理功能

    销售统计

    人员检测信息管理

    人员报备管理

    疫情用户分类管理

    疫情用户详情管理

    订单管理

    评价管理

    其它不再一一展示相关功能

    四,核心代码展示

    1. package com.example.controller;
    2. import cn.hutool.core.util.StrUtil;
    3. import cn.hutool.crypto.SecureUtil;
    4. import cn.hutool.json.JSONArray;
    5. import cn.hutool.json.JSONObject;
    6. import com.example.common.Result;
    7. import com.example.common.ResultCode;
    8. import com.example.entity.Account;
    9. import com.example.entity.AuthorityInfo;
    10. import com.example.exception.CustomException;
    11. import com.example.entity.AdminInfo;
    12. import com.example.entity.BusinessInfo;
    13. import com.example.entity.UserInfo;
    14. import com.example.service.AdminInfoService;
    15. import com.example.service.BusinessInfoService;
    16. import com.example.service.UserInfoService;
    17. import org.springframework.web.bind.annotation.*;
    18. import org.springframework.beans.BeanUtils;
    19. import org.springframework.beans.factory.annotation.Value;
    20. import javax.annotation.Resource;
    21. import javax.servlet.http.HttpServletRequest;
    22. import cn.hutool.json.JSONUtil;
    23. import java.util.*;
    24. import java.util.stream.Collectors;
    25. @RestController
    26. public class AccountController {
    27. @Value("${authority.info}")
    28. private String authorityStr;
    29. @Resource
    30. private AdminInfoService adminInfoService;
    31. @Resource
    32. private BusinessInfoService businessInfoService;
    33. @Resource
    34. private UserInfoService userInfoService;
    35. @PostMapping("/login")
    36. public Result login(@RequestBody Account account, HttpServletRequest request) {
    37. if (StrUtil.isBlank(account.getName()) || StrUtil.isBlank(account.getPassword()) || account.getLevel() == null) {
    38. throw new CustomException(ResultCode.PARAM_LOST_ERROR);
    39. }
    40. Integer level = account.getLevel();
    41. Account login = new Account();
    42. if (1 == level) {
    43. login = adminInfoService.login(account.getName(), account.getPassword());
    44. }
    45. if (2 == level) {
    46. login = businessInfoService.login(account.getName(), account.getPassword());
    47. }
    48. if (3 == level) {
    49. login = userInfoService.login(account.getName(), account.getPassword());
    50. }
    51. request.getSession().setAttribute("user", login);//设置session
    52. return Result.success(login);
    53. }
    54. @PostMapping("/register")//注册
    55. public Result register(@RequestBody Account account) {
    56. Integer level = account.getLevel();
    57. Account login = new Account();
    58. if (1 == level) {//超级管理员
    59. AdminInfo info = new AdminInfo();
    60. BeanUtils.copyProperties(account, info);//将account的属性copy到info对象中
    61. login = adminInfoService.add(info);
    62. }
    63. if (2 == level) {//普通管理员
    64. BusinessInfo info = new BusinessInfo();
    65. BeanUtils.copyProperties(account, info);
    66. login = businessInfoService.add(info);
    67. }
    68. if (3 == level) {//普通社区用户
    69. UserInfo info = new UserInfo();
    70. BeanUtils.copyProperties(account, info);
    71. login = userInfoService.add(info);
    72. }
    73. return Result.success(login);
    74. }
    75. @GetMapping("/logout")
    76. public Result logout(HttpServletRequest request) {
    77. request.getSession().setAttribute("user", null);
    78. return Result.success();
    79. }
    80. @GetMapping("/auth")
    81. public Result getAuth(HttpServletRequest request) {
    82. Object user = request.getSession().getAttribute("user");
    83. if(user == null) {
    84. return Result.error("401", "未登录");
    85. }
    86. return Result.success(user);
    87. }
    88. @GetMapping("/getAccountInfo")
    89. public Result getAccountInfo(HttpServletRequest request) {
    90. Account account = (Account) request.getSession().getAttribute("user");
    91. if (account == null) {
    92. return Result.success(new Object());
    93. }
    94. Integer level = account.getLevel();
    95. if (1 == level) {
    96. return Result.success(adminInfoService.findById(account.getId()));
    97. }
    98. if (2 == level) {
    99. return Result.success(businessInfoService.findById(account.getId()));
    100. }
    101. if (3 == level) {
    102. return Result.success(userInfoService.findById(account.getId()));
    103. }
    104. return Result.success(new Object());
    105. }
    106. @GetMapping("/getSession")
    107. public Result> getSession(HttpServletRequest request) {
    108. Account account = (Account) request.getSession().getAttribute("user");
    109. if (account == null) {
    110. return Result.success(new HashMap<>(1));
    111. }
    112. Map map = new HashMap<>(1);
    113. map.put("username", account.getName());
    114. return Result.success(map);
    115. }
    116. @GetMapping("/getAuthority")//获取登录身份级别信息
    117. public Result> getAuthorityInfo() {
    118. List authorityInfoList = JSONUtil.toList(JSONUtil.parseArray(authorityStr), AuthorityInfo.class);
    119. return Result.success(authorityInfoList);
    120. }
    121. /**
    122. * 获取当前用户所能看到的模块信息
    123. * @param request
    124. * @return
    125. */
    126. @GetMapping("/authority")
    127. public Result> getAuthorityInfo(HttpServletRequest request) {
    128. Account user = (Account) request.getSession().getAttribute("user");
    129. if (user == null) {
    130. return Result.success(new ArrayList<>());
    131. }
    132. JSONArray objects = JSONUtil.parseArray(authorityStr);
    133. for (Object object : objects) {
    134. JSONObject jsonObject = (JSONObject) object;
    135. if (user.getLevel().equals(jsonObject.getInt("level"))) {
    136. JSONArray array = JSONUtil.parseArray(jsonObject.getStr("models"));
    137. List modelIdList = array.stream().map((o -> {
    138. JSONObject obj = (JSONObject) o;
    139. return obj.getInt("modelId");
    140. })).collect(Collectors.toList());
    141. return Result.success(modelIdList);
    142. }
    143. }
    144. return Result.success(new ArrayList<>());
    145. }
    146. @GetMapping("/permission/{modelId}")
    147. public Result> getPermission(@PathVariable Integer modelId, HttpServletRequest request) {
    148. List authorityInfoList = JSONUtil.toList(JSONUtil.parseArray(authorityStr), AuthorityInfo.class);
    149. Account user = (Account) request.getSession().getAttribute("user");
    150. if (user == null) {
    151. return Result.success(new ArrayList<>());
    152. }
    153. Optional optional = authorityInfoList.stream().filter(x -> x.getLevel().equals(user.getLevel())).findFirst();
    154. if (optional.isPresent()) {
    155. Optional firstOption = optional.get().getModels().stream().filter(x -> x.getModelId().equals(modelId)).findFirst();
    156. if (firstOption.isPresent()) {
    157. List info = firstOption.get().getOperation();
    158. return Result.success(info);
    159. }
    160. }
    161. return Result.success(new ArrayList<>());
    162. }
    163. @PutMapping("/updatePassword")
    164. public Result updatePassword(@RequestBody Account info, HttpServletRequest request) {
    165. Account account = (Account) request.getSession().getAttribute("user");
    166. if (account == null) {
    167. return Result.error(ResultCode.USER_NOT_EXIST_ERROR.code, ResultCode.USER_NOT_EXIST_ERROR.msg);
    168. }
    169. String oldPassword = SecureUtil.md5(info.getPassword());
    170. if (!oldPassword.equals(account.getPassword())) {
    171. return Result.error(ResultCode.PARAM_PASSWORD_ERROR.code, ResultCode.PARAM_PASSWORD_ERROR.msg);
    172. }
    173. info.setPassword(SecureUtil.md5(info.getNewPassword()));
    174. Integer level = account.getLevel();
    175. if (1 == level) {
    176. AdminInfo adminInfo = new AdminInfo();
    177. BeanUtils.copyProperties(info, adminInfo);
    178. adminInfoService.update(adminInfo);
    179. }
    180. if (2 == level) {
    181. BusinessInfo businessInfo = new BusinessInfo();
    182. BeanUtils.copyProperties(info, businessInfo);
    183. businessInfoService.update(businessInfo);
    184. }
    185. if (3 == level) {
    186. UserInfo userInfo = new UserInfo();
    187. BeanUtils.copyProperties(info, userInfo);
    188. userInfoService.update(userInfo);
    189. }
    190. info.setLevel(level);
    191. info.setName(account.getName());
    192. // 清空session,让用户重新登录
    193. request.getSession().setAttribute("user", null);
    194. return Result.success();
    195. }
    196. @PostMapping("/resetPassword")
    197. public Result resetPassword(@RequestBody Account account) {
    198. Integer level = account.getLevel();
    199. if (1 == level) {
    200. AdminInfo info = adminInfoService.findByUserName(account.getName());
    201. if (info == null) {
    202. return Result.error(ResultCode.USER_NOT_EXIST_ERROR.code, ResultCode.USER_NOT_EXIST_ERROR.msg);
    203. }
    204. info.setPassword(SecureUtil.md5("123456"));
    205. adminInfoService.update(info);
    206. }
    207. if (2 == level) {
    208. BusinessInfo info = businessInfoService.findByUserName(account.getName());
    209. if (info == null) {
    210. return Result.error(ResultCode.USER_NOT_EXIST_ERROR.code, ResultCode.USER_NOT_EXIST_ERROR.msg);
    211. }
    212. info.setPassword(SecureUtil.md5("123456"));
    213. businessInfoService.update(info);
    214. }
    215. if (3 == level) {
    216. UserInfo info = userInfoService.findByUserName(account.getName());
    217. if (info == null) {
    218. return Result.error(ResultCode.USER_NOT_EXIST_ERROR.code, ResultCode.USER_NOT_EXIST_ERROR.msg);
    219. }
    220. info.setPassword(SecureUtil.md5("123456"));
    221. userInfoService.update(info);
    222. }
    223. return Result.success();
    224. }
    225. }
      1. package com.example.controller;
      2. import cn.hutool.core.collection.CollUtil;
      3. import cn.hutool.core.collection.CollectionUtil;
      4. import cn.hutool.core.io.IoUtil;
      5. import cn.hutool.core.util.ObjectUtil;
      6. import cn.hutool.core.util.StrUtil;
      7. import cn.hutool.poi.excel.ExcelUtil;
      8. import cn.hutool.poi.excel.ExcelWriter;
      9. import com.example.common.Result;
      10. import com.example.common.ResultCode;
      11. import com.example.entity.AdminInfo;
      12. import com.example.service.AdminInfoService;
      13. import com.example.exception.CustomException;
      14. import com.example.common.ResultCode;
      15. import com.example.vo.AdminInfoVo;
      16. import com.github.pagehelper.PageHelper;
      17. import com.github.pagehelper.PageInfo;
      18. import com.example.service.*;
      19. import org.springframework.web.bind.annotation.*;
      20. import org.springframework.beans.factory.annotation.Value;
      21. import cn.hutool.core.util.StrUtil;
      22. import org.springframework.web.multipart.MultipartFile;
      23. import javax.annotation.Resource;
      24. import javax.servlet.ServletOutputStream;
      25. import javax.servlet.http.HttpServletRequest;
      26. import javax.servlet.http.HttpServletResponse;
      27. import java.io.IOException;
      28. import java.util.LinkedHashMap;
      29. import java.util.List;
      30. import java.util.Map;
      31. import java.util.stream.Collectors;
      32. @RestController
      33. @RequestMapping(value = "/adminInfo")
      34. public class AdminInfoController {
      35. @Resource
      36. private AdminInfoService adminInfoService;
      37. @PostMapping
      38. public Result add(@RequestBody AdminInfoVo adminInfo) {
      39. adminInfoService.add(adminInfo);
      40. return Result.success(adminInfo);
      41. }
      42. @DeleteMapping("/{id}")
      43. public Result delete(@PathVariable Long id) {
      44. adminInfoService.delete(id);
      45. return Result.success();
      46. }
      47. @PutMapping
      48. public Result update(@RequestBody AdminInfoVo adminInfo) {
      49. adminInfoService.update(adminInfo);
      50. return Result.success();
      51. }
      52. @GetMapping("/{id}")
      53. public Result detail(@PathVariable Long id) {
      54. AdminInfo adminInfo = adminInfoService.findById(id);
      55. return Result.success(adminInfo);
      56. }
      57. @GetMapping
      58. public Result> all() {
      59. return Result.success(adminInfoService.findAll());
      60. }
      61. @GetMapping("/page/{name}")
      62. public Result> page(@PathVariable String name,
      63. @RequestParam(defaultValue = "1") Integer pageNum,
      64. @RequestParam(defaultValue = "5") Integer pageSize,
      65. HttpServletRequest request) {
      66. return Result.success(adminInfoService.findPage(name, pageNum, pageSize, request));
      67. }
      68. @PostMapping("/register")
      69. public Result register(@RequestBody AdminInfo adminInfo) {
      70. if (StrUtil.isBlank(adminInfo.getName()) || StrUtil.isBlank(adminInfo.getPassword())) {
      71. throw new CustomException(ResultCode.PARAM_ERROR);
      72. }
      73. return Result.success(adminInfoService.add(adminInfo));
      74. }
      75. /**
      76. * 批量通过excel添加信息
      77. * @param file excel文件
      78. * @throws IOException
      79. */
      80. @PostMapping("/upload")
      81. public Result upload(MultipartFile file) throws IOException {
      82. List infoList = ExcelUtil.getReader(file.getInputStream()).readAll(AdminInfo.class);
      83. if (!CollectionUtil.isEmpty(infoList)) {
      84. // 处理一下空数据
      85. List resultList = infoList.stream().filter(x -> ObjectUtil.isNotEmpty(x.getName())).collect(Collectors.toList());
      86. for (AdminInfo info : resultList) {
      87. adminInfoService.add(info);
      88. }
      89. }
      90. return Result.success();
      91. }
      92. @GetMapping("/getExcelModel")
      93. public void getExcelModel(HttpServletResponse response) throws IOException {
      94. // 1. 生成excel
      95. Map row = new LinkedHashMap<>();
      96. row.put("name", "admin");
      97. row.put("password", "123456");
      98. row.put("nickName", "管理员");
      99. row.put("sex", "男");
      100. row.put("age", 22);
      101. row.put("birthday", "TIME");
      102. row.put("phone", "18843232356");
      103. row.put("address", "上海市");
      104. row.put("code", "111");
      105. row.put("email", "aa@163.com");
      106. row.put("cardId", "342425199001116372");
      107. row.put("level", 1);
      108. List> list = CollUtil.newArrayList(row);
      109. // 2. 写excel
      110. ExcelWriter writer = ExcelUtil.getWriter(true);
      111. writer.write(list, true);
      112. response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
      113. response.setHeader("Content-Disposition","attachment;filename=adminInfoModel.xlsx");
      114. ServletOutputStream out = response.getOutputStream();
      115. writer.flush(out, true);
      116. writer.close();
      117. IoUtil.close(System.out);
      118. }
      119. }
      1. package com.example.controller;
      2. import cn.hutool.core.collection.CollUtil;
      3. import cn.hutool.core.collection.CollectionUtil;
      4. import cn.hutool.core.io.IoUtil;
      5. import cn.hutool.core.util.ObjectUtil;
      6. import cn.hutool.core.util.StrUtil;
      7. import cn.hutool.poi.excel.ExcelUtil;
      8. import cn.hutool.poi.excel.ExcelWriter;
      9. import com.example.common.Result;
      10. import com.example.common.ResultCode;
      11. import com.example.entity.AdvertiserInfo;
      12. import com.example.service.*;
      13. import com.example.vo.AdvertiserInfoVo;
      14. import com.github.pagehelper.PageHelper;
      15. import com.github.pagehelper.PageInfo;
      16. import org.springframework.web.bind.annotation.*;
      17. import org.springframework.web.multipart.MultipartFile;
      18. import javax.annotation.Resource;
      19. import javax.servlet.ServletOutputStream;
      20. import javax.servlet.http.HttpServletRequest;
      21. import javax.servlet.http.HttpServletResponse;
      22. import java.io.IOException;
      23. import java.util.LinkedHashMap;
      24. import java.util.List;
      25. import java.util.Map;
      26. import java.util.stream.Collectors;
      27. @RestController
      28. @RequestMapping(value = "/advertiserInfo")
      29. public class AdvertiserInfoController {
      30. @Resource
      31. private AdvertiserInfoService advertiserInfoService;
      32. @PostMapping
      33. public Result add(@RequestBody AdvertiserInfoVo advertiserInfo) {
      34. advertiserInfoService.add(advertiserInfo);
      35. return Result.success(advertiserInfo);
      36. }
      37. @DeleteMapping("/{id}")
      38. public Result delete(@PathVariable Long id) {
      39. advertiserInfoService.delete(id);
      40. return Result.success();
      41. }
      42. @PutMapping
      43. public Result update(@RequestBody AdvertiserInfoVo advertiserInfo) {
      44. advertiserInfoService.update(advertiserInfo);
      45. return Result.success();
      46. }
      47. @GetMapping("/{id}")
      48. public Result detail(@PathVariable Long id) {
      49. AdvertiserInfo advertiserInfo = advertiserInfoService.findById(id);
      50. return Result.success(advertiserInfo);
      51. }
      52. @GetMapping
      53. public Result> all() {
      54. return Result.success(advertiserInfoService.findAll());
      55. }
      56. @GetMapping("/page/{name}")
      57. public Result> page(@PathVariable String name,
      58. @RequestParam(defaultValue = "1") Integer pageNum,
      59. @RequestParam(defaultValue = "5") Integer pageSize,
      60. HttpServletRequest request) {
      61. return Result.success(advertiserInfoService.findPage(name, pageNum, pageSize, request));
      62. }
      63. /**
      64. * 批量通过excel添加信息
      65. * @param file excel文件
      66. * @throws IOException
      67. */
      68. @PostMapping("/upload")
      69. public Result upload(MultipartFile file) throws IOException {
      70. List infoList = ExcelUtil.getReader(file.getInputStream()).readAll(AdvertiserInfo.class);
      71. if (!CollectionUtil.isEmpty(infoList)) {
      72. // 处理一下空数据
      73. List resultList = infoList.stream().filter(x -> ObjectUtil.isNotEmpty(x.getName())).collect(Collectors.toList());
      74. for (AdvertiserInfo info : resultList) {
      75. advertiserInfoService.add(info);
      76. }
      77. }
      78. return Result.success();
      79. }
      80. @GetMapping("/getExcelModel")
      81. public void getExcelModel(HttpServletResponse response) throws IOException {
      82. // 1. 生成excel
      83. Map row = new LinkedHashMap<>();
      84. row.put("name", "系统公告");
      85. row.put("content", "这是系统公告,管理员可以在后台修改");
      86. row.put("time", "TIME");
      87. List> list = CollUtil.newArrayList(row);
      88. // 2. 写excel
      89. ExcelWriter writer = ExcelUtil.getWriter(true);
      90. writer.write(list, true);
      91. response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
      92. response.setHeader("Content-Disposition","attachment;filename=advertiserInfoModel.xlsx");
      93. ServletOutputStream out = response.getOutputStream();
      94. writer.flush(out, true);
      95. writer.close();
      96. IoUtil.close(System.out);
      97. }
      98. }

      五,项目总结

          项目功能完整,设计简约大方,利用springboot和vue搭建了一个具有前端展示和物品购买的前端系统,以及后台用于管理相关信息的后台管理系统,可以用做毕业设计使用。

    226. 相关阅读:
      5G基站超200万,5G工业网关能否大规模应用?
      七月集训(第21天) —— 堆(优先队列)
      第九章 常用服务器的搭建
      如何判断一个低代码平台是否专业?
      载羟基喜树碱-聚乳酸纳米粒|平均粒径为85nm的葫芦素BE聚乳酸纳米微粒(CuBE- PLA-NP)技术资料
      深度强化学习中Double DQN算法(Q-Learning+CNN)的讲解及在Asterix游戏上的实战(超详细 附源码)
      轻量型服务器能支撑多少人访问?
      基于云原生存储的容器持久化存储方案
      机器学习-4
      ESP32蓝牙实例-BLE服务器与客户端通信
    227. 原文地址:https://blog.csdn.net/BS009/article/details/126180559