基于javaweb+mysql的springboot进销存管理系统(java+springboot+jpa+maven+jquery+mysql+jsp)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot进销存管理系统(java+springboot+jpa+maven+jquery+mysql+jsp)
项目介绍
本系统基本完成了一个基于spring boot + JPA的进销存管理系统,包括manager管理员与employee雇员两种角色。 主要实现采购管理、库存管理、销售管理、查询统计、资料管理和系统管理功能。 本系统的实现使用了很多计算机技术,包括Java语言、Spring boot框架、 JPA持久层框架和MySQL数据库。带文档
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 4.数据库:MySql 5.7版本; 5.是否Maven项目:是;
技术栈
springboot+jpa+mysql+maven+jquery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,项目运行成功后在浏览器中访问: 管理员登录地址:http://localhost:8080/ manager管理员账号密码:admin/123456 employee雇员账号密码:test/123456
model.addAttribute("saleorderList", saleorderList);
return "out-salestock";
}
/**
* 分页功能中下一页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipageUp1")
public String getPurchaseUp1(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum<=(ttalPage-1)){
saleorderList = saleService.findSaleOrderByPage((int)(pageNum-0));
crrentPage = pageNum+1;
}else if(pageNum == ttalPage){
saleorderList = saleService.findSaleOrderByPage((int)(pageNum-1));
crrentPage = pageNum;
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.addAttribute("currentPage", crrentPage);
model.addAttribute("saleorderList", saleorderList);
return "out-salestock";
}
}
* 跳转到客户资料首页
* @param model
* @return
*/
@RequestMapping("/gotoCustomer")
public String forwordCustomer(Model model){
try {
customerList = suppliersAndCustomerService.findCustomerByPage(0);
couns = suppliersAndCustomerService.findCustomerCount();
curtPage = 1L;
totaPage = suppliersAndCustomerService.getCustomerTotalPage();
model.addAttribute("couns", couns);
model.addAttribute("curtPage", curtPage);
model.addAttribute("totaPage", totaPage);
model.addAttribute("goodsList", customerList);
} catch (ServiceException e) {
e.printStackTrace();
}
return "customer-list";
}
/**
* 添加客户
* @param request
* @param model
* @return
*/
@RequestMapping("/customeradd")
public String customerAdd(HttpServletRequest request,Model model){
String name = request.getParameter("name");
String address = request.getParameter("address");
String zip = request.getParameter("zip");
String telPhone = request.getParameter("telPhone");
String linkMan = request.getParameter("linkMan");
String linkTel = request.getParameter("linkTel");
String bank = request.getParameter("bank");
String bankAccount = request.getParameter("bankAccount");
String email = request.getParameter("email");
customer = new Customer();
customer.setName(name);
customer.setAddress(address);
customer.setZip(zip);
customer.setTelPhone(telPhone);
customer.setLinkMan(linkMan);
customer.setLinkTel(linkTel);
customer.setBank(bank);
customer.setBankAccount(bankAccount);
customer.setEmail(email);
try {
suppliersAndCustomerService.saveCustomer(customer);
@Controller
@RequestMapping("/query")
@SessionAttributes(value={"goods","name","count","map"})
public class QueryController {
@Resource
private QueryService queryService;
/**
* 跳转到商品查询首页
* @return
*/
@RequestMapping("/goodes")
public String gotoQueryGoods(){
return "queryGoods";
}
/**
* 跳转到客户查询首页
* @return
*/
@RequestMapping("/customers")
public String gotoQueryCustomer(){
return "queryCustomer";
}
/**
* 跳转到供应商查询首页
* @return
*/
@RequestMapping("/multipageUp")
public String getPurchaseUp(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum<=(totaPage-1)){
goodsList = systemService.findGoodsByPage((int)(pageNum-0));
curtPage = pageNum+1;
}else if(pageNum == totaPage){
goodsList = systemService.findGoodsByPage((int)(pageNum-1));
curtPage = pageNum;
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.addAttribute("curtPage", curtPage);
model.addAttribute("goodsList", goodsList);
return "allGoods";
}
/**
* suppliers分页功能中 首页 尾页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipage1")
public String getPurchase1(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
suppliersList = suppliersAndCustomerService.findSuppliersByPage((int)(pageNum-1));
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
curtPage = pageNum;
model.addAttribute("curtPage", curtPage);
model.addAttribute("goodsList", suppliersList);
return "suppliers-list";
}
session.setAttribute("mess", "信息成功失败,请重新输入");
return "information";
}
}
/**
* 分页功能中 首页 尾页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipage")
public String getPurchase(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
messageList = managerService.findMessageByPage((int)(pageNum-1));
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
crrentPage = pageNum;
model.addAttribute("currentPage", crrentPage);
model.addAttribute("messageList", messageList);
return "message";
}
/**
* 分页功能中上一页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipageDown")
public String getPurchaseDown(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum>1){
messageList = managerService.findMessageByPage((int)(pageNum-2));
crrentPage = pageNum-1;
}else if(pageNum == 1){
messageList = managerService.findMessageByPage((int)(pageNum-1));
crrentPage = pageNum;
@RequestMapping("/outstock")
public String outStock(HttpServletRequest request,Model model){
logger.info("销售订单发货");
Long orderId = Long.parseLong(request.getParameter("orderId"));
try {
String flag = saleService.findFlagByOrderId(orderId);
if("未发货".equals(flag)){
List<SaleItem> saleItemList = saleService.findSaleOrderByOrderId(orderId);
for(SaleItem item:saleItemList){
stockService.updateStockCount(item.getName(),item.getCount());
}
saleService.updateFlagByOrderId("已发货",orderId);
saleorderList = saleService.findSaleOrderByPage(0);
model.addAttribute("saleorderList", saleorderList);
logger.info("销售订单发货成功");
}
} catch (ServiceException e) {
}
return "out-salestock";
}
/**
* 此方法用于添加销售商品
* @param request
* @param model
* @return
*/
@RequestMapping("/add")
public String addSaleItem(HttpServletRequest request,Model model){
Long customerId = Long.parseLong(request.getParameter("customerId"));
String name = request.getParameter("name");
Double price = Double.parseDouble(request.getParameter("price"));
Long count =Long.parseLong(request.getParameter("count"));
SaleItem saleItem = new SaleItem();
saleItem.setCount(count);
saleItem.setName(name);
saleItem.setPrice(price);
saleItem.setCustomerId(customerId);
itemList.add(saleItem);
model.addAttribute("itemList",itemList);
return "sale";
}
/**
* 此方法用于跳转到添加销售订单页面
* @return
String bank = request.getParameter("bank");
Long bankAccount = Long.parseLong(request.getParameter("bankAccount"));
String email = request.getParameter("email");
suppliers = new Suppliers();
suppliers.setName(name);
suppliers.setAddress(address);
suppliers.setZip(zip);
suppliers.setTelPhone(telPhone);
suppliers.setLinkMan(linkMan);
suppliers.setLinkTel(linkTel);
suppliers.setBank(bank);
suppliers.setBankAccount(bankAccount);
suppliers.setEmail(email);
try {
suppliersAndCustomerService.saveSuppliers(suppliers);
} catch (ServiceException e) {
e.printStackTrace();
}
try {
suppliersList = suppliersAndCustomerService.findSuppliersByPage(0);
couns = suppliersAndCustomerService.findSuppliersCount();
curtPage = 1L;
totaPage = suppliersAndCustomerService.getTotalPage();
model.addAttribute("couns", couns);
model.addAttribute("curtPage", curtPage);
model.addAttribute("totaPage", totaPage);
model.addAttribute("goodsList", suppliersList);
} catch (ServiceException e) {
e.printStackTrace();
}
return "suppliers-list";
}
/**
* 删除供应商
* @param request
* @param model
* @return
*/
@RequestMapping("/delSuppliers")
public String delSuppliers(HttpServletRequest request,Model model){
Long id = Long.parseLong(request.getParameter("orderId"));
try {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.addAttribute("currentPage", currentPage);
model.addAttribute("orderList", orderList);
return "article-list";
}
/**
* 分页功能中下一页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipageUp")
public String getPurchaseUp(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum<=(totalPage-1)){
orderList = managerService.findPurchaseOrderByPage((int)(pageNum-0));
currentPage = pageNum+1;
}else if(pageNum == totalPage){
orderList = managerService.findPurchaseOrderByPage((int)(pageNum-1));
currentPage = pageNum;
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.addAttribute("currentPage", currentPage);
model.addAttribute("orderList", orderList);
return "article-list";
}
/**
* 分页功能中 首页 尾页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipage1")
public String getPurchase1(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
orderList = managerService.findPurchaseOrderByPage((int)(pageNum-1));
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
* @param model
* @return
*/
@RequestMapping("/multipageDown2")
public String getPurchaseDown2(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum>1){
customerList = suppliersAndCustomerService.findCustomerByPage((int)(pageNum-2));
curtPage = pageNum-1;
}else if(pageNum == 1){
customerList = suppliersAndCustomerService.findCustomerByPage((int)(pageNum-1));
curtPage = pageNum;
}
} catch (ServiceException e) {
e.printStackTrace();
}
model.addAttribute("curtPage", curtPage);
model.addAttribute("goodsList", customerList);
return "customer-list";
}
/**
* customer分页功能中下一页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipageUp2")
public String getPurchaseUp2(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum<=(totaPage-1)){
customerList = suppliersAndCustomerService.findCustomerByPage((int)(pageNum-0));
curtPage = pageNum+1;
}else if(pageNum == totaPage){
customerList = suppliersAndCustomerService.findCustomerByPage((int)(pageNum-1));
curtPage = pageNum;
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
return "employee-list";
}
}
/**
* goods分页功能中 首页 尾页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipage")
public String getPurchase(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
goodsList = systemService.findGoodsByPage((int)(pageNum-1));
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
curtPage = pageNum;
model.addAttribute("curtPage", curtPage);
model.addAttribute("goodsList", goodsList);
return "allGoods";
}
/**
* goods分页功能中上一页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipageDown")
public String getPurchaseDown(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum>1){
goodsList = systemService.findGoodsByPage((int)(pageNum-2));
curtPage = pageNum-1;
}else if(pageNum == 1){
goodsList = systemService.findGoodsByPage((int)(pageNum-1));
curtPage = pageNum;
}
} catch (ServiceException e) {
e.printStackTrace();
}
}
}
@Controller
@RequestMapping("/sale")
@SessionAttributes(value={"cunt","crrentPage","ttalPage","saleorderList","itemList"})
public class SaleController {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private List<SaleItem> itemList = new ArrayList<SaleItem>();
private List<SaleOrder> saleorderList = new ArrayList<SaleOrder>();
private Long cunt;
private Long crrentPage;
private Long ttalPage;
@Resource
private SaleService saleService;
@Resource
private StockService stockService;
/**
* 此方法用于跳转到销售订单页面
* @return
*/
@RequestMapping(value="/gotosale")
public String turn(Model model){
try {
saleorderList = saleService.findSaleOrderByPage(0);
cunt = saleService.findSaleOrderCount();
crrentPage = 1L;
ttalPage = saleService.getTotalPage();
model.addAttribute("crrentPage", crrentPage);
model.addAttribute("ttalPage", ttalPage);
saleorderList = saleService.findSaleOrderByPage((int)(pageNum-1));
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
crrentPage = pageNum;
model.addAttribute("currentPage", crrentPage);
model.addAttribute("saleorderList", saleorderList);
return "out-salestock";
}
/**
* 分页功能中上一页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipageDown1")
public String getPurchaseDown1(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum>1){
saleorderList = saleService.findSaleOrderByPage((int)(pageNum-2));
crrentPage = pageNum-1;
}else if(pageNum == 1){
saleorderList = saleService.findSaleOrderByPage((int)(pageNum-1));
crrentPage = pageNum;
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.addAttribute("currentPage", crrentPage);
model.addAttribute("saleorderList", saleorderList);
return "out-salestock";
}
/**
* 分页功能中下一页
* @param request
* @param model
* @return
*/
goods.setApproveId(approveId);
goods.setBatchId(batchId);
goods.setSpace(space);
goods.setSupplierId(supplierId);
goods.setUnit(unit);
goods.setPrice(price);
try {
stockService.saveGoods(goods);
} catch (ServiceException e) {
e.printStackTrace();
}
purchaseItem = new PurchaseItem();
purchaseItem.setCount(count);
purchaseItem.setPrice(price);
purchaseItem.setName(name);
purchaseItem.setSupplierId(suppliersId);
list.add(purchaseItem);
model.addAttribute("list", list);
logger.info("成功添加商品");
return "article-list";
}
/**
* 此方法用于跳转到入库首页
* @param model
* @return
*/
@RequestMapping("/forwordAddStock")
public String fowordAddStock(Model model){
try {
orderList = managerService.findPurchaseOrderByPage(0);
count = managerService.findPurchaseOrderCount();
currentPage = 1L;
totalPage = managerService.getTotalPage();
model.addAttribute("currentPage", currentPage);
model.addAttribute("totalPage", totalPage);
model.addAttribute("orderList", orderList);
model.addAttribute("count", count);
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "add-stock";
}
/**
*
* @param request
* @param model
* @return
*/
@RequestMapping("/addstock")
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum<=(ttalPage-1)){
saleorderList = saleService.findSaleOrderByPage((int)(pageNum-0));
crrentPage = pageNum+1;
}else if(pageNum == ttalPage){
saleorderList = saleService.findSaleOrderByPage((int)(pageNum-1));
crrentPage = pageNum;
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.addAttribute("currentPage", crrentPage);
model.addAttribute("saleorderList", saleorderList);
return "sale";
}
/**
* 分页功能中 首页 尾页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipage1")
public String getPurchase1(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
saleorderList = saleService.findSaleOrderByPage((int)(pageNum-1));
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
crrentPage = pageNum;
model.addAttribute("currentPage", crrentPage);
model.addAttribute("saleorderList", saleorderList);
return "out-salestock";
}
/**
* 分页功能中上一页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipageDown1")
public String getPurchaseDown1(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
return "out-salestock";
}
}
@Controller
@RequestMapping("/log")
@SessionAttributes(value={"messageList","message","cunt","crrentPage","ttalPage"})
public class LoginAndLogOutController {
@Resource
private ManagerService managerService;
private Long cunt;
private Long crrentPage;
private Long ttalPage;
private List<Message> messageList = new ArrayList<Message>();
@RequestMapping("/in")
public String forwordIn(){
return "login";
}
@RequestMapping("/checkMessage")
public String seeMessage(HttpServletRequest request,Model model){
Long id = Long.parseLong(request.getParameter("id"));
try {
Message message = managerService.findMessageById(id);
managerService.updateEmployeeById(id);
@RequestMapping("/multipage1")
public String getPurchase1(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
outList = stockService.findStockByPage((int)(pageNum-1));
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
curPage = pageNum;
model.addAttribute("curPage", curPage);
model.addAttribute("outList", outList);
return "stock";
}
/**
* 分页功能中上一页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipageDown1")
public String getPurchaseDown1(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum>1){
outList = stockService.findStockByPage((int)(pageNum-2));
curPage = pageNum-1;
}else if(pageNum == 1){
outList = stockService.findStockByPage((int)(pageNum-1));
curPage = pageNum;
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.addAttribute("curPage", curPage);
model.addAttribute("outList", outList);
return "stock";
}
/**
* 分页功能中下一页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipageUp1")
logger.info("提交采购订单成功");
}
} catch (ServiceException e) {
e.printStackTrace();
}
return "article-list";
}
/**
* 分页功能中 首页 尾页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipage")
public String getPurchase(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
orderList = managerService.findPurchaseOrderByPage((int)(pageNum-1));
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
currentPage = pageNum;
model.addAttribute("currentPage", currentPage);
model.addAttribute("orderList", orderList);
return "article-list";
}
/**
* 分页功能中上一页
* @param request
* @param model
* @return
*/
@RequestMapping("/multipageDown")
public String getPurchaseDown(HttpServletRequest request,Model model){
Long pageNum =Long.parseLong(request.getParameter("curPage"));
try {
if(pageNum>1){
orderList = managerService.findPurchaseOrderByPage((int)(pageNum-2));
currentPage = pageNum-1;
}else if(pageNum == 1){
orderList = managerService.findPurchaseOrderByPage((int)(pageNum-1));
currentPage = pageNum;
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} ![请添加图片描述](https://img-blog.csdnimg.cn/05baf0411811415a91c378fb1ec48dc4.jpeg)
model.addAttribute("currentPage", currentPage);
model.addAttribute("orderList", orderList);