idea+springboot+jpa+maven+jquery+mysql进销存管理系统

  • 一、系统介绍
  • 1.环境配置
  • 二、系统展示
  • 1. 管理员登录
  • 2.首页
  • 3.采购订单
  • 4.收货入库
  • 5. 采购退货
  • 6. 商品入库
  • 7. 商品出库
  • 8. 库存查询
  • 9.商品移库
  • 10.库存盘点
  • 11.销售订单
  • 12.发货出库
  • 13.销售退货
  • 14.商品查询
  • 15. 供应商查询
  • 16.客户查询
  • 17.销售查询
  • 18.销售统计
  • 19.商品资料
  • 20.供应商资料
  • 21.客户资料
  • 22.用户管理
  • 三、部分代码
  • CustomerRepository.java
  • SaleController.java
  • Customer.java
  • 四、其他
  • 获取源码



一、系统介绍

本系统实现了进销存管理系统,管理端实现了管理员登录、首页、采购订单、收货入库、采购退货、商品入库、商品出库、库存查询、商品移库、库存盘点、销售订单、发货出库、销售退货、商品查询、供应商查询、客户查询、销售查询、销售统计、商品资料、供应商资料、客户资料、用户管理

1.环境配置

JDK版本:1.8
Mysql:5.7

二、系统展示

1. 管理员登录

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_java

登录用户名密码:admin 123456

2.首页

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_maven_02

3.采购订单

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_java_03

4.收货入库

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_maven_04

5. 采购退货

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_intellij-idea_05

6. 商品入库

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_intellij-idea_06

7. 商品出库

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_maven_07

8. 库存查询

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_intellij-idea_08

9.商品移库

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_intellij-idea_09

10.库存盘点

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_intellij-idea_10

11.销售订单

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_spring_11

12.发货出库

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_java_12

13.销售退货

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_java_13

14.商品查询

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_spring_14

15. 供应商查询

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_spring boot_15

16.客户查询

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_maven_16

17.销售查询

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_java_17

18.销售统计

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_spring_18

19.商品资料

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_spring_19

20.供应商资料

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_maven_20

21.客户资料

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_spring boot_21

22.用户管理

idea+springboot+jpa+maven+jquery+mysql进销存管理系统源码_maven_22

三、部分代码

CustomerRepository.java

package com.xu.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.xu.bean.Customer;


public interface CustomerRepository extends JpaRepository<Customer,Long>{

	@Query("from Customer where customer_name = ?1")
	public Customer findCustomerByName(String name);

}

SaleController.java

package com.xu.web;

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

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;
import com.xu.bean.SaleItem;
import com.xu.bean.SaleOrder;
import com.xu.exception.ServiceException;
import com.xu.service.SaleService;
import com.xu.service.StockService;

@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);
			model.addAttribute("saleorderList", saleorderList);
			model.addAttribute("cunt", cunt);
		} catch (ServiceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "sale";
	}
	
	
	/**
	 * 此方法用于跳转到发货页面
	 * @return
	 */
	@RequestMapping(value="/gotooutsale")
	public String turns(Model model){
		try {
			saleorderList = saleService.findSaleOrderByPage(0);
			cunt = saleService.findSaleOrderCount();
			crrentPage = 1L;
			ttalPage = saleService.getTotalPage();
			model.addAttribute("crrentPage", crrentPage);
			model.addAttribute("ttalPage", ttalPage);
			model.addAttribute("saleorderList", saleorderList);
			model.addAttribute("cunt", cunt);
		} catch (ServiceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "out-salestock";
	}
	
	/**
	 * 此方法用于发货功能
	 * @param request
	 * @param model
	 * @return
	 */
	@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
	 */
	@RequestMapping("/forwordOrder")
	public String forwords(){		
		return "saleOrder";
	}
	
	/**
	 * 添加销售订单
	 * @param request
	 * @param model
	 * @return
	 */
    @RequestMapping("/addSaleOrder")
    public String saveSaleOrder(HttpServletRequest request,Model model){
    	String pay = request.getParameter("pay");
    	SaleOrder saleOrder = new SaleOrder();
    	saleOrder.setFlag("未发货");
    	saleOrder.setPay(pay);
    	saleOrder.setSaleDate(new Date());
    	try {
			int i = saleService.addSaleOrder(saleOrder,itemList);
			if(i==1){
				itemList.clear();
				saleorderList = saleService.findSaleOrderByPage(0);
				cunt = saleService.findSaleOrderCount();
				crrentPage = 1L;
				ttalPage = saleService.getTotalPage();
				model.addAttribute("crrentPage", crrentPage);
				model.addAttribute("ttalPage", ttalPage);
				model.addAttribute("saleorderList", saleorderList);
				model.addAttribute("cunt", cunt);
			}
		} catch (ServiceException e) {
			e.printStackTrace();
		}
		return "sale";
    }
	/**
	 * 分页功能中 首页 尾页
	 * @param request
	 * @param model
	 * @return
	 */
	@RequestMapping("/multipage")
	public String getPurchase(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 "sale";
		
	}
	
	/**
	 * 分页功能中上一页
	 * @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){
				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 "sale";
		
	}
	
	/**
	 * 分页功能中下一页
	 * @param request
	 * @param model
	 * @return
	 */
	@RequestMapping("/multipageUp")
	public String getPurchaseUp(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 "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 {
			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
	 */
	@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";
		
	}
}

Customer.java

package com.xu.bean;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 
 *   顾客
 *id:
 *name:顾客名字
 *address:地址
 *zip:邮编
 *telPhone:电话
 *linkMan:联系人
 *linkTel:联系人电话
 *bank:开户银行
 *bankAccount:银行账号
 *email:邮箱
 */
@Entity
@Table(name="customer")
public class Customer {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="customer_id")
	private Long id;
	@Column(name="customer_name")
	private String name;
	private String address;
	private String zip;
	private String telPhone;
	private String linkMan;
	private String linkTel;
	private String bank;
	private Long  bankAccount;
	private String email;
/*	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY,targetEntity=SaleOrder.class)
	private Set<SaleOrder> set;
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY,targetEntity=SaleReturnOrder.class)
	private Set<SaleReturnOrder> returnOrder;
*/	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getZip() {
		return zip;
	}
	public void setZip(String zip) {
		this.zip = zip;
	}
	public String getTelPhone() {
		return telPhone;
	}
	public void setTelPhone(String telPhone) {
		this.telPhone = telPhone;
	}
	public String getLinkMan() {
		return linkMan;
	}
	public void setLinkMan(String linkMan) {
		this.linkMan = linkMan;
	}
	public String getLinkTel() {
		return linkTel;
	}
	public void setLinkTel(String linkTel) {
		this.linkTel = linkTel;
	}
	public String getBank() {
		return bank;
	}
	public void setBank(String bank) {
		this.bank = bank;
	}
	public Long getBankAccount() {
		return bankAccount;
	}
	public void setBankAccount(Long bankAccount) {
		this.bankAccount = bankAccount;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	/*public Set<SaleOrder> getSet() {
		return set;
	}
	public void setSet(Set<SaleOrder> set) {
		this.set = set;
	}*/
	
	
}