首页 前端知识 基于javaweb mysql的ssm maven防盗门进销存管理系统(java ssm html bootstrap mysql)

基于javaweb mysql的ssm maven防盗门进销存管理系统(java ssm html bootstrap mysql)

2024-02-25 11:02:32 前端知识 前端哥 416 647 我要收藏

基于javaweb+mysql的ssm+maven防盗门进销存管理系统(java+ssm+html+bootstrap+mysql)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb的SSM+Maven防盗门进销存管理系统(java+ssm+html+bootstrap+mysql)


admin   	123456	系统管理员

warehouser	123456	库存管理员

purchaser	123456	采购员

saler	    123456	销售员

auditor 	123456	订单审核员

采购-入库流程:

1 采购员purchaser-采购

2 订单审核员auditor-审核

3 库存管理员warehouser-入库审核(此时【库存管理】出现库存量)

销售-出库流程:

1 销售员saler-销售

2 订单审核员auditor-审核

3 库存管理员warehouser-出库审核(此时【库存管理】出现销售量)

项目介绍

本项目分为系统管理员、库存管理员、采购员、销售员、订单审核员等角色。 各角色主要功能如下所示:

系统管理员 基础信息管理 商品 仓库 员工 角色 库存管理 库存管理 销售单审核(2出库) 采购单审核(2入库) 订单经理 销售单审核(1审核) 采购单审核(1审核) 采购管理 供应商管理 采购订单 销售管理 客户管理 销售订单 数据统计 采购统计 销售统计 账户管理 用户管理 修改密码

库存管理员

库存管理 库存查看 销售单审核(出库) 采购单审核(入库) 账户管理 修改密码

采购员

基础信息管理 商品(采购可以添加新的商品) 采购管理 供应商管理 采购订单 数据统计 采购统计 账户管理 修改密码

销售员

销售管理 客户管理 销售订单 数据统计 销售统计 账户管理 修改密码

订单审核员

订单审核 销售单审核 采购单审核 账户管理 修改密码

环境需要

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

  1. 前端:BootStrap+JavaScript+jQUery+Ajax+CSS+HTML

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2.使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat 3.打开jdbc.properties配置文件,修改数据库用户名和密码为自己本地数据库的用户名和密码 注:username与password需要在util/DESUtil中main方法中获取加密后的数据并填写 # 数据库用户名 jdbc.username=Ov4j7fKiCzY=DES加密,加密前为root # 数据库密码 jdbc.password=Ov4j7fKiCzY=DES加密,加密前为root 4.打开浏览器,输入 localhost:8080/sdims 进入登录界面 5.输入用户名和密码访问系统 账号和密码: 超级管理员: admin 库存管理员: xiaoku 订单经理: xiaodan 采购员:xiaocai 销售员: xiaoxiao 密码均为:111111
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/removerepository",method=RequestMethod.GET)
	private Map<String, Object> removeRepository(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String,Object>();
		long repoId = HttpServletRequestUtil.getLong(request, "repoId");
		try {
			int effectNum = repositoryService.removeRepository(repoId);
			if (effectNum < 0) {
				modelMap.put("success", false);
				modelMap.put("errMsg", "删除失败");
			}else {
				modelMap.put("success", true);
				modelMap.put("successMsg", "删除成功");
			}
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
			return modelMap;
		}
		return modelMap;
	}
	/**
	 * 根据前台传递的仓库ID去查询信息并返回前台
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="getrepositorybyid",method=RequestMethod.GET)
	private Map<String, Object> getRepositoryById(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String, Object>();
		Long repoId = HttpServletRequestUtil.getLong(request, "repoId");
		Repository repository = new Repository();
		try {
			repository = repositoryService.getRepositoryById(repoId);
			if (repository!=null) {
				modelMap.put("success", true);
				modelMap.put("repository", repository);
			}else {
				modelMap.put("success", false);
				modelMap.put("errMsg", "查询错误");
			}
		} catch (Exception e) {
			// TODO: handle exception
			pageBean.setSumPages(sumPages);
			// 定义数组(用于页码展示组件)
			int[] tempNum = new int[sumPages];
			for (int i = 0; i < sumPages; i++) {
				tempNum[i] = i + 1;
			}
			// 页码数字
			pageBean.setNavigatepageNums(tempNum);
			modelMap.put("success", true);
			modelMap.put("pageBean", pageBean);
			modelMap.put("stateInfo", outoStockSaleOrderCheckExecution.getStateInfo());
		} else {
			modelMap.put("success", false);
			modelMap.put("errMsg", "pageIndex or pageSize is Null");
		}
		return modelMap;
	}
	/**
	 * 根据前台传过来的信息对应ID通过审核-出库
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/modifyoutostocksaleordercheck",method=RequestMethod.GET)
	private Map<String, Object> modifyOutoStockSaleOrderCheck(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String,Object>();
		//这里的数据要包含ID因为是根据ID进行更新
		long sorderId = HttpServletRequestUtil.getLong(request, "sorderId");
		SaleOrder saleOrder = new SaleOrder();
		saleOrder.setSorderId(sorderId);
		//后期session获取库管
		//用户姓名从登陆后的session中获取
		User user = (User) request.getSession().getAttribute("loginUser");
		saleOrder.setStockMan(user.getEmployee().getName());
		try {
			int effectNum = outoStockService.modifyOutoStockSaleOrderCheck(saleOrder);
			if (effectNum==STOCK_COUNT_SATATE) {
				modelMap.put("success", false);
				modelMap.put("errMsg", "审核失败-库存不足");
			}
			if (effectNum==NULL_STOCK) {
				modelMap.put("success", false);
				modelMap.put("errMsg", "审核失败-此仓库没有此商品,请通知销售员修改仓库");
				modelMap.put("saleOrder", saleOrder);
			}else {
				modelMap.put("success", false);
				modelMap.put("errMsg", "查询错误");
			}
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
		}
		return modelMap;
	}
	/**
	 * 根据前台传过来的信息对应ID进行更新
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/modifysaleorder",method=RequestMethod.POST)
	private Map<String, Object> modifySaleOrder(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String,Object>();
		//这里的数据要包含ID因为是根据ID进行更新
		String saleOrderStr = HttpServletRequestUtil.getString(request, "saleOrderStr");
		//JSON转化后的销售单存储对象
		SaleOrder saleOrder = null;
		//存放json的对象
		ObjectMapper objectMapper = new ObjectMapper();
		//接受json形式的saleOrder信息
		try {
			//使用ObjectMapper类把请求中的json信息存放在saleOrder实体类中
			saleOrder = objectMapper.readValue(saleOrderStr, SaleOrder.class);
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
			return modelMap;
		}
		try {
			int effectNum = saleOrderService.modifySaleOrder(saleOrder);
			if (effectNum < 1) {
			// 采购单列表
			pageBean.setDatas(intoStockPurchaseOrderCheckExecution.getData());
			// 每页记录数
			pageBean.setPageSize(5);
			// 当前页
			pageBean.setCurPage(pageIndex);
			int sumPages = PageBean.getSumPages(intoStockPurchaseOrderCheckExecution.getCount(), pageSize);
			// 总页数
			pageBean.setSumPages(sumPages);
			// 定义数组(用于页码展示组件)
			int[] tempNum = new int[sumPages];
			for (int i = 0; i < sumPages; i++) {
				tempNum[i] = i + 1;
			}
			// 页码数字
			pageBean.setNavigatepageNums(tempNum);
			modelMap.put("success", true);
			modelMap.put("pageBean", pageBean);
			modelMap.put("stateInfo", intoStockPurchaseOrderCheckExecution.getStateInfo());
		} else {
			modelMap.put("success", false);
			modelMap.put("errMsg", "pageIndex or pageSize is Null");
		}
		return modelMap;
	}
	/**
	 * 根据前台传过来的信息对应ID通过审核-入库
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/modifyintostockpurchaseordercheck",method=RequestMethod.GET)
	private Map<String, Object> modifyIntoStockPurchaseOrderCheck(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String,Object>();
		//这里的数据要包含ID因为是根据ID进行更新
		long porderId = HttpServletRequestUtil.getLong(request, "porderId");
		PurchaseOrder purchaseOrder = new PurchaseOrder();
		purchaseOrder.setPorderId(porderId);
		//后期session获取库管
		//用户姓名从登陆后的session中获取
		User user = (User) request.getSession().getAttribute("loginUser");
		purchaseOrder.setStockMan(user.getEmployee().getName());
		try {
			int effectNum = intoStockService.modifyIntoStockPurchaseOrderCheck(purchaseOrder);
			if (effectNum < 1) {
				modelMap.put("success", false);
	public String goods() {
		return "admin/goods";
	}
	/*-------------------------------------------采购管理功能----------------------------------------------*/
	/**
	 * 供应商管理页(采购员专用路由)
	 * @return
	 */
	@RequestMapping(value="purchasesupplier", method=RequestMethod.GET)
	public String purchaseSupplier() {
		return "purchase/purchasesupplier";
	}
	/**
	 * 采购订单管理页(采购员专用路由)
	 * @return
	 */
	@RequestMapping(value="purchaseorder", method=RequestMethod.GET)
	public String purchaseOrder() {
		return "purchase/purchaseorder";
	}
	/*-------------------------------------------统计分析页----------------------------------------------*/
	/**
	 * 采购统计
	 * @return
	 */
	@RequestMapping(value="purchasestatistics", method=RequestMethod.GET)
	public String purchaseStatistics() {
		return "statistics/purchasestatistics";
	}
	/*-------------------------------------------账户管理页----------------------------------------------*/
	/**
	 * 用户修改密码页(所有用户共有功能)
	 * @return
	 */
	@RequestMapping(value="modifypassword", method=RequestMethod.GET)
	public String modifyPassword() {
		return "comment/modifypassword";
	}
}

@Controller
@RequestMapping(value="/sale", method=RequestMethod.GET)
public class SaleViewController {
	/**
	 * 销售管理页(销售员专用路由)
	 * @return
	 */
	@RequestMapping(value="index", method=RequestMethod.GET)
		User user = (User) request.getSession().getAttribute("loginUser");
		long userId = user.getUserId();
		String account = HttpServletRequestUtil.getString(request, "account");
		String password = HttpServletRequestUtil.getString(request, "password");
		String MDPassword = MD5.getMd5(password);
		String newPassword = HttpServletRequestUtil.getString(request, "newPassword");
		String MDNewPassword = MD5.getMd5(newPassword);
		try {
			int effectNum = userService.modifyPasswordById(userId, account, MDPassword, MDNewPassword);
			if (effectNum < 1) {
				modelMap.put("success", false);
				modelMap.put("errMsg", "账户名/旧密码输入错误");
			}else {
				modelMap.put("success", true);
				//注销当前session
				request.getSession().removeAttribute("loginUser");
				request.getSession().invalidate();
				modelMap.put("successMsg", "密码更新成功");
			}
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
			return modelMap;
		}
		return modelMap;
	}
	/**
	 * 登录验证
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/checkLoginInfo",method=RequestMethod.GET)
	private Map<String, Object> checkLoginInfo(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String,Object>();
		String account = HttpServletRequestUtil.getString(request, "account");
		String password = HttpServletRequestUtil.getString(request, "password");
		User loginUser = null;
		try {
			loginUser = userService.checkLoginInfo(account, password);
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", "验证错误"+e.getMessage());
			modelMap.put("pageBean", pageBean);
			modelMap.put("stateInfo", userExecution.getStateInfo());
		}else {
			modelMap.put("success", false);
			modelMap.put("errMsg", "pageIndex or pageSize is Null");
		}
		return modelMap;
	}
	/**
	 * 添加用户信息
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/adduser",method=RequestMethod.POST)
	private Map<String, Object> addUser(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String, Object>();
		String userStr = HttpServletRequestUtil.getString(request, "userStr");
		//JSON转化后的用户存储对象
		User user = null;
		//存放json的对象
		ObjectMapper objectMapper = new ObjectMapper();
		//接受json形式的User信息
		try {
			//使用ObjectMapper类把请求中的json信息存放在User实体类中
			user = objectMapper.readValue(userStr, User.class);
			System.out.println(user.getAccount());
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
			return modelMap;
		}
		try {
			//非空判断
			if (user!=null) {
				//账户不能重复判断
				String account = user.getAccount();
				int tempCount = userService.checkRegisterUserByAccount(account);
				if (tempCount > 0) {
					modelMap.put("success", false);
					modelMap.put("errMsg", "-已有此用户名");
				modelMap.put("success", false);
				modelMap.put("errMsg", "审核失败-库存不足");
			}
			if (effectNum==NULL_STOCK) {
				modelMap.put("success", false);
				modelMap.put("errMsg", "审核失败-此仓库没有此商品,请通知销售员修改仓库");
			}
			if (effectNum < 1) {
				modelMap.put("success", false);
				modelMap.put("errMsg", "审核通过销售单失败");
			}else if(effectNum==1){
				modelMap.put("success", true);
				modelMap.put("successMsg", "审核成功");
			}
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
			return modelMap;
		}
		return modelMap;
	}
	/**
	 * 判断对于查询需入库销售单时候的筛选条件
	 * @param orderNumber
	 * @param checkState
	 * @return
	 */
	private SaleOrder compactSaleOrderCheckCondition(String checkOrderNumber,int stockStateNumber) {
		SaleOrder saleOrderCondition = new SaleOrder();
		//通过第一次审核的条件
		saleOrderCondition.setCheckState(1);
		// 若有指定订单号的要求则添加进去
		if (checkOrderNumber != null) {
			saleOrderCondition.setOrderNumber(checkOrderNumber);
		}
		// 若有指定订单经理审核通过
		if (stockStateNumber != -1L) {
			saleOrderCondition.setStockState(stockStateNumber);
		}
		return saleOrderCondition;
	}
}

			pageBean.setSumPages(sumPages);
			// 定义数组(用于页码展示组件)
			int[] tempNum = new int[sumPages];
			for (int i = 0; i < sumPages; i++) {
				tempNum[i] = i + 1;
			}
			// 页码数字
			pageBean.setNavigatepageNums(tempNum);
			modelMap.put("success", true);
			modelMap.put("pageBean", pageBean);
			modelMap.put("stateInfo", saleOrderExecution.getStateInfo());
		} else {
			modelMap.put("success", false);
			modelMap.put("errMsg", "pageIndex or pageSize is Null");
		}
		return modelMap;
	}
	/**
	 * 添加销售单信息
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/addsaleorder",method=RequestMethod.POST)
	private Map<String, Object> addSaleOrder(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String, Object>();
		String saleOrderStr = HttpServletRequestUtil.getString(request, "saleOrderStr");
		//JSON转化后的销售单存储对象
		SaleOrder saleOrder = null;
		//存放json的对象
		ObjectMapper objectMapper = new ObjectMapper();
		//接受json形式的Employee信息
		try {
			//使用ObjectMapper类把请求中的json信息存放在repository实体类中
			saleOrder = objectMapper.readValue(saleOrderStr, SaleOrder.class);
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
			return modelMap;
		}
		try {
			//非空判断
			if (saleOrder!=null) {
				int effectNum = saleOrderService.addSaleOrder(saleOrder);
				if (effectNum < 1) {
					modelMap.put("success", false);
		}
		modelMap.put("success", true);
		modelMap.put("allSupplierList", allSupplierList);
		return modelMap;
	}
	/**
	 * 添加供应商信息
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/addsupplier",method=RequestMethod.POST)
	private Map<String, Object> addSupplier(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String, Object>();
		String supplierStr = HttpServletRequestUtil.getString(request, "supplierStr");
		//JSON转化后的供应商存储对象
		Supplier supplier = null;
		//存放json的对象
		ObjectMapper objectMapper = new ObjectMapper();
		//接受json形式的Supplier信息
		try {
			//使用ObjectMapper类把请求中的json信息存放在repository实体类中
			supplier = objectMapper.readValue(supplierStr, Supplier.class);
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
			return modelMap;
		}
		try {
			//非空判断
			if (supplier!=null) {
				int effectNum = purchaseSupplierService.addPurchaseSupplier(supplier);
				if (effectNum < 1) {
					modelMap.put("success", false);
					modelMap.put("errMsg", "插入失败");
				}else {
					modelMap.put("success", true);
				}
			}
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
			return modelMap;
		}
		return modelMap;
	}
	/**
	 * 根据前台传的ID移除对应供应商
	 * @param request
	 * @return
	 */
	@ResponseBody
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/getemployeelist",method=RequestMethod.GET)
	private Map<String, Object> getEmployeeList(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String, Object>();
		//获取页码
		int pageIndex = HttpServletRequestUtil.getInt(request, "pageIndex");
		//获取每页展示的数据量
		int pageSize = 8;
		//获取查询条件(员工姓名)
		String employeeName = HttpServletRequestUtil.getString(request, "employeeName");
		//获取查询条件(员工类别)
		String employeeType = HttpServletRequestUtil.getString(request, "employeeType");
		Employee employeeCondition = new Employee();
		employeeCondition.setName(employeeName);
		employeeCondition.setType(employeeType);
		//非空判断
		if (pageIndex > -1) {
			EmployeeExecution employeeExecution = employeeService.getEmployeeList(employeeCondition, pageIndex, pageSize);
			pageBean = new PageBean<Employee>();
			//总记录数
			pageBean.setAllRowCounts(employeeExecution.getCount());
			//仓库列表
			pageBean.setDatas(employeeExecution.getEmployeeList());
			//每页记录数
			pageBean.setPageSize(pageSize);
			//当前页
			pageBean.setCurPage(pageIndex);
			int sumPages = PageBean.getSumPages(employeeExecution.getCount(),pageSize);
			//总页数
			pageBean.setSumPages(sumPages);
			//定义数组(用于页码展示组件)
			int[] tempNum = new int[sumPages];
			for (int i = 0; i<sumPages; i++) {
				tempNum[i]=i+1;
			}
			//页码数字
			pageBean.setNavigatepageNums(tempNum);
			modelMap.put("success", true);
			modelMap.put("pageBean",pageBean);
	 * 出库管理页(仓库管理员专用路由)
	 * @return
	 */
	@RequestMapping(value="outostock", method=RequestMethod.GET)
	public String outoStock() {
		return "stock/outostock";
	}
	/*-------------------------------------------统计分析页----------------------------------------------*/
	/**
	 * 采购统计
	 * @return
	 */
	@RequestMapping(value="purchasestatistics", method=RequestMethod.GET)
	public String purchaseStatistics() {
		return "statistics/purchasestatistics";
	}
	/**
	 * 销售统计
	 * @return
	 */
	@RequestMapping(value="salestatistics", method=RequestMethod.GET)
	public String saleStatistics() {
		return "statistics/salestatistics";
	}
	/*-------------------------------------------用户管理页----------------------------------------------*/
	/**
	 * 用户管理页(管理员专用路由)
	 * @return
	 */
	@RequestMapping(value="user", method=RequestMethod.GET)
	public String user() {
		return "admin/user";
	}
	/**
	 * 用户修改密码页(所有用户共有功能)
	 * @return
	 */
	@RequestMapping(value="modifypassword", method=RequestMethod.GET)
	public String modifyPassword() {
		return "comment/modifypassword";
	}
}
				modelMap.put("successMsg", "撤销审核成功");
			}
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
			return modelMap;
		}
		return modelMap;
	}
	/**
	 * 判断对于查询采购单时候的筛选条件
	 * @param orderNumber
	 * @param checkState
	 * @return
	 */
	private PurchaseOrder compactPurchaseOrderCheckCondition(String orderNumber,int checkState) {
		PurchaseOrder purchaseOrderCondition = new PurchaseOrder();
		// 若有指定订单号的要求则添加进去
		if (orderNumber != null) {
			purchaseOrderCondition.setOrderNumber(orderNumber);
		}
		// 若有指定订单经理审核通过
		if (checkState != -1L) {
			purchaseOrderCondition.setCheckState(checkState);
		}
		return purchaseOrderCondition;
	}
}

/**
 * 销售单审核
	private Map<String, Object> getEmployeeList(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String, Object>();
		//获取页码
		int pageIndex = HttpServletRequestUtil.getInt(request, "pageIndex");
		//获取每页展示的数据量
		int pageSize = 8;
		//获取查询条件(员工姓名)
		String employeeName = HttpServletRequestUtil.getString(request, "employeeName");
		//获取查询条件(员工类别)
		String employeeType = HttpServletRequestUtil.getString(request, "employeeType");
		Employee employeeCondition = new Employee();
		employeeCondition.setName(employeeName);
		employeeCondition.setType(employeeType);
		//非空判断
		if (pageIndex > -1) {
			EmployeeExecution employeeExecution = employeeService.getEmployeeList(employeeCondition, pageIndex, pageSize);
			pageBean = new PageBean<Employee>();
			//总记录数
			pageBean.setAllRowCounts(employeeExecution.getCount());
			//仓库列表
			pageBean.setDatas(employeeExecution.getEmployeeList());
			//每页记录数
			pageBean.setPageSize(pageSize);
			//当前页
			pageBean.setCurPage(pageIndex);
			int sumPages = PageBean.getSumPages(employeeExecution.getCount(),pageSize);
			//总页数
			pageBean.setSumPages(sumPages);
			//定义数组(用于页码展示组件)
			int[] tempNum = new int[sumPages];
			for (int i = 0; i<sumPages; i++) {
				tempNum[i]=i+1;
			}
			//页码数字
			pageBean.setNavigatepageNums(tempNum);
			modelMap.put("success", true);
			modelMap.put("pageBean",pageBean);
			modelMap.put("stateInfo", employeeExecution.getStateInfo());
		}else {
			modelMap.put("success", false);
			modelMap.put("errMsg", "pageIndex or pageSize is Null");
		}
		return modelMap;
	}
	/**
	 * 得到所有员工信息,展示在前台添加用户的select中,用于用户个人信息绑定
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/getallemployeelist",method=RequestMethod.GET)
	 */
	@ResponseBody
	@RequestMapping(value="/getintopurchaseorderchecklist",method=RequestMethod.GET)
	private Map<String, Object> getIntoPurchaseOrderCheckList(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String, Object>();
		// 获取页码
		int pageIndex = HttpServletRequestUtil.getInt(request, "pageIndex");
		// 获取每页展示的数据量
		int pageSize = 5;
		// 获取查询条件
		String checkOrderNumber = HttpServletRequestUtil.getString(request,"checkOrderNumber");
		int stockStateNumber = HttpServletRequestUtil.getInt(request, "stockStateNumber");
		//抛出checkStateNumber为null异常抛-1判断!=-1时候添加条件,否则不set此条件
		PurchaseOrder purchaseOrderCondition = compactPurchaseOrderCheckCondition(checkOrderNumber, stockStateNumber);
		// 非空判断
		if (pageIndex > -1) {
			TExecution<PurchaseOrder> intoStockPurchaseOrderCheckExecution = intoStockService.getIntoStockPurchaseOrderCheckList(purchaseOrderCondition, pageIndex, pageSize);
			pageBean = new PageBean<PurchaseOrder>();
			// 总记录数
			pageBean.setAllRowCounts(intoStockPurchaseOrderCheckExecution.getCount());
			// 采购单列表
			pageBean.setDatas(intoStockPurchaseOrderCheckExecution.getData());
			// 每页记录数
			pageBean.setPageSize(5);
			// 当前页
			pageBean.setCurPage(pageIndex);
			int sumPages = PageBean.getSumPages(intoStockPurchaseOrderCheckExecution.getCount(), pageSize);
			// 总页数
			pageBean.setSumPages(sumPages);
			// 定义数组(用于页码展示组件)
			int[] tempNum = new int[sumPages];
			for (int i = 0; i < sumPages; i++) {
				tempNum[i] = i + 1;
			}
			// 页码数字
			pageBean.setNavigatepageNums(tempNum);
			modelMap.put("success", true);
			modelMap.put("pageBean", pageBean);
			modelMap.put("stateInfo", intoStockPurchaseOrderCheckExecution.getStateInfo());
		} else {
			modelMap.put("success", false);
			modelMap.put("errMsg", "pageIndex or pageSize is Null");
		}
		return modelMap;

/**
 * 员工
 *
 */
@Controller
@RequestMapping("/admin")
public class EmployeeController {

	@Autowired
	private EmployeeService employeeService;
	
	private PageBean<Employee> pageBean;
	/**
	 * 获取前台传递的request信息,同时根据信息从service中取出数据,并返回JSON格式
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/getemployeelist",method=RequestMethod.GET)
	private Map<String, Object> getEmployeeList(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String, Object>();
		//获取页码
		int pageIndex = HttpServletRequestUtil.getInt(request, "pageIndex");
		//获取每页展示的数据量
		int pageSize = 8;
		//获取查询条件(员工姓名)
		String employeeName = HttpServletRequestUtil.getString(request, "employeeName");
		//获取查询条件(员工类别)
		String employeeType = HttpServletRequestUtil.getString(request, "employeeType");
		Employee employeeCondition = new Employee();
		employeeCondition.setName(employeeName);
		employeeCondition.setType(employeeType);
		//非空判断
		if (pageIndex > -1) {
			EmployeeExecution employeeExecution = employeeService.getEmployeeList(employeeCondition, pageIndex, pageSize);
			pageBean = new PageBean<Employee>();
			//总记录数
			pageBean.setAllRowCounts(employeeExecution.getCount());
			//仓库列表
			pageBean.setDatas(employeeExecution.getEmployeeList());
			modelMap.put("stateInfo", saleOrderCheckExecution.getStateInfo());
		} else {
			modelMap.put("success", false);
			modelMap.put("errMsg", "pageIndex or pageSize is Null");
		}
		return modelMap;
	}
	/**
	 * 根据前台传过来的信息对应ID通过审核
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/modifysaleordercheck",method=RequestMethod.GET)
	private Map<String, Object> modifySaleOrderCheck(HttpServletRequest request){
		Map<String, Object> modelMap = new HashMap<String,Object>();
		//这里的数据要包含ID因为是根据ID进行更新
		long sorderId = HttpServletRequestUtil.getLong(request, "sorderId");
		//用户姓名从登陆后的session中获取
		User user = (User) request.getSession().getAttribute("loginUser");
		SaleOrder saleOrder = new SaleOrder();
		saleOrder.setSorderId(sorderId);
		//后期session获取----------------------------------
		saleOrder.setCheckMan(user.getEmployee().getName());
		try {
			int effectNum = saleOrderCheckService.modifySaleOrderCheck(saleOrder);
			if (effectNum < 1) {
				modelMap.put("success", false);
				modelMap.put("errMsg", "审核通过销售单失败");
			}else {
				modelMap.put("success", true);
				modelMap.put("successMsg", "审核成功");
			}
		} catch (Exception e) {
			// TODO: handle exception
			modelMap.put("success", false);
			modelMap.put("errMsg", e.getMessage());
			return modelMap;
		}
		return modelMap;
	}
	/**
	 * 根据前台传过来的信息对应ID撤销审核
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/modifysaleorderrevoke",method=RequestMethod.GET)
		return "admin/employee";
	}
	/**
	 * 仓库展示页(角色共有部分)
	 * @return
	 */
	@RequestMapping(value="repo", method=RequestMethod.GET)
	public String repo() {
		return "comment/repo";
	}
	/**
	 * 商品展示页
	 * @return
	 */
	@RequestMapping(value="goods", method=RequestMethod.GET)
	public String goods() {
		return "admin/goods";
	}
	/*-------------------------------------------采购管理页----------------------------------------------*/
	/**
	 * 供应商管理页
	 * @return
	 */
	@RequestMapping(value="purchasesupplier", method=RequestMethod.GET)
	public String purchaseSupplier() {
		return "purchase/purchasesupplier";
	}
	/**
	 * 采购订单管理页
	 * @return
	 */
	@RequestMapping(value="purchaseorder", method=RequestMethod.GET)
	public String purchaseOrder() {
		return "purchase/purchaseorder";
	}
	/*-------------------------------------------销售管理页----------------------------------------------*/
	/**
	 * 销售商管理页
	 * @return
	 */
	@RequestMapping(value="salecustomer", method=RequestMethod.GET)
	public String saleCustomer() {

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

转载请注明出处或者链接地址:https://www.qianduange.cn//article/2656.html
标签
mysql
评论
会员中心 联系我 留言建议 回顶部
复制成功!