源码获取:俺的博客首页 "资源" 里下载!
项目介绍
本项目分为超级管理员、总经理、店长、员工等角色,超级管理员可添加修改删除角色并进行角色菜单配置;
超级管理员角色包含以下功能:
商品管理:添加商品、库存查询、订单管理、商品删除查询;
销售管理:退货管理、销售统计;
基础资料管理:供应商管理、用户管理、角色管理
总经理角色包含以下功能:
商品管理:订单管理、商品删除查询;
销售管理:退货管理、销售统计;
基础资料管理:供应商管理;
店长角色包含以下功能:
商品管理:添加商品、库存查询、订单管理、商品删除查询;
销售管理:退货管理、销售统计;
员工角色包含以下功能:
商品管理:添加商品、库存查询;
环境需要
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项目: 是;
6.数据库:MySql 5.7等版本均可;
技术栈
1. 后端:Spring、Springmvc、Mybatis
2. 前端:JSP+css+javascript+jQuery+LayUI
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中applicationContext.xml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/ 登录
管理员账号/密码:admin/admin
总经理账号/密码:hqh/123
供应商管理控制层:
@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 = "/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 = "/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);
}
}
源码获取:俺的博客首页 "资源" 里下载!