码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 基于SpringBoot的免税商品优选购物商城


    目录

    前言

     一、技术栈

    二、系统功能介绍

    登录界面

    管理员功能模块

    商家功能模块

    用户前台功能模块

    三、核心代码

    1、登录模块

     2、文件上传模块

    3、代码封装

    四、文章目录


    前言

    随着科学技术的飞速发展,各行各业都在努力与现代先进技术接轨,通过科技手段提高自身的优势,免税商品优选购物商城当然也不能排除在外,随着购物商城的不断成熟,它彻底改变了过去传统的免税商品优选购物商城方式,不仅使商城管理难度变低了,还提升了免税商品优选购物商城的灵活性。这种个性化的免税商品优选购物商城特别注重交互协调经营与管理的相互配合,激发了管理人员的创造性与主动性,对资产设备借还的管理而言非常有利。

    本文首先分析了免税商品优选购物商城的发展背景和意义,简要阐述了免税商品优选购物商城开发的主要内容和优势,然后简要介绍了国内外免税商品优选购物商城的研究和应用现状,并对系统开发技术,系统分析和总体设计,实现详细功能等。

    本免税商品优选购物商城采用的数据库是MYSQL,使用java技术开发,在设计过程中,充分保证了系统代码的良好可读性、实用性、易扩展性、通用性、便于后期维护、操作方便以及页面简洁等特点。

     一、技术栈

    末尾获取源码
    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. }

    四、文章目录

    摘 要.................................................................................................................................. 2

    Abstract............................................................................................................................. 3

    第一章 绪论........................................................................................................................ 4

    1.1 课题开发的背景..................................................................................................... 4

    1.2 课题研究的意义..................................................................................................... 4

    1.3 研究内容............................................................................................................... 5

    第二章 系统开发关键技术................................................................................................... 6

    2.1 JAVA技术.............................................................................................................. 6

    2.2 MyEclipse开发环境............................................................................................... 6

    2.3 Tomcat服务器....................................................................................................... 7

    2.4 Spring Boot框架................................................................................................ 7

    2.5 MySQL数据库......................................................................................................... 7

    第三章 系统分析............................................................................................................... 10

    3.1 系统可行性研究................................................................................................... 10

    3.2 性能分析.............................................................................................................. 11

    3.3 业务流程分析....................................................................................................... 11

    3.4.1操作流程.................................................................................................... 11

    3.4.2添加信息流程............................................................................................. 12

    3.4.3删除信息流程............................................................................................. 12

    第四章 系统的总体设计..................................................................................................... 14

    4.1 系统功能结构设计............................................................................................... 14

    4.2 数据库概述.......................................................................................................... 15

    4.2.1 数据库概念设计........................................................................................ 15

    4.2.2 数据库逻辑设计........................................................................................ 16

    第五章 系统的实现............................................................................................................ 19

    5.1登录界面.............................................................................................................. 19

    5.2管理员功能模块.................................................................................................... 19

    5.3商家功能模块....................................................................................................... 21

    5.2用户前台功能模块................................................................................................ 22

    5.3用户后台功能模块................................................................................................ 25

    第六章 系统测试............................................................................................................... 27

    6.1系统测试的目的.................................................................................................... 27

    6.2测试方法.............................................................................................................. 27

    6.3系统测试模块....................................................................................................... 27

    总 结................................................................................................................................. 29

    参考文献........................................................................................................................... 30

    致 谢     31

  • 相关阅读:
    Mysql数据库--修改root密码的几种方法(忘记密码&知道密码)
    Android 中集成 TensorFlow Lite图片识别
    01背包(一) 01背包(二)动态规划
    云主机内网通信ping不通问题处理过程
    iOS微信发布8.0.29版本,苹果14用户快来
    【目标检测】SPP-Net
    leetcode 二叉树的公共近祖先
    【操作系统】进程是如何调度的?
    MybatisPlus 常用注解
    使用百度语音识别技术实现文字转语音的Java应用
  • 原文地址:https://blog.csdn.net/2301_77541824/article/details/133033979
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号