Java项目:springboot超市进销存管理系统

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

超市进销存管理系统,分为管理员与普通员工两种角色;

管理员主要功能包括:

员工管理:员工的添加、编辑、删除;

普通员工主要功能包括:

供应商管理:供应商的添加、删除、修改;

商品管理:商品种类管理、商品信息管理;

库存管理;

订单管理;

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7版本;
7.lombok 注:一定要安装,否则会有问题;

技术栈

1. 后端:SpringBoot+Mybatis

2. 前端:Html+jQuery+Layui+echarts

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2.使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;

3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;

4. 管理员访问地址:http://localhost:8085/admin

员工访问地址:http://localhost:8085

运行截图

 Java项目:springboot超市进销存管理系统_第1张图片

Java项目:springboot超市进销存管理系统_第2张图片

Java项目:springboot超市进销存管理系统_第3张图片

Java项目:springboot超市进销存管理系统_第4张图片

Java项目:springboot超市进销存管理系统_第5张图片

Java项目:springboot超市进销存管理系统_第6张图片

Java项目:springboot超市进销存管理系统_第7张图片

代码相关

商品管理控制器

@RestController
@RequestMapping(value = "/goods")
public class GoodsController {

    private Logger logger = LoggerFactory.getLogger(GoodsController.class);

    private GoodsService goodsServiceImpl;

    public GoodsController(GoodsService goodsServiceImpl) {
        this.goodsServiceImpl = goodsServiceImpl;
    }

    @PostMapping(value = "/addGoodsType")
    public int addGoodsType(GoodsType type) {
        return goodsServiceImpl.addGoodsType(type);
    }

    @PostMapping(value = "/delGoodsType/{id}")
    public int delGoodsType(@PathVariable("id") String id) {
        return goodsServiceImpl.delGoodsType(id);
    }

    @PostMapping(value = "/updateGoodsType")
    public int updateGoodsType(GoodsType type) {
        return goodsServiceImpl.updateGoodsType(type);
    }

    @GetMapping(value = "/findById/{id}")
    public GoodsType findById(@PathVariable("id") String id) {
        return goodsServiceImpl.findById(id);
    }

    @GetMapping(value = "/findByName")
    public GoodsType findByName(@RequestParam("name") String name) {
        return goodsServiceImpl.findByName(name);
    }

    @GetMapping(value = "/findAllByPage")
    public PageInfo findAllByPage(PageInfo info,
                                             @RequestParam(value = "name", defaultValue = "") String name) {
        return goodsServiceImpl.findAllByPage(info, name);
    }

    @GetMapping(value = "/getEcharts")
    public Map getGoodsTypeEcharts() {
        return goodsServiceImpl.getGoodsTypeEcharts();
    }

    @GetMapping(value = "/findAllType")
    public List findAllType() {
        return goodsServiceImpl.findAllType();
    }

    @PostMapping(value = "/addGoods")
    public int addGoods(Goods goods) {
        return goodsServiceImpl.addGoods(goods);
    }

    @PostMapping(value = "/delGoods/{id}")
    public int delGoods(@PathVariable("id") int id) {
        return goodsServiceImpl.delGoods(id);
    }

    @PostMapping(value = "/updateGoods")
    public int updateGoods(Goods goods) {
        return goodsServiceImpl.updateGoods(goods);
    }

    @GetMapping(value = "/findGoodsByPage")
    public PageInfo findGoodsByPage(PageInfo info,
                                       @RequestParam(value = "type", defaultValue = "") String type,
                                           @RequestParam(value = "name", defaultValue = "") String name) {
        return goodsServiceImpl.findGoodsByPage(info, type, name);
    }

    @GetMapping(value = "/findGoodsById/{id}")
    public Goods findGoodsById(@PathVariable("id") int id) {
        return goodsServiceImpl.findGoodsById(id);
    }

    @GetMapping(value = "/findAllGoodsByName")
    public List findAllGoodsByName(@RequestParam(value = "name", defaultValue = "") String name) {
        return goodsServiceImpl.findAllGoodsByName(name);
    }

}

 库存管理控制器

@RestController
@RequestMapping(value = "/warehouse")
public class WarehouseController {

    private WarehouseService warehouseServiceImpl;
    private GoodsService goodsServiceImpl;

    public WarehouseController(WarehouseService warehouseServiceImpl,
                               GoodsService goodsServiceImpl) {
        this.warehouseServiceImpl = warehouseServiceImpl;
        this.goodsServiceImpl = goodsServiceImpl;
    }

    @PostMapping(value = "/addWarehouse")
    public int addWarehouse(Warehouse warehouse) {
        Goods goods = goodsServiceImpl.findGoodsByName(warehouse.getGoods());
        if (goods != null) {
            warehouse.setId(UUID.randomUUID().toString().replace("-", ""));
            warehouse.setTime(new Date());
            warehouse.setPrice(goods.getPrice() * warehouse.getCount());
            warehouse.setType(GlobalConstant.inWarehouse);
            int addWarehouseResult = warehouseServiceImpl.addWarehouse(warehouse);
            goods.setWarehouse(goods.getWarehouse() + warehouse.getCount());
            int updateWarehouseCount = goodsServiceImpl.updateGoods(goods);
            return addWarehouseResult == updateWarehouseCount ? GlobalConstant.SUCCESS : GlobalConstant.ERROR;
        }
        Goods good = new Goods();
        good.setName(warehouse.getGoods());
        good.setCode(UUID.randomUUID().toString().replace("-", ""));
        Date date = new Date();
        good.setType(goodsServiceImpl.findAllByPage(new PageInfo<>(0, 1), null).getData().get(0).getName());
        good.setCreater(warehouse.getOperator());
        good.setCtime(date);
        good.setUpdater(warehouse.getOperator());
        good.setUtime(date);
        good.setStatus(1);
        good.setWarehouse(warehouse.getCount());
        int addGoodsRes = goodsServiceImpl.addGoods(good);
        warehouse.setId(UUID.randomUUID().toString().replace("-", ""));
        warehouse.setPrice(0d);
        warehouse.setType(GlobalConstant.inWarehouse);
        int addWarehouseRes = warehouseServiceImpl.addWarehouse(warehouse);
        return addGoodsRes == addWarehouseRes ? GlobalConstant.SUCCESS : GlobalConstant.ERROR;
    }

    @PostMapping(value = "/outWarehouse")
    public int outWarehouse(Goods goods) {
        Goods good = goodsServiceImpl.findGoodsById(goods.getId());
        good.setWarehouse(good.getWarehouse() - goods.getWarehouse());
        int outGoodsWarehouse = goodsServiceImpl.updateGoods(good);
        Warehouse warehouse = new Warehouse();
        warehouse.setId(UUID.randomUUID().toString().replace("-", ""));
        warehouse.setGoods(good.getName());
        warehouse.setCount(goods.getWarehouse());
        warehouse.setTime(new Date());
        warehouse.setType(GlobalConstant.outWarehouse);
        warehouse.setOperator(goods.getUpdater());
        int outWarehouse = warehouseServiceImpl.addWarehouse(warehouse);
        return outGoodsWarehouse == outWarehouse ? GlobalConstant.SUCCESS : GlobalConstant.ERROR;
    }

    @GetMapping(value = "/findAllByPage")
    public PageInfo findAllByPage(PageInfo info,
                                             @RequestParam(value = "id", defaultValue = "") String id) {
        return warehouseServiceImpl.findAllWarehouseByPage(info, id);
    }

}

如果也想学习本系统,下面领取。回复:053springboot 

 

你可能感兴趣的:(springboot,java,java,spring,boot,spring)