• 基于Springboot+Vue开发前后端端分离农产品进销存系统


    项目编号:BS-XX-145

    引言:

    目前整个社会已经进入到一个商品异常丰富的商品时代,商业化的高度发展也加速了商品流通的速度,很多的生产企业和商贸公司也遍地开花似的蓬勃发展起来了。而如何去有效的管理这些琳琅满目的商品的采购、销售、库存信息,是面临的一大难题,传统的靠人工去管理的方式即效率低下,又容易出错,造成损耗,还无法及时统计信息。在当今信息化技术普遍应用的今天,如何利用信息化和数字化去管理商品的进销存信息,是一个值得研究的问题。

    本次经过调研走访开发设计的这套进销存管理系统,它的设计与开发主要基于Java开发语言平台,采用Spring 全家桶技术中的轻量级Springboot框架技术,并结合JPA第三方持久层框架开发实现,前端页面使用ElementsUI进行页面的开发布局,并同时使用了Vue等前端技术进行页面美化和图形报表开发。进销存系统的业务数据存储则使用MySQL8数据库。系统使用Tomcat8.5.31来部署运行。

    这套进销存管理系统的开发主要是采用产品设计开发的思路去做,尽量做的功能具有普遍适用性,经过走访调查,得出大多数商家的基本功能需求进而进行抽取整合,开发实现了这套进销存管理系统,它具有一定的社会推广性,对整个社会的商业化进行有着广泛而积极的意义。

    一,项目简介

    农产品进销存系统是针对商店、商场、超市的进销存业务处理的计算机化而设计,为进销存业务的处理人员提供计算机化的服务,改变以往的手工操作,提高工作效率,进而增强竞争力。本系统提供的服务主要有商品的进货、销售、库存管理以及相应的报表、查询功能等。系统使用前后端分离模式开发实现,后台使用springboot+mybatis开发,前端使用vue+nodejs实现,通过接口远程调用。系统前端主要实现产品的展销功能,后台主要实现相关的数据管理功能,具体的功能实现如下:

    1. 系统用户管理
    2. 商品管理
    3. 客户管理
    4. 供应商管理
    5. 进货管理
    6. 销售管理
    7. 统计报表
    8. 前台轮播广告图管理

    二,环境介绍

    语言环境:Java:  jdk1.8

    数据库:Mysql: mysql5.7

    应用服务器:Tomcat:  tomcat8.5.31

    开发工具:IDEA或eclipse

    后台开发技术:Springboot+mybatis

    前台开发技术:nodejs+vue

    三,系统展示

    前端页面及功能展示

    产品购买:

    后台用户登陆

    用户管理

    商品管理

    客户管理

    供应商管理

    商品进货

    退货查询

    商品销售

    商品退货查询

    统计报表

    轮播图管理

    四,核心代码展示

    1. package com.example.demo.controller;
    2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    3. import com.example.demo.dto.QueryDTO;
    4. import com.example.demo.entity.Customer;
    5. import com.example.demo.entity.Good;
    6. import com.example.demo.result.DataGridViewResult;
    7. import com.example.demo.result.Result;
    8. import com.example.demo.service.CustomerService;
    9. import org.springframework.beans.factory.annotation.Autowired;
    10. import org.springframework.web.bind.annotation.PostMapping;
    11. import org.springframework.web.bind.annotation.RequestBody;
    12. import org.springframework.web.bind.annotation.RequestMapping;
    13. import org.springframework.web.bind.annotation.RestController;
    14. import java.util.List;
    15. /**
    16. * Description: 客户
    17. * date: 2022/9/30 23:46
    18. * @author: znz
    19. * @since JDK 1.8
    20. */
    21. @RestController
    22. public class CustomerController {
    23. @Autowired
    24. private CustomerService customerService;
    25. /**
    26. * 分页查询
    27. * @param queryDTO
    28. * @return
    29. */
    30. @PostMapping("api/cust/list")
    31. public Result customerList(@RequestBody QueryDTO queryDTO){
    32. return new Result(200,"",customerService.selectCustomerPage(queryDTO));
    33. }
    34. /**
    35. * 添加
    36. * @param customer
    37. * @return
    38. */
    39. @PostMapping("api/cust/add")
    40. public Result addCustomer(@RequestBody Customer customer){
    41. return new Result(200,"",customerService.addCustomer(customer));
    42. }
    43. /**
    44. * 更新/修改
    45. * @param customer
    46. * @return
    47. */
    48. @PostMapping("api/cust/update")
    49. public Result updateCustomer(@RequestBody Customer customer){
    50. System.out.println(customer);
    51. return new Result(200,"",customerService.updateCustomer(customer));
    52. }
    53. /**
    54. * 删除
    55. * @param custid
    56. * @return
    57. */
    58. @PostMapping("api/cust/delete")
    59. public Result deleteCustomer(Integer custid){
    60. return new Result(200,"",customerService.deleteCustomer(custid));
    61. }
    62. /**
    63. * 批量删除
    64. * @param custids
    65. * @return
    66. */
    67. @PostMapping("api/cust/delete/batch")
    68. public Result batchDeleteCustomer(@RequestBody List custids){
    69. customerService.batchDelete(custids);
    70. return new Result(200,"","");
    71. }
    72. /**
    73. * 加载下拉框
    74. *
    75. * @return
    76. */
    77. @RequestMapping("api/cust/AllCust")
    78. public DataGridViewResult loadAllCust() {
    79. QueryWrapper queryWrapper = new QueryWrapper<>();
    80. List list = customerService.list(queryWrapper);
    81. return new DataGridViewResult(list);
    82. }
    83. /**
    84. * 根据客户id加载客户名称
    85. * @param
    86. * @return
    87. */
    88. @PostMapping("api/cust/loadCustById")
    89. public DataGridViewResult loadCustById(Integer custid) {
    90. QueryWrapper goodsQueryWrapper = new QueryWrapper<>();
    91. goodsQueryWrapper.eq(custid != 0, "custid", custid);
    92. Customer customer = customerService.getById(custid);
    93. return new DataGridViewResult(customer);
    94. }
    95. }

    1. package com.example.demo.controller;
    2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    3. import com.baomidou.mybatisplus.core.metadata.IPage;
    4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
    5. import com.example.demo.dto.QueryDTO;
    6. import com.example.demo.entity.Good;
    7. import com.example.demo.entity.Provider;
    8. import com.example.demo.mapper.GoodMapper;
    9. import com.example.demo.result.DataGridViewResult;
    10. import com.example.demo.result.Result;
    11. import com.example.demo.service.GoodService;
    12. import com.example.demo.service.ProviderService;
    13. import org.apache.commons.lang3.RandomStringUtils;
    14. import org.springframework.beans.factory.annotation.Autowired;
    15. import org.springframework.util.StringUtils;
    16. import org.springframework.web.bind.annotation.*;
    17. import javax.servlet.http.HttpServletRequest;
    18. import java.util.List;
    19. /**
    20. * Description:
    21. * date: 2022/9/18 23:56
    22. * @author: znz
    23. * @since JDK 1.8
    24. */
    25. @RestController
    26. public class GoodController {
    27. @Autowired
    28. private GoodService service;
    29. @Autowired
    30. private GoodMapper goodMapper;
    31. /**
    32. * 分页查询
    33. * @param queryDTO
    34. * @return
    35. */
    36. @PostMapping("api/good/list")
    37. public Result goodList(@RequestBody QueryDTO queryDTO){
    38. return new Result(200,"",service.selectGoodPage(queryDTO));
    39. }
    40. @PostMapping("api/good/listpro")
    41. public Result goodProList(String keyword){
    42. return new Result(200,"",goodMapper.selectname(keyword));
    43. }
    44. /**
    45. * 前台显示
    46. * @return
    47. */
    48. @PostMapping("api/good/lists")
    49. public Result goodLists(){
    50. return new Result(200,"",service.list());
    51. }
    52. /**
    53. * 前台查询商品名称
    54. * @return
    55. */
    56. @PostMapping("api/good/selectlists")
    57. public Result goodSelectLists(String keyword){
    58. return new Result(200,"",goodMapper.selectgood(keyword));
    59. }
    60. /**
    61. * 添加
    62. * @param good
    63. * @return
    64. */
    65. @PostMapping("api/good/add")
    66. public Result addGood(@RequestBody Good good){
    67. // 随机的商品编号
    68. String bering = RandomStringUtils.randomAlphanumeric(8);
    69. good.setCommbering(bering);
    70. good.setInventory(0);
    71. return new Result(200,"",service.addGood(good));
    72. }
    73. /**
    74. * 更新/修改
    75. * @param good
    76. * @return
    77. */
    78. @PostMapping("api/good/update")
    79. public Result updateGoods(@RequestBody Good good){
    80. return new Result(200,"",service.updateGood(good));
    81. }
    82. /**
    83. * 删除
    84. * @param commid
    85. * @return
    86. */
    87. @PostMapping("api/good/delete")
    88. public Result deleteGood(Integer commid){
    89. return new Result(200,"",service.deleteGood(commid));
    90. }
    91. /**
    92. * 批量删除
    93. * @param commids
    94. * @return
    95. */
    96. @PostMapping("api/good/delete/batch")
    97. public Result batchDeleteGood(@RequestBody List commids){
    98. service.batchDelete(commids);
    99. return new Result(200,"","");
    100. }
    101. /**
    102. * 根据商品id加载商品信息
    103. * @param
    104. * @return
    105. */
    106. @PostMapping("api/good/loadGoodById")
    107. public DataGridViewResult loadGoodsById(Integer commid) {
    108. QueryWrapper goodsQueryWrapper = new QueryWrapper<>();
    109. goodsQueryWrapper.eq(commid != 0, "commid", commid);
    110. Good good = service.getById(commid);
    111. System.out.println(good);
    112. return new DataGridViewResult(good);
    113. }
    114. /**
    115. * 根据供应商id加载商品信息
    116. * @param
    117. * @return
    118. */
    119. @PostMapping("api/good/loadProById")
    120. public DataGridViewResult loadProById(Integer providerid) {
    121. QueryWrapper goodsQueryWrapper = new QueryWrapper<>();
    122. goodsQueryWrapper.eq(providerid != 0, "providerid", providerid);
    123. Good good = service.getById(providerid);
    124. System.out.println(good);
    125. return new DataGridViewResult(good);
    126. }
    127. /**
    128. * 加载下拉框
    129. *
    130. * @return
    131. */
    132. @RequestMapping("api/good/AllGood")
    133. public DataGridViewResult loadAllGoods() {
    134. QueryWrapper queryWrapper = new QueryWrapper<>();
    135. List list = service.list(queryWrapper);
    136. return new DataGridViewResult(list);
    137. }
    138. }

    1. package com.example.demo.controller;
    2. import com.example.demo.result.SysResult;
    3. import org.apache.tomcat.util.http.fileupload.FileUtils;
    4. import org.springframework.http.MediaType;
    5. import org.springframework.util.ResourceUtils;
    6. import org.springframework.web.bind.annotation.PostMapping;
    7. import org.springframework.web.bind.annotation.RequestMapping;
    8. import org.springframework.web.bind.annotation.RequestParam;
    9. import org.springframework.web.bind.annotation.RestController;
    10. import org.springframework.web.multipart.MultipartFile;
    11. import javax.servlet.http.HttpServletRequest;
    12. import java.io.File;
    13. import java.io.IOException;
    14. import java.text.SimpleDateFormat;
    15. import java.util.Date;
    16. @RestController
    17. public class ImageudController {
    18. /**
    19. * 文件上传
    20. * @param picture
    21. * @param request
    22. * @return
    23. */
    24. @RequestMapping("/api/good/upload")
    25. public SysResult upload(@RequestParam("picture") MultipartFile picture, HttpServletRequest request) {
    26. // 获取文件在服务器的储存位置
    27. // String path = request.getSession().getServletContext().getRealPath("/upload");
    28. // 将文件存储到vue的static文件方便修改整理
    29. String path = "E:/vue/demo-vue/static/upload";
    30. File filePath = new File(path);
    31. System.out.println("文件的保存路径:" + path);
    32. if (!filePath.exists() && !filePath.isDirectory()) {
    33. System.out.println("目录不存在,创建目录:" + filePath);
    34. filePath.mkdir();
    35. }
    36. //获取原始文件名称(包含格式)
    37. String originalFileName = picture.getOriginalFilename();
    38. System.out.println("原始文件名称:" + originalFileName);
    39. //获取文件类型,以最后一个`.`为标识
    40. String type = originalFileName.substring(originalFileName.lastIndexOf(".") + 1);
    41. System.out.println("文件类型:" + type);
    42. //获取文件名称(不包含格式)
    43. String name = originalFileName.substring(0, originalFileName.lastIndexOf("."));
    44. //设置文件新名称: 当前时间+文件名称(不包含格式)
    45. Date d = new Date();
    46. SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
    47. String date = sdf.format(d);
    48. String fileName = date + name + "." + type;
    49. System.out.println("新文件名称:" + fileName);
    50. //在指定路径下创建一个文件
    51. File targetFile = new File(path, fileName);
    52. //将文件保存到指定位置
    53. try {
    54. picture.transferTo(targetFile);
    55. System.out.println("上传成功");
    56. //将文件在指定存储路径返回
    57. return new SysResult(true,"/upload/" + fileName);
    58. } catch (IOException e) {
    59. System.out.println("上传失败");
    60. e.printStackTrace();
    61. return new SysResult(false, "上传失败");
    62. }
    63. }
    64. /**
    65. * 文件上传
    66. * @param image
    67. * @param request
    68. * @return
    69. */
    70. @RequestMapping("/api/sildeshow/upload")
    71. public SysResult uploads(@RequestParam("image") MultipartFile image, HttpServletRequest request) {
    72. // 获取文件在服务器的储存位置
    73. // String path = request.getSession().getServletContext().getRealPath("/upload");
    74. // 将文件存储到vue的static文件方便修改整理
    75. String path = "E:/vue/demo-vue/static/upload";
    76. File filePath = new File(path);
    77. System.out.println("文件的保存路径:" + path);
    78. if (!filePath.exists() && !filePath.isDirectory()) {
    79. System.out.println("目录不存在,创建目录:" + filePath);
    80. filePath.mkdir();
    81. }
    82. //获取原始文件名称(包含格式)
    83. String originalFileName = image.getOriginalFilename();
    84. System.out.println("原始文件名称:" + originalFileName);
    85. //获取文件类型,以最后一个`.`为标识
    86. String type = originalFileName.substring(originalFileName.lastIndexOf(".") + 1);
    87. System.out.println("文件类型:" + type);
    88. //获取文件名称(不包含格式)
    89. String name = originalFileName.substring(0, originalFileName.lastIndexOf("."));
    90. //设置文件新名称: 当前时间+文件名称(不包含格式)
    91. Date d = new Date();
    92. SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
    93. String date = sdf.format(d);
    94. String fileName = date + name + "." + type;
    95. System.out.println("新文件名称:" + fileName);
    96. //在指定路径下创建一个文件
    97. File targetFile = new File(path, fileName);
    98. //将文件保存到指定位置
    99. try {
    100. image.transferTo(targetFile);
    101. System.out.println("上传成功");
    102. //将文件在指定存储路径返回
    103. return new SysResult(true,"/upload/" + fileName);
    104. } catch (IOException e) {
    105. System.out.println("上传失败");
    106. e.printStackTrace();
    107. return new SysResult(false, "上传失败");
    108. }
    109. }
    110. }
    1. package com.example.demo.controller;
    2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    3. import com.example.demo.dto.QueryDTO;
    4. import com.example.demo.entity.Good;
    5. import com.example.demo.entity.Provider;
    6. import com.example.demo.entity.User;
    7. import com.example.demo.result.DataGridViewResult;
    8. import com.example.demo.result.Result;
    9. import com.example.demo.service.ProviderService;
    10. import org.springframework.beans.factory.annotation.Autowired;
    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.RestController;
    15. import java.util.List;
    16. /**
    17. * @Author znz
    18. * @Date 2022/10/3 0:06
    19. * @Version 1.0
    20. */
    21. @RestController
    22. public class ProviderController {
    23. @Autowired
    24. private ProviderService service;
    25. /**
    26. * 分页查询
    27. * @param queryDTO
    28. * @return
    29. */
    30. @PostMapping("api/provider/list")
    31. public Result providerList(@RequestBody QueryDTO queryDTO){
    32. return new Result(200,"",service.selectProviderPage(queryDTO));
    33. }
    34. /**
    35. * 添加
    36. * @param provider
    37. * @return
    38. */
    39. @PostMapping("api/provider/add")
    40. public Result addProvider(@RequestBody Provider provider){
    41. return new Result(200,"",service.addProvider(provider));
    42. }
    43. /**
    44. * 更新/修改
    45. * @param provider
    46. * @return
    47. */
    48. @PostMapping("api/provider/update")
    49. public Result updateProvider(@RequestBody Provider provider){
    50. return new Result(200,"",service.updateProvider(provider));
    51. }
    52. /**
    53. * 删除
    54. * @param providerid
    55. * @return
    56. */
    57. @PostMapping("api/provider/delete")
    58. public Result deleteProvider(Integer providerid){
    59. return new Result(200,"",service.deleteProvider(providerid));
    60. }
    61. /**
    62. * 批量删除
    63. * @param providerids
    64. * @return
    65. */
    66. @PostMapping("api/provider/delete/batch")
    67. public Result batchDeleteProvider(@RequestBody List providerids){
    68. service.batchDelete(providerids);
    69. return new Result(200,"","");
    70. }
    71. /**
    72. * 根据供应商id加载供应商信息
    73. * @param
    74. * @return
    75. */
    76. @PostMapping("api/provider/loadProviderById")
    77. public DataGridViewResult loadProviderById(Integer providerid) {
    78. QueryWrapper goodsQueryWrapper = new QueryWrapper<>();
    79. goodsQueryWrapper.eq(providerid != 0, "providerid", providerid);
    80. Provider provider = service.getById(providerid);
    81. System.out.println(provider);
    82. return new DataGridViewResult(provider);
    83. }
    84. /**
    85. * 根据供应商id加载供应商信息
    86. * @param
    87. * @return
    88. */
    89. @PostMapping("api/provider/loadProviderByIds")
    90. public DataGridViewResult loadProviderByIds(Integer providerid) {
    91. QueryWrapper goodsQueryWrapper = new QueryWrapper<>();
    92. goodsQueryWrapper.eq(providerid != 0, "providerid", providerid);
    93. Provider provider = service.getById(providerid);
    94. System.out.println(provider);
    95. return new DataGridViewResult(provider);
    96. }
    97. /**
    98. * 加载下拉框
    99. *
    100. * @return
    101. */
    102. @RequestMapping("api/provider/AllProvider")
    103. public DataGridViewResult loadAllProvider() {
    104. QueryWrapper queryWrapper = new QueryWrapper<>();
    105. List list = service.list(queryWrapper);
    106. return new DataGridViewResult(list);
    107. }
    108. }

    五,项目总结

    本项目功能齐全,基于前后端开发模式,前端和后台分别独立运行,并且提供了进销存商品展销的前端页面来供浏览,比较适合做毕业设计使用。

  • 相关阅读:
    Arthas(阿尔萨斯)--(四)
    Kubernetes Replicaset
    《Oracle系列》Oracle 通过触发器记录一张表所有数据的增删改操作,然后插入到另外一张表中
    详解SurfaceView和TextureView
    如何在Ubuntu 20.04.6 LTS系统上运行Playwright自动化测试
    go 内存泄露
    读书笔记:Effective C++ 2.0 版 1997年Scott Meyers,条款1、2、3、4
    Java项目:SSM健身房俱乐部管理系统
    RuoYi_Cloud本地搭建
    springboot 使用多线程和线程池
  • 原文地址:https://blog.csdn.net/BS009/article/details/127115216