源码获取:俺的博客首页 "资源" 里下载!
项目介绍
基于SpringBoot+vue的供应商管理系统
本系统为后台管理系统,包含管理员、员工两种角色。
员工:首页、个人中心、公告管理、供应商信息管理、商品管理、出入库管理、商品进货管理、商品退货管理等。
管理员:首页、个人中心、管理员管理、基础数据管理、公告管理、供应商信息管理、商品管理、出入库管理、商品进货管理、商品退货管理、员工管理等。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
技术栈
后端:SpringBoot+Mybaits
前端:Vue + elementui
使用说明
项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入地址:
后台登录页面
http://localhost:8080/gongyingshang/admin/dist/index.html
管理员账户:admin 密码:admin
员工账户:a1 密码:123456
注意项目文件路径中不能含有中文、空格、特殊字符等,否则图片会上传不成功。
文档介绍展示:
供应商管理系统:
登录页面展示:
供应商类型管理页面:
管理员管理页面:
供应商信用管理:
公告类型管理页面:
公告管理页面:
进货类型管理:
出入库管理页面:
库存管理控制层:
@RestController
@RequestMapping("/input")
public class InputFormController {
@Resource
private GoodsService goodsService;
@Resource
private ProviderService providerService;
@Resource
private InputFormService inputFormService;
@Resource
private StockService stockService;
@Resource
private WarehouseService warehouseService;
@Resource
private TbUserService tbUserService;
@RequestMapping("loadAllInput")
public DataGridView loadAllInput(InputFormVo inputFormVo) {
IPage<InputForm> page = new Page<>(inputFormVo.getPage(), inputFormVo.getLimit());
QueryWrapper<InputForm> queryWrapper = new QueryWrapper();
queryWrapper.eq(null!=inputFormVo.getFormId(),"form_id",inputFormVo.getFormId());
queryWrapper.eq(null != inputFormVo.getProviderId() && inputFormVo.getProviderId()!=0,"provider_id",inputFormVo.getProviderId());
// queryWrapper.like(StringUtils.isNotBlank(inputFormVo.getName()),"name",inputFormVo.getName());
// queryWrapper.eq(inputFormVo.getPrice()!=null,"price",inputFormVo.getPrice());
TbUser user = (TbUser) WebUtils.getSession().getAttribute("user");
queryWrapper.eq(0!=user.getRoleId(),"house_id",user.getRoleId());
inputFormService.page(page,queryWrapper);
List<InputForm> records = page.getRecords();
for(InputForm inputForm : records){
Provider provider = providerService.getById(inputForm.getProviderId());
if (null != provider){
inputForm.setProviderName(provider.getName());
inputForm.setAddress(provider.getAddress());
}
Goods goods = goodsService.getById(inputForm.getGoodsId());
if(null != goods){
inputForm.setGoodsName(goods.getName());
inputForm.setSize(goods.getSize());
inputForm.setPackages(goods.getPackages());
inputForm.setPrice(goods.getPrice());
}
TbUser tbUser = tbUserService.getById(inputForm.getUserId());
if(null != tbUser){
inputForm.setUserName(tbUser.getName());
}
Warehouse warehouse = warehouseService.getById(inputForm.getHouseId());
if(null != warehouse){
inputForm.setHouseName(warehouse.getName());
}
}
return new DataGridView(page.getTotal(),page.getRecords());
}
@RequestMapping("addInput")
public ResultObj addInput(InputFormVo inputFormVo){
try {
TbUser tbUser = (TbUser) WebUtils.getSession().getAttribute("user");
inputFormVo.setCreateTime(new Date());
inputFormVo.setUserId(tbUser.getUserId());
Integer goodsId = inputFormVo.getGoodsId();
Integer houseId = inputFormVo.getHouseId();
Integer changeNumber = inputFormVo.getChangeNumber();
QueryWrapper<Stock> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("goods_id",goodsId);
queryWrapper.eq("house_id",houseId);
Stock stock = stockService.getOne(queryWrapper);
UpdateWrapper<Stock> updateWrapper = new UpdateWrapper<>();
if(null != stock){ //如果库存中有这件商品
updateWrapper.eq("goods_id",stock.getGoodsId());
updateWrapper.eq("house_id",stock.getHouseId());
}else { //如果库存中没有这件商品
QueryWrapper<Stock> query = new QueryWrapper();
query.eq("house_id",houseId);
query.eq("goods_id",0);
Integer upperAlert = stockService.getOne(query).getUpperAlert();
if(changeNumber < upperAlert){
Stock stock1 = new Stock(goodsId,houseId,changeNumber,upperAlert,0);
System.out.println("stock1 = " + stock1);
stockService.save(stock1);
inputFormService.save(inputFormVo);
return ResultObj.ADD_SUCCESS;
}
}
if(changeNumber+stock.getNumber() > stock.getUpperAlert()){
return ResultObj.ADD_ERROR_EXCEED;
}else if(inputFormVo.getChangeNumber() ==0){
return ResultObj.ERROR_ZERO;
} else {
stock.setNumber(inputFormVo.getChangeNumber()+stock.getNumber());
}
inputFormService.save(inputFormVo);
stockService.update(stock,updateWrapper);
return ResultObj.ADD_SUCCESS;
}
catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}
@RequestMapping("deleteInput")
public ResultObj deleteInput(Integer id){
try {
inputFormService.removeById(id);
return ResultObj.DELETE_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
}
供应商管理控制层:
@RestController
@RequestMapping("/provider")
public class ProviderController {
@Resource
private ProviderService providerService;
@RequestMapping("loadAllProvider")
public DataGridView loadAllProvider(ProviderVo providerVo){
//1.声明一个分页page对象
IPage<Provider> page = new Page(providerVo.getPage(),providerVo.getLimit());
//2.声明一个queryWrapper
QueryWrapper<Provider> queryWrapper = new QueryWrapper();
queryWrapper.eq(null != providerVo.getProviderId() && providerVo.getProviderId()!=0,"provider_id",providerVo.getProviderId());
queryWrapper.like(StringUtils.isNotBlank(providerVo.getManager()),"manager",providerVo.getManager());
queryWrapper.like(StringUtils.isNotBlank(providerVo.getTalePhone()),"tale_phone",providerVo.getTalePhone());
providerService.page(page,queryWrapper);
return new DataGridView(page.getTotal(),page.getRecords());
}
/**
* 添加一个供应商
* @param providerVo
* @return
*/
@RequestMapping("addProvider")
public ResultObj addProvider(ProviderVo providerVo){
try {
providerService.save(providerVo);
return ResultObj.ADD_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}
/**
* 修改一个供应商
* @param providerVo
* @return
*/
@RequestMapping("updateProvider")
public ResultObj updateProvider(ProviderVo providerVo){
try {
providerService.updateById(providerVo);
return ResultObj.UPDATE_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.UPDATE_ERROR;
}
}
/**
* 删除一个供应商
* @param id
* @return
*/
@RequestMapping("deleteProvider")
public ResultObj deleteProvider(Integer id){
try {
providerService.removeById(id);
return ResultObj.DELETE_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
//提供下拉框
@RequestMapping("loadAllProviderForSelect")
public DataGridView loadAllProviderForSelect(){
QueryWrapper<Provider> queryWrapper = new QueryWrapper<Provider>();
List<Provider> list = providerService.list(queryWrapper);
return new DataGridView(list);
}
}
出货管理控制层:
@RestController
@RequestMapping("/output")
public class OutputFormController {
@Resource
private GoodsService goodsService;
@Resource
private CustomerService customerService;
@Resource
private OutputFormService outputFormService;
@Resource
private StockService stockService;
@Resource
private WarehouseService warehouseService;
@Resource
private TbUserService tbUserService;
@RequestMapping("loadAllOutput")
public DataGridView loadAllOutput(OutputFormVo outputFormVo) {
IPage<OutputForm> page = new Page<>(outputFormVo.getPage(),outputFormVo.getLimit());
QueryWrapper<OutputForm> queryWrapper = new QueryWrapper();
queryWrapper.eq(null!=outputFormVo.getFormId(),"form_id",outputFormVo.getFormId());
queryWrapper.eq(null != outputFormVo.getCustomerId() && outputFormVo.getCustomerId()!=0,"customer_id",outputFormVo.getCustomerId());
TbUser user = (TbUser) WebUtils.getSession().getAttribute("user");
queryWrapper.eq(null!=user.getRoleId() && 0!=user.getRoleId(),"house_id",user.getRoleId());
outputFormService.page(page,queryWrapper);
List<OutputForm> records = page.getRecords();
for(OutputForm outputForm : records){
Customer customer = customerService.getById(outputForm.getCustomerId());
if (null != customer){
outputForm.setCustomerName(customer.getName());
outputForm.setAddress(customer.getAddress());
}
Goods goods = goodsService.getById(outputForm.getGoodsId());
if(null != goods){
outputForm.setGoodsName(goods.getName());
outputForm.setSize(goods.getSize());
outputForm.setPackages(goods.getPackages());
outputForm.setPrice(goods.getPrice());
}
TbUser tbUser = tbUserService.getById(outputForm.getUserId());
if(null != tbUser){
outputForm.setUserName(tbUser.getName());
}
Warehouse warehouse = warehouseService.getById(outputForm.getHouseId());
if(null != warehouse){
outputForm.setHouseName(warehouse.getName());
}
}
return new DataGridView(page.getTotal(),page.getRecords());
}
@RequestMapping("addOutput")
public ResultObj addOutput(OutputFormVo outputFormVo){
try {
TbUser tbUser = (TbUser) WebUtils.getSession().getAttribute("user");
outputFormVo.setCreateTime(new Date());
outputFormVo.setUserId(tbUser.getUserId());
QueryWrapper<Stock> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("goods_id",outputFormVo.getGoodsId());
queryWrapper.eq("house_id",outputFormVo.getHouseId());
Stock stock = stockService.getOne(queryWrapper);
UpdateWrapper<Stock> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("goods_id",stock.getGoodsId());
updateWrapper.eq("house_id",stock.getHouseId());
System.out.println("stock = " + stock);
if(stock.getNumber()-outputFormVo.getChangeNumber() < stock.getUnderAlert()){
return ResultObj.ADD_ERROR_UNDER;
} else if(outputFormVo.getChangeNumber() ==0){
return ResultObj.ERROR_ZERO;
} else {
stock.setNumber(stock.getNumber()-outputFormVo.getChangeNumber());
}
outputFormService.save(outputFormVo);
stockService.update(stock,updateWrapper);
return ResultObj.ADD_SUCCESS;
}
catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}
@RequestMapping("deleteOutput")
public ResultObj deleteInput(Integer id){
try {
outputFormService.removeById(id);
return ResultObj.DELETE_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
}
源码获取:俺的博客首页 "资源" 里下载!