基于springboot實(shí)現(xiàn)功能超全企業(yè)進(jìn)銷存系統(tǒng)
?作者主頁:
?
簡介:20年開發(fā)經(jīng)驗(yàn)、Java領(lǐng)域優(yōu)質(zhì)創(chuàng)作者、CSDN博客專家? Java項(xiàng)目、簡歷模板、學(xué)習(xí)資料、面試題庫、技術(shù)互助
文末獲取源碼
????
項(xiàng)目編號:BS-XX-099
后臺開發(fā):Springboot+mybatis+springmvc
前臺開發(fā):bootstrap+easyui+jquery+highcharts
數(shù)據(jù)庫:MYSQL
開發(fā)工具:IDEA / ECLIPSE
應(yīng)用服務(wù)器:TOMCAT8.5
本系統(tǒng)基于springboot實(shí)現(xiàn)了一個(gè)功能十分完整的企業(yè)進(jìn)銷存系統(tǒng),主要功能包括:用戶的登錄注冊、客戶信息增添改查、來往客戶信息查詢等、商品的進(jìn)貨和銷售、采購訂單明細(xì)、銷售訂單明細(xì)、庫存盤點(diǎn)、商品查詢及分類、商品價(jià)格調(diào)整、進(jìn)銷存報(bào)表、商品庫存預(yù)警、系統(tǒng)退出、角色管理、用戶管理、權(quán)限分配、數(shù)據(jù)統(tǒng)計(jì)圖形報(bào)表、等等,功能可以說是十分完整,整個(gè)系統(tǒng)設(shè)計(jì)簡潔大方,運(yùn)行無誤。
下面展示一下系統(tǒng)的主要功能:
登陸頁面:

管理主頁面

系統(tǒng)管理-角色管理

系統(tǒng)管理-用戶管理

基礎(chǔ)資料-供應(yīng)商管理

基礎(chǔ)資料-客戶管理

基礎(chǔ)資料-商品分類和商品管理

基礎(chǔ)資料-期初庫存管理

統(tǒng)計(jì)報(bào)表—供應(yīng)商統(tǒng)計(jì)

統(tǒng)計(jì)報(bào)表—按日統(tǒng)計(jì)

庫存管理-商品報(bào)損

庫存管理-庫存報(bào)警

銷售管理—銷售出貨

銷售管理—銷售單據(jù)查詢

進(jìn)貨管理—進(jìn)貨入庫

進(jìn)貨管理—進(jìn)貨單據(jù)查詢

進(jìn)貨管理—退貨出庫

篇幅所限,只展示部分功能,整體來說,此系統(tǒng)還是十分優(yōu)秀,包含了進(jìn)銷存常見所有的功能需求。
部分核心實(shí)現(xiàn)代碼:
package com.jude.controller.admin;import com.jude.service.LogService;import com.jude.entity.Customer;import com.jude.entity.Log;import com.jude.service.CustomerService;import org.apache.shiro.authz.annotation.Logical;import org.apache.shiro.authz.annotation.RequiresPermissions;import org.springframework.data.domain.Sort.Direction;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.ResponseBody;import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;import java.util.HashMap;import java.util.List;import java.util.Map;/**
* 后臺管理客戶Controller
* @author znz
*
*/public class CustomerAdminController {
private CustomerService customerService;
private LogService logService;
/**
* 分頁查詢客戶信息
* @param customer
* @param page
* @param rows
* @return
* @throws Exception
*/
public Map<String,Object> list(Customer customer, Integer page, Integer rows)throws Exception{
List<Customer> customerList=customerService.list(customer, page, rows, Direction.ASC, "id");
Long total=customerService.getCount(customer);
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("rows", customerList);
resultMap.put("total", total);
logService.save(new Log(Log.SEARCH_ACTION,"查詢客戶信息")); // 寫入日志
return resultMap;
}
/**
* 下拉框模糊查詢
* @param q
* @return
* @throws Exception
*/
public List<Customer> comboList(String q)throws Exception{ if(q==null){
q="";
} return customerService.findByName("%"+q+"%");
}
/**
* 添加或者修改客戶信息
* @param customer
* @return
* @throws Exception
*/
public Map<String,Object> save(Customer customer)throws Exception{ if(customer.getId()!=null){ // 寫入日志
logService.save(new Log(Log.UPDATE_ACTION,"更新客戶信息"+customer));
}else{
logService.save(new Log(Log.ADD_ACTION,"添加客戶信息"+customer));
}
Map<String, Object> resultMap = new HashMap<>();
customerService.save(customer);
resultMap.put("success", true); return resultMap;
}
/**
* 刪除客戶信息
* @param id
* @param response
* @return
* @throws Exception
*/
public Map<String,Object> delete(String ids)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
String []idsStr=ids.split(","); for(int i=0;i<idsStr.length;i++){ int id=Integer.parseInt(idsStr[i]);
logService.save(new Log(Log.DELETE_ACTION,"刪除客戶信息"+customerService.findById(id))); ?// 寫入日志
customerService.delete(id);
}
resultMap.put("success", true); return resultMap;
}
}
package com.jude.controller.admin;import com.google.gson.Gson;import com.google.gson.reflect.TypeToken;import com.jude.service.CustomerReturnListGoodsService;import com.jude.service.CustomerReturnListService;import com.jude.service.LogService;import com.jude.util.DateUtil;import com.jude.util.StringUtil;import com.jude.entity.CustomerReturnList;import com.jude.entity.CustomerReturnListGoods;import com.jude.entity.Log;import com.jude.service.UserService;import org.apache.shiro.SecurityUtils;import org.apache.shiro.authz.annotation.RequiresPermissions;import org.springframework.beans.propertyeditors.CustomDateEditor;import org.springframework.data.domain.Sort.Direction;import org.springframework.web.bind.WebDataBinder;import org.springframework.web.bind.annotation.InitBinder;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;import java.text.SimpleDateFormat;import java.util.Date;import java.util.HashMap;import java.util.List;import java.util.Map;/**
* 客戶退貨單Controller類
* @author Administrator
*
*/public class CustomerReturnListAdminController {
private CustomerReturnListService customerReturnListService;
private CustomerReturnListGoodsService customerReturnListGoodsService;
private LogService logService;
private UserService userService;
public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(true);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); ? //true:允許輸入空值,false:不能為空值
}
/**
* 根據(jù)條件分頁查詢客戶退貨單信息
* @param customerReturnList
* @param page
* @param rows
* @return
* @throws Exception
*/
public Map<String,Object> list(CustomerReturnList customerReturnList)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
List<CustomerReturnList> customerReturnListList=customerReturnListService.list(customerReturnList, Direction.DESC, "customerReturnDate");
resultMap.put("rows", customerReturnListList); return resultMap;
}
/**
* 根據(jù)客戶退貨單id查詢所有客戶退貨單商品
* @param customerReturnListId
* @return
* @throws Exception
*/
public Map<String,Object> listGoods(Integer customerReturnListId)throws Exception{ if(customerReturnListId==null){ return null;
}
Map<String, Object> resultMap = new HashMap<>();
List<CustomerReturnListGoods> customerReturnListGoodsList=customerReturnListGoodsService.listByCustomerReturnListId(customerReturnListId);
resultMap.put("rows", customerReturnListGoodsList); return resultMap;
}
/**
* 客戶統(tǒng)計(jì) 獲取客戶退貨單的所有商品信息
* @param purchaseList
* @param purchaseListGoods
* @return
* @throws Exception
*/
public Map<String,Object> listCount(CustomerReturnList customerReturnList,CustomerReturnListGoods customerReturnListGoods)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
List<CustomerReturnList> customerReturnListList=customerReturnListService.list(customerReturnList, Direction.DESC, "customerReturnDate"); for(CustomerReturnList crl:customerReturnListList){
customerReturnListGoods.setCustomerReturnList(crl);
List<CustomerReturnListGoods> crlList=customerReturnListGoodsService.list(customerReturnListGoods); for(CustomerReturnListGoods crlg:crlList){
crlg.setCustomerReturnList(null);
}
crl.setCustomerReturnListGoodsList(crlList);
}
resultMap.put("rows", customerReturnListList); return resultMap;
}
/**
* 獲取客戶退貨單號
* @param type
* @return
* @throws Exception
*/
public String genBillCode(String type)throws Exception{
StringBuffer biilCodeStr=new StringBuffer();
biilCodeStr.append("XT");
biilCodeStr.append(DateUtil.getCurrentDateStr()); // 拼接當(dāng)前日期
String customerReturnNumber=customerReturnListService.getTodayMaxCustomerReturnNumber(); // 獲取當(dāng)天最大的客戶退貨單號
if(customerReturnNumber!=null){
biilCodeStr.append(StringUtil.formatCode(customerReturnNumber));
}else{
biilCodeStr.append("0001");
} return biilCodeStr.toString();
}
/**
* 添加客戶退貨單 以及所有客戶退貨單商品
* @param customerReturnList
* @param goodsJson
* @return
* @throws Exception
*/
public Map<String,Object> save(CustomerReturnList customerReturnList,String goodsJson)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
customerReturnList.setUser(userService.findByUserName((String) SecurityUtils.getSubject().getPrincipal())); // 設(shè)置操作用戶
Gson gson = new Gson();
List<CustomerReturnListGoods> plgList=gson.fromJson(goodsJson, new TypeToken<List<CustomerReturnListGoods>>(){}.getType());
customerReturnListService.save(customerReturnList, plgList);
logService.save(new Log(Log.ADD_ACTION,"添加客戶退貨單"));
resultMap.put("success", true);
return resultMap;
}
/**
* 修改退貨單的支付狀態(tài)
* @param id
* @return
* @throws Exception
*/
public Map<String,Object> update(Integer id)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
CustomerReturnList customerReturnList=customerReturnListService.findById(id);
customerReturnList.setState(1); // 修改成支付狀態(tài)
customerReturnListService.update(customerReturnList);
resultMap.put("success", true);
return resultMap;
}
/**
* 根據(jù)id刪除客戶退貨單信息 包括客戶退貨單里的商品
* @param id
* @return
* @throws Exception
*/
public Map<String,Object> delete(Integer id)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
customerReturnListService.delete(id);
logService.save(new Log(Log.DELETE_ACTION,"刪除客戶退貨單信息"+customerReturnListService.findById(id))); ?// 寫入日志
resultMap.put("success", true);
return resultMap;
}
}
package com.jude.controller.admin;import com.google.gson.Gson;import com.google.gson.reflect.TypeToken;import com.jude.entity.PurchaseListGoods;import com.jude.service.LogService;import com.jude.util.StringUtil;import com.jude.entity.Log;import com.jude.entity.PurchaseList;import com.jude.service.PurchaseListGoodsService;import com.jude.service.PurchaseListService;import com.jude.service.UserService;import com.jude.util.DateUtil;import org.apache.shiro.SecurityUtils;import org.apache.shiro.authz.annotation.RequiresPermissions;import org.springframework.beans.propertyeditors.CustomDateEditor;import org.springframework.data.domain.Sort.Direction;import org.springframework.web.bind.WebDataBinder;import org.springframework.web.bind.annotation.InitBinder;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;import java.text.SimpleDateFormat;import java.util.Date;import java.util.HashMap;import java.util.List;import java.util.Map;/**
* 進(jìn)貨單Controller類
* @author Administrator
*
*/public class PurchaseListAdminController {
private PurchaseListService purchaseListService;
private PurchaseListGoodsService purchaseListGoodsService;
private LogService logService;
private UserService userService;
public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(true);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); ? //true:允許輸入空值,false:不能為空值
} ?
/**
* 根據(jù)條件分頁查詢進(jìn)貨單信息
* @param purchaseList
* @param page
* @param rows
* @return
* @throws Exception
*/
public Map<String,Object> list(PurchaseList purchaseList)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
List<PurchaseList> purchaseListList=purchaseListService.list(purchaseList, Direction.DESC, "purchaseDate");
resultMap.put("rows", purchaseListList); return resultMap;
}
/**
* 根據(jù)進(jìn)貨單id查詢所有進(jìn)貨單商品
* @param purchaseListId
* @return
* @throws Exception
*/
public Map<String,Object> listGoods(Integer purchaseListId)throws Exception{ if(purchaseListId==null){ return null;
}
Map<String, Object> resultMap = new HashMap<>();
List<PurchaseListGoods> purchaseListGoodsList=purchaseListGoodsService.listByPurchaseListId(purchaseListId);
resultMap.put("rows", purchaseListGoodsList); return resultMap;
}
/**
* 客戶統(tǒng)計(jì) 獲取進(jìn)貨單的所有商品信息
* @param purchaseList
* @param purchaseListGoods
* @return
* @throws Exception
*/
public Map<String,Object> listCount(PurchaseList purchaseList,PurchaseListGoods purchaseListGoods)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
List<PurchaseList> purchaseListList=purchaseListService.list(purchaseList, Direction.DESC, "purchaseDate"); for(PurchaseList pl:purchaseListList){
purchaseListGoods.setPurchaseList(pl);
List<PurchaseListGoods> plgList=purchaseListGoodsService.list(purchaseListGoods); for(PurchaseListGoods plg:plgList){
plg.setPurchaseList(null);
}
pl.setPurchaseListGoodsList(plgList);
}
resultMap.put("rows", purchaseListList); return resultMap;
}
/**
* 獲取進(jìn)貨單號
* @param type
* @return
* @throws Exception
*/
public String genBillCode(String type)throws Exception{
StringBuffer biilCodeStr=new StringBuffer();
biilCodeStr.append("JH");
biilCodeStr.append(DateUtil.getCurrentDateStr()); // 拼接當(dāng)前日期
String purchaseNumber=purchaseListService.getTodayMaxPurchaseNumber(); // 獲取當(dāng)天最大的進(jìn)貨單號
if(purchaseNumber!=null){
biilCodeStr.append(StringUtil.formatCode(purchaseNumber));
}else{
biilCodeStr.append("0001");
} return biilCodeStr.toString();
}
/**
* 添加進(jìn)貨單 以及所有進(jìn)貨單商品 以及 修改商品的成本均價(jià)
* @param purchaseList
* @param goodsJson
* @return
* @throws Exception
*/
public Map<String,Object> save(PurchaseList purchaseList,String goodsJson)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
purchaseList.setUser(userService.findByUserName((String) SecurityUtils.getSubject().getPrincipal())); // 設(shè)置操作用戶
Gson gson = new Gson();
List<PurchaseListGoods> plgList=gson.fromJson(goodsJson, new TypeToken<List<PurchaseListGoods>>(){}.getType());
purchaseListService.save(purchaseList, plgList);
logService.save(new Log(Log.ADD_ACTION,"添加進(jìn)貨單"));
resultMap.put("success", true);
return resultMap;
}
/**
* 修改進(jìn)貨單的支付狀態(tài)
* @param id
* @return
* @throws Exception
*/
public Map<String,Object> update(Integer id)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
PurchaseList purchaseList=purchaseListService.findById(id);
purchaseList.setState(1); // 修改成支付狀態(tài)
purchaseListService.update(purchaseList);
resultMap.put("success", true);
return resultMap;
}
/**
* 根據(jù)id刪除進(jìn)貨單信息 包括進(jìn)貨單里的商品
* @param id
* @return
* @throws Exception
*/
public Map<String,Object> delete(Integer id)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
purchaseListService.delete(id);
logService.save(new Log(Log.DELETE_ACTION,"刪除進(jìn)貨單信息"+purchaseListService.findById(id))); ?// 寫入日志
resultMap.put("success", true);
return resultMap;
}
}
package com.jude.controller.admin;import com.google.gson.JsonArray;import com.google.gson.JsonObject;import com.jude.entity.Log;import com.jude.entity.Menu;import com.jude.entity.Role;import com.jude.service.*;import com.jude.util.StringUtil;import com.jude.entity.RoleMenu;import org.apache.shiro.authz.annotation.RequiresPermissions;import org.springframework.data.domain.Sort.Direction;import org.springframework.web.bind.annotation.PostMapping;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;import java.util.HashMap;import java.util.LinkedList;import java.util.List;import java.util.Map;/**
* 后臺管理角色Controller
* @author znz
*
*/public class RoleAdminController {
private RoleService roleService;
private UserRoleService userRoleService;
private MenuService menuService;
private RoleMenuService roleMenuService;
private LogService logService;
/**
* 查詢所有角色
* @return
* @throws Exception
*/
public Map<String,Object> listAll()throws Exception{
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("rows", roleService.listAll());
logService.save(new Log(Log.SEARCH_ACTION,"查詢所有角色信息")); // 寫入日志
return resultMap;
}
/**
* 分頁查詢角色信息
* @param user
* @param page
* @param rows
* @return
* @throws Exception
*/
public Map<String,Object> list(Role role, Integer page, Integer rows)throws Exception{
List<Role> roleList=roleService.list(role, page, rows, Direction.ASC, "id");
Long total=roleService.getCount(role);
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("rows", roleList);
resultMap.put("total", total);
logService.save(new Log(Log.SEARCH_ACTION,"查詢角色信息")); // 寫入日志
return resultMap;
}
/**
* 添加或者修改角色信息
* @param role
* @return
* @throws Exception
*/
public Map<String,Object> save(Role role)throws Exception{ if(role.getId()!=null){ // 寫入日志
logService.save(new Log(Log.UPDATE_ACTION,"更新角色信息"+role));
}else{
logService.save(new Log(Log.ADD_ACTION,"添加角色信息"+role));
}
Map<String, Object> resultMap = new HashMap<>();
roleService.save(role);
resultMap.put("success", true); return resultMap;
}
/**
* 刪除角色信息
* @param id
* @param response
* @return
* @throws Exception
*/
public Map<String,Object> delete(Integer id)throws Exception{
logService.save(new Log(Log.DELETE_ACTION,"刪除角色信息"+roleService.findById(id))); ?// 寫入日志
Map<String, Object> resultMap = new HashMap<>();
userRoleService.deleteByRoleId(id); // 刪除用戶角色關(guān)聯(lián)信息
roleService.delete(id);
resultMap.put("success", true); return resultMap;
}
/**
* 根據(jù)父節(jié)點(diǎn)獲取所有復(fù)選框權(quán)限菜單樹
* @param parentId
* @param roleId
* @return
* @throws Exception
*/
? ?
public String loadCheckMenuInfo(Integer parentId,Integer roleId)throws Exception{
List<Menu> menuList=menuService.findByRoleId(roleId); // 根據(jù)角色查詢所有權(quán)限菜單信息
List<Integer> menuIdList=new LinkedList<Integer>(); for(Menu menu:menuList){
menuIdList.add(menu.getId());
} return getAllCheckedMenuByParentId(parentId,menuIdList).toString();
}
/**
* 根據(jù)父節(jié)點(diǎn)ID和權(quán)限菜單ID集合獲取復(fù)選框菜單節(jié)點(diǎn)
* @param parentId
* @param menuIdList
* @return
*/
private JsonArray getAllCheckedMenuByParentId(Integer parentId,List<Integer> menuIdList){
JsonArray jsonArray=this.getCheckedMenuByParentId(parentId, menuIdList); for(int i=0;i<jsonArray.size();i++){
JsonObject jsonObject=(JsonObject) jsonArray.get(i); if("open".equals(jsonObject.get("state").getAsString())){ ? ? continue;
? ? }else{
? ? jsonObject.add("children", getAllCheckedMenuByParentId(jsonObject.get("id").getAsInt(),menuIdList));
? ? }
} return jsonArray;
}
/**
* 根據(jù)父節(jié)點(diǎn)ID和權(quán)限菜單ID集合獲取復(fù)選框菜單節(jié)點(diǎn)
* @param parentId
* @param menuIdList
* @return
*/
private JsonArray getCheckedMenuByParentId(Integer parentId,List<Integer> menuIdList){
List<Menu> menuList=menuService.findByParentId(parentId);
JsonArray jsonArray=new JsonArray(); for(Menu menu:menuList){
? ? JsonObject jsonObject=new JsonObject(); ? ? int menuId=menu.getId();
? ? jsonObject.addProperty("id", menuId); // 節(jié)點(diǎn)id
? ? jsonObject.addProperty("text", menu.getName()); // 節(jié)點(diǎn)名稱
? ? if(menu.getState()==1){
? ? jsonObject.addProperty("state", "closed"); // 根節(jié)點(diǎn)
? ? }else{
? ? jsonObject.addProperty("state", "open"); // 葉子節(jié)點(diǎn)
? ? } ? ? if(menuIdList.contains(menuId)){
? ? jsonObject.addProperty("checked", true);
? ? }
? ? jsonObject.addProperty("iconCls", menu.getIcon());
jsonArray.add(jsonObject);
? ? } return jsonArray;
}
/**
* 保存角色權(quán)限設(shè)置
* @param menuIds
* @param roleId
* @return
* @throws Exception
*/
public Map<String,Object> saveMenuSet(String menuIds,Integer roleId)throws Exception{
Map<String, Object> resultMap = new HashMap<>();
roleMenuService.deleteByRoleId(roleId); // 根據(jù)角色id刪除所有角色權(quán)限關(guān)聯(lián)實(shí)體
if(StringUtil.isNotEmpty(menuIds)){
String idsStr[]=menuIds.split(","); for(int i=0;i<idsStr.length;i++){ // 然后添加所有角色權(quán)限關(guān)聯(lián)實(shí)體
RoleMenu roleMenu=new RoleMenu();
roleMenu.setRole(roleService.findById(roleId));
roleMenu.setMenu(menuService.findById(Integer.parseInt(idsStr[i])));
roleMenuService.save(roleMenu);
}
}
resultMap.put("success", true);
logService.save(new Log(Log.ADD_ACTION,"保存角色權(quán)限設(shè)置")); ?// 寫入日志
return resultMap;
}
}