admin 管理员组

文章数量: 1184232

文章目录

  • 0 前言
  • 1 课题简介
  • 2 实现功能
    • 2.1 系统整体设计
  • 3 运行效果
  • 4 部分实现代码
  • 3 整体项目内容
  • 最后


0 前言

今天向大家展示学长帮助同学完成的一个毕业设计:基于java web的进销存管理系统的设计。

毕设帮助,开题指导,资料分享,疑问解答(见文末)

项目获取方式:

https://blog.csdn/fawubio/article/details/125236987


1 课题简介

进入21世纪以来,商业管理中需要处理的数据和信息越来越多。大量的数据和繁杂的数据使得古老的手工处理数据的方式渐渐显得力不从心。甚至有些信息处理的方式在手工处理的模式下是根本无法是实现的,只能利用计算机的高运行频率来进行迭代计算。而且最近国家正在提倡大众创业,中小型企业很多。中小企业在我国经济发展中具有重要地位,目前我国的中小企业数量多,地区分布广泛,行业分布跨度大。随着全球经济一体化的发展和电子商务的兴起,中小企业之间的竞争将越来越激烈。网络及电子商务的迅猛发展突破了时间、空间的局限性,给中小企业带来了更多的发展机会,同时也增大了企业之间的竞争强度。这就要求中小企业必须改变企业的经营管理模式,提高企业的运营效率。随着技术发展,电脑操作及管理日趋简化,电脑知识日趋普及,同时市场经济快速多变,竞争激烈,企业采用电脑管理进货、库存、销售等诸多环节也已成为必然趋势。

2 实现功能

2.1 系统整体设计

添加商品的业务流程

采购业务员通过UI界面选择添加商品菜单,此时后台controller会判断该操作用户是否有权限;权限检查通过,操作员进入到商品添加表单,输入商品信息提交,后台controller会调用service的add方法,service中的方法add在调用database中的板寸方法。成功后返回成功提示。

系统ER关系

3 运行效果




4 部分实现代码

package com.xu.service.imp;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;



import javax.annotation.Resource;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.xu.bean.Goods;
import com.xu.bean.Message;
import com.xu.bean.Stock;
import com.xu.dao.GoodsRepository;
import com.xu.dao.MessageRepository;
import com.xu.dao.StockRepository;
import com.xu.exception.ServiceException;
import com.xu.service.StockService;
@Service
public class StockServiceImp implements StockService{

	@Resource
	private StockRepository stockRepository;
	@Resource
	private GoodsRepository goodsRepository;
	@Resource
	private Message message;
	@Resource
	private MessageRepository messageRepository;
	
	public int isCount(){
		List<Stock> map = stockRepository.findAllGoodsCount();
		for(Stock stock:map){
			if(stock.getCounts()<100){
				String name = goodsRepository.findGoodsNameById(stock.getGoodsId());
				message.setDate(new Date());
				message.setMsg(name+"库存不足100,现在剩余"+stock.getCounts()+"件!!!");
				message.setFlag("未查看");
				messageRepository.save(message);
				
			}
		}
		return 1;
	}
	@Override
	public int stockAdd(Stock stock, Goods goods) throws ServiceException {
		Goods gods = goodsRepository.findGoodsByName(goods.getName());
		if(gods==null){			
			gods = goodsRepository.save(goods);
		}
		stock.setGoodsId(gods.getId());
		Stock stok = findStockByGoodsId(gods.getId());
		/**
		 * 判断库存是否不足
		 */
		isCount();
		if(stok==null){			
			stockRepository.save(stock);
		}else{
			stockRepository.updateStockCountByGoodsId(stok.getCounts()+stock.getCounts(),stock.getGoodsId());
		}
		return 1;
	}
	@Override
	public List<Stock> findAllStock() throws ServiceException {
		isCount();
		List<Stock> list = stockRepository.findAll();
		return list;
	}
	@Override
	public List<Stock> findStockByPage(int pageNum) throws ServiceException {
		Pageable pageable = new PageRequest(pageNum,10);
		isCount();
		Page<Stock> page = stockRepository.findAll(pageable);
		List<Stock> list = new ArrayList<Stock>();
		for(Stock s:page){
			list.add(s);
		}
		return list;
	}
	@Override
	public Long findStockCount() throws ServiceException {
		long count = stockRepository.count();
		return count;
	}
	@Override
	public Long getTotalPage() throws ServiceException {
		Long count = findStockCount();
		Long totalPage;
		if(count%10==0){
			totalPage = count/10;
		}else{
			totalPage = count/10 +1;
		}
		return totalPage;
		
	}
	@Override
	public int updateStock(Long goodsId,Long count) throws ServiceException {
		Long counts = stockRepository.findCountByGoodsId(goodsId);
		isCount();
		stockRepository.updateStockCountByGoodsId(counts-count,goodsId);
		return 0;
	}
	@Override
	public Stock findStockByGoodsId(Long goodsId) throws ServiceException {
		isCount();
		return stockRepository.findStockByGoodsId(goodsId);
	}
	@Override
	public int updateStockAreaByGoodsId(String area, Long goodsId) throws ServiceException {
		isCount();
		stockRepository.updateStockAreaByGoodsId(area,goodsId);
		return 1;
	}
	@Override
	public Goods saveGoods(Goods goods) throws ServiceException {
		Goods goods2 = goodsRepository.findGoodsByName(goods.getName());
		if(goods2==null){			
			return goodsRepository.save(goods);
		}
		return goods2;
	}
	@Override
	public Long findGoodsIdByGoodsName(String name) throws ServiceException {
		
		return goodsRepository.findGoodsIdByGoodsName(name);
	}
	@Override
	public int stockAdd(Stock stock) throws ServiceException {
		Stock stoks = findStockByGoodsId(stock.getGoodsId());
		isCount();
		if(stoks==null){			
			stockRepository.save(stock);
		}else{			
			stockRepository.updateStockCountByGoodsId(stoks.getCounts()+stock.getCounts(),stock.getGoodsId());
		}
		return 1;
	}
	@Override
	public int updateStockCount(String name, Long id) throws ServiceException {
		Goods goods = goodsRepository.findGoodsByName(name);
		isCount();
		stockRepository.updateStockCount(goods.getId(),id);
		return 1;
	}

}

3 整体项目内容

包含内容:

  • 项目源码 + 数据库
  • 论文+答辩PPT

文档和代码:

论文预览:

项目获取方式:

https://blog.csdn/fawubio/article/details/125236987

最后

本文标签: 毕业设计 进销存管理系统 java WEB