Java项目:商品进销存管理系统(java+SpringBoot+VUE+Maven+Mybatis+Mysql)

源码获取:俺的博客首页 "资源" 里下载!

一、项目运行

环境配置:

Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。

项目技术:

Spring + SpringBoot+ mybatis + Maven + Vue 等等组成,B/S模式 + Maven管理等等。
 

 

 

 

 

 

商品管理控制层:

/**
 * @author
 * yy
 */

@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<GoodsType> findAllByPage(PageInfo<GoodsType> info,
                                             @RequestParam(value = "name", defaultValue = "") String name) {
        return goodsServiceImpl.findAllByPage(info, name);
    }

    @GetMapping(value = "/getEcharts")
    public Map<String, Object> getGoodsTypeEcharts() {
        return goodsServiceImpl.getGoodsTypeEcharts();
    }

    @GetMapping(value = "/findAllType")
    public List<GoodsType> 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<Goods> findGoodsByPage(PageInfo<Goods> 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<String> findAllGoodsByName(@RequestParam(value = "name", defaultValue = "") String name) {
        return goodsServiceImpl.findAllGoodsByName(name);
    }

}

订单管理控制层: 

@RestController
@RequestMapping(value = "/order")
public class OrderController {

    private OrderService orderServiceImpl;

    public OrderController(OrderService orderServiceImpl) {
        this.orderServiceImpl = orderServiceImpl;
    }

    @PostMapping(value = "/addOrder")
    public int addOrder(Order order, HttpServletRequest request) {
        HttpSession session = request.getSession();
        Employee emp = (Employee) session.getAttribute("emp");
        order.setCreater(emp.getName());
        order.setUpdater(emp.getName());
        return orderServiceImpl.addOrder(order);
    }

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

    @PostMapping(value = "/updateOrder")
    public int updateOrder(Order order, HttpServletRequest request) {
        HttpSession session = request.getSession();
        Employee emp = (Employee) session.getAttribute("emp");
        order.setUpdater(emp.getName());
        return orderServiceImpl.updateOrder(order);
    }

    @GetMapping(value = "/findAllOrdersByPage")
    public PageInfo<Order> findAllOrdersByPage(PageInfo<Order> info,
                                               @RequestParam(value = "no", defaultValue = "") String no) {
        return orderServiceImpl.findAllOrdersByPage(info, no);
    }

    @GetMapping(value = "/findById/{id}")
    public Order findById(@PathVariable("id") int id) {
        return orderServiceImpl.findById(id);
    }

}

供应商管理控制层:

@RestController
@RequestMapping(value = "/provider")
public class ProviderController {

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

    private ProviderService providerServiceImpl;

    public ProviderController(ProviderService providerServiceImpl) {
        this.providerServiceImpl = providerServiceImpl;
    }

    @PostMapping(value = "/addProvider")
    public int addProvider(Provider provider) {
        return providerServiceImpl.addProvider(provider);
    }

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

    @PostMapping(value = "/updateProvider")
    public int updateProvider(Provider provider) {
        return providerServiceImpl.updateProvider(provider);
    }

    @GetMapping(value = "/findById/{id}")
    public Provider findById(@PathVariable("id") int id) {
        return providerServiceImpl.findById(id);
    }

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

    @GetMapping(value = "/findAllByPage")
    public PageInfo<Provider> findAllByPage(PageInfo<Provider> info,
                                            @RequestParam(value = "name", defaultValue = "") String name) {
        return providerServiceImpl.findAll(info, 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<Warehouse> findAllByPage(PageInfo<Warehouse> info,
                                             @RequestParam(value = "id", defaultValue = "") String id) {
        return warehouseServiceImpl.findAllWarehouseByPage(info, id);
    }

}

源码获取:俺的博客首页 "资源" 里下载!

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

OldWinePot

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值