Java项目:大学实验室设备管理系统(java+JSP+easyui+HTML+Mysql)

源码获取:俺的博客首页 "资源" 里下载!

项目介绍

本项目为后台管理系统,主要功能如下:
管理员登录,管理数据字典,设备信息管理,进购管理,报损管理,查看库存,账号管理等功能。


环境需要

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.数据库:MySql 5.7版本;
6.是否Maven项目:否;


技术栈

HTML+CSS+JavaScript+JSP+jquery+easyui+mysql


使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中dbpool.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入http://localhost:8080/jsp_dxsys_sys/ 登录
管理员账号密码:admin/admin


 

 

 

 

 

系统用户管理控制层:

@Controller
public class SysuserController {
	@Resource
	private SysuserServier userService;

	@RequestMapping("flogin.do")
	public String login() {
		return "login";
	}
    
	@RequestMapping("admin/showUserInfo.do")
	public String showUserInfo(ModelMap map,HttpSession session){
		if(session.getAttribute("auser")==null){
			return "login";
		}
		Sysuser u=(Sysuser)session.getAttribute("auser");
		map.put("user",userService.getById(u.getUid()));
		return "admin/update_user_persion";
	}
	@RequestMapping("admin/updatePersionUser.do")
	public String updateUserInfo(ModelMap map,HttpSession session,Sysuser user){
		userService.update(user);
		map.put("user", userService.getById(user.getUid()));
		session.setAttribute("suc", "cc");
		return "redirect:showUserInfo.do";
	}
	
	
	@RequestMapping("admin/login.do")
	public String aLogin() {
		return "admin/login";
	}
//	处理修改个人信息
		@RequestMapping("showInfo.do")
	public String showInfo(HttpSession session,ModelMap map) {
		Sysuser u=(Sysuser)session.getAttribute("user");
		if(u==null){
			return "fore_login";
		}else{
			map.put("user", userService.getById(u.getUid()));
			return "showUserinfo";
		}
	}	
//		处理修改个人信息
			@RequestMapping("addShowInfo.do")
		public String addShowInfo(HttpSession session,ModelMap map,Sysuser user) {
				userService.update(user);
				return "success";
		}	
	
//	文件上传
	public String fileUpload(@RequestParam(value="file",required=false)MultipartFile file,
			HttpServletRequest request,String img){
		String path=request.getSession().getServletContext().getRealPath("upload");
		System.out.println("path==="+path);
		System.out.println("file==="+file);
		String fileName=file.getOriginalFilename();
		System.out.println("fileName==="+fileName);
		File targetFile=new File(path,fileName);
		if(!targetFile.exists()){
			targetFile.mkdirs();
		}
		try {
			file.transferTo(targetFile);
		} catch (IllegalStateException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String pa=request.getContextPath()+"/upload/"+fileName;
		System.out.println("path==="+pa);
		if(fileName!=null&&!fileName.equals("")){
			img=fileName;
		}else{
			img=null;	
		}
		
		return img;
		
	}
	// 后台登录
	@RequestMapping("admin/alogin.do")
	public String checkLogin(ModelMap map,Sysuser user, HttpSession session) {
		Map<String,Object> u=new HashMap<String,Object>();
		System.out.println("name===" + user.getUname());
		System.out.println("pwd===" + user.getPwd());
		u.put("uname",user.getUname());
		u.put("utype", user.getUtype());
		u.put("pwd",user.getPwd());
		user = userService.adminLogin(u);
		if (user != null) {
			session.setAttribute("auser", user);
			System.out.println("auser=" + user);
			return "admin/index";
		} else {
			map.put("errorInfo", "用户名或者密码错误!");
			return "admin/login";
		}
	}

	// 后台注销登录
	@RequestMapping("admin/loginout.do")
	public String adminLoginOut(HttpSession session) {
		session.removeAttribute("auser");
		return "redirect:login.do";
	}

	// 前台注销登录
	@RequestMapping("loginout.do")
	public String loginOut(HttpSession session) {
		session.removeAttribute("user");
		session.removeAttribute("p");
		return "fore_login";
	}


//	验证用户名是否存在
	@RequestMapping("admin/checkUname.do")
	public void checkUname(Sysuser user,HttpServletResponse response){
		   Map<String,Object> map=new HashMap<String,Object>();
		   map.put("uname", user.getUname());
		   System.out.println("uname==="+user.getUname());
		   System.out.println("uname222==="+userService.checkUname(map));
		   JSONObject obj=new JSONObject();
		   if(userService.checkUname(map)!=null){
			  
				 obj.put("info", "ok");
			   }else{
				   obj.put("info", "用户名可以用!");
				  
			   }
		   response.setContentType("text/html;charset=utf-8");
		   PrintWriter out=null;
		   try {
			out=response.getWriter();
			out.print(obj);
			out.flush();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			out.close();
		}
	}
	
		@RequestMapping("checkmibao.do")
	public void checkMB(Sysuser user,HttpServletResponse response,HttpSession session){
		  JSONObject obj=new JSONObject();
		  Sysuser u=userService.getById(user.getUid());
		  String q=u.getQuestion();
		  if(u==null||u.equals("")){
			  obj.put("info", "ng");
		  }else{
			 if(q.equals(user.getQuestion())){
				 obj.put("info", u.getPwd());
			 }else{
				 obj.put("info", "ng");
			 }
		  }
		   response.setContentType("text/html;charset=utf-8");
		   PrintWriter out=null;
		   try {
			out=response.getWriter();
			out.print(obj);
			out.flush();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			out.close();
		}
		  
	}
//	验证用户名是否存在
	@RequestMapping("checkUname.do")
	public void checkReg(Sysuser user,HttpServletResponse response){
		   Map map=new HashMap();
		   map.put("uname", user.getUname());
		   System.out.println("uname==="+user.getUname());
		   System.out.println("uname222==="+userService.checkUname(map));
		   JSONObject obj=new JSONObject();
		   if(userService.checkUname(map)!=null){
			   System.out.println("uname233333333333===");
				 obj.put("info", "ng");
			   }else{
				   System.out.println("uname255555555555555===");
				   obj.put("info", "用户名可以用!");
				  
			   }
		   response.setContentType("text/html;charset=utf-8");
		   PrintWriter out=null;
		   try {
			out=response.getWriter();
			out.print(obj);
			out.flush();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			out.close();
		}
	}
	@RequestMapping("checkPass.do")
	public void checkPass(Sysuser user,HttpServletResponse response){
		   Map map=new HashMap();
		   map.put("uname", user.getUname());
		   System.out.println("uname==="+user.getUname());
		   System.out.println("uname222==="+userService.checkUname(map));
		   JSONObject obj=new JSONObject();
		   if(userService.checkUname(map)!=null){
				 obj.put("info", userService.checkUname(map).getPwd());
			   }else{
				   obj.put("info", "ng");
				  
			   }
		   response.setContentType("text/html;charset=utf-8");
		   PrintWriter out=null;
		   try {
			out=response.getWriter();
			out.print(obj);
			out.flush();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			out.close();
		}
	}
	@RequestMapping("reg.do")
	public String addReg(Sysuser user, HttpSession session) {
		user.setIsdel("1");
		user.setUtype("会员");
		Timestamp time=new Timestamp(System.currentTimeMillis());
		user.setPubtime(time.toString());
		userService.add(user);
		return "fore_login";
	}
	// 添加用户
	@RequestMapping("admin/addUser.do")
	public String addUser(Sysuser user, HttpSession session) {
		user.setIsdel("1");
		Timestamp time=new Timestamp(System.currentTimeMillis());
		user.setPubtime(time.toString());
		userService.add(user);
		return "redirect:userList.do";
	}
//	管理员注册
	@RequestMapping("admin/addUser2.do")
	public String addUser2(Sysuser user, HttpSession session) {
		user.setIsdel("1");
		Timestamp time=new Timestamp(System.currentTimeMillis());
		user.setPubtime(time.toString());
		userService.add(user);
		return "admin/login";
	}

	// 处理更新用户的信息
	@RequestMapping("admin/doUpdateUser.do")
	public String doUpdateUser(ModelMap map, int id) {
		System.out.println("id=="+id);
		map.put("user",userService.getById(id));
		return "admin/update_user";
	}

	// 更新用户的信息
	@RequestMapping("admin/updateUser.do")
	public String updateUser(Sysuser user) {
		userService.update(user);
		return "redirect:userList.do";
	}

	
	// 查询所有用户的信息
	@RequestMapping("admin/userList.do")
	public String userList(@RequestParam(value = "page", required = false) String page, HttpSession session,
			ModelMap map) {
		if (page == null || page.equals("")) {
			page = "1";
		}
		PageBean pageBean = new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
		Map<String, Object> pmap = new HashMap<String, Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		Map cmap=new HashMap();
		/*pmap.put("utype", "会员");
		cmap.put("utype", "会员");*/
		int total = userService.getCount(cmap);
		pageBean.setTotal(total);
		List<Sysuser> list = userService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "admin/user_list";
	}

	// 模糊查询并分页
	@RequestMapping("admin/userListQuery.do")
	public String useListQuery(@RequestParam(value = "page", required = false) String page, HttpSession session,
			ModelMap map,Sysuser user) {
		if (page == null || page.equals("")) {
			page = "1";
		}
		PageBean pageBean = new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
		Map<String, Object> pmap = new HashMap<String, Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		pmap.put("uname", user.getUname());
		Map cmap=new HashMap();
	/*	pmap.put("utype", "会员");
		cmap.put("utype", "会员");*/
		int total = userService.getCount(pmap);
		pageBean.setTotal(total);
		List<Sysuser> list = userService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 2);
		return "admin/user_list";
	}
	@RequestMapping("admin/deleteUser.do")
	public String deleteUser(int id){
		userService.delete(id);
		return "redirect:userList.do";
	}

}

实验室管理控制层:

@Controller
public class ShiYanController {
	@Resource
	private ShiYanServer ShiYanService;
	@Resource
	private ForderServer orderService;
	@Resource
	private SysuserServier userService;
	
	
//	文件上传
	public String fileUpload(@RequestParam(value="file",required=false)MultipartFile file,
			HttpServletRequest request,String img){
		String path=request.getSession().getServletContext().getRealPath("upload");
		String fileName=file.getOriginalFilename();
		File targetFile=new File(path,fileName);
		if(!targetFile.exists()){
			targetFile.mkdirs();
		}
		try {
			file.transferTo(targetFile);
		} catch (IllegalStateException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String pa=request.getContextPath()+"/upload/"+fileName;
		System.out.println("path==="+pa);
		if(fileName!=null&&!fileName.equals("")){
			img=fileName;
		}else{
			img="zanwu.jpg";	
		}
		return img;
		
	}
//	实验室管理
	@RequestMapping("admin/addShiYan.do")
	public String addShiYan(ModelMap map,ShiYan shiYan,HttpServletRequest request){
		Timestamp time=new Timestamp(System.currentTimeMillis());
		shiYan.setFtype("实验室");
		shiYan.setMstatus("空闲中");
		shiYan.setIsdel("1");
		shiYan.setPubtime(time.toString().substring(0, 19));
		ShiYanService.add(shiYan);
		return "redirect:ShiYanList.do";
	}
	@RequestMapping("admin/doUpdateShiYan.do")
	public String doUpdateShiYan(ModelMap map,int id){
		map.put("sy", ShiYanService.getById(id));
		return "admin/update_ShiYan";
	}
	@RequestMapping("admin/updateShiYan.do")
	public String updateShiYan(	HttpServletRequest request,ShiYan ShiYan){
		ShiYanService.update(ShiYan);
		return "redirect:ShiYanList.do";
	}
//	分页查询
	@RequestMapping("admin/ShiYanList.do")
	public String shiYanList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		Map<String, Object> cmap=new HashMap<String, Object>();
		pmap.put("name", null);
		cmap.put("name", null);
		cmap.put("ftype", "实验室");
		pmap.put("ftype", "实验室");
		int total=ShiYanService.getCount(cmap);
		pageBean.setTotal(total);
		List<ShiYan> list=ShiYanService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "admin/list_ShiYan";
	}
//   分页模糊查询
	@RequestMapping("admin/vagueShiYanList.do")
	public String vagueShiYanList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,ShiYan cd){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page),PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		Map<String, Object> cmap=new HashMap<String,Object>();
       if(cd.getName()!=null&&!cd.getName().equals("")){
			cmap.put("name", cd.getName());
			pmap.put("name", cd.getName());
		}
        cmap.put("ftype", "实验室");
		pmap.put("ftype", "实验室");
		int total=ShiYanService.getCount(cmap);
		pageBean.setTotal(total);
		List<ShiYan> list=ShiYanService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 2);
		return "admin/list_ShiYan";
	}
	@RequestMapping("admin/deleteShiYan.do")
	public String deleteShiYan(int id){
		ShiYanService.delete(id);
		return "redirect:ShiYanList.do";
	}
	
	
	
//	设备管理
	@RequestMapping("admin/addSheBei.do")
	public String addSheBei(ModelMap map,ShiYan shiYan,HttpServletRequest request){
		Timestamp time=new Timestamp(System.currentTimeMillis());
		shiYan.setFtype("设备");
		shiYan.setMstatus("充足");
		shiYan.setIsdel("1");
		shiYan.setPubtime(time.toString().substring(0, 19));
		ShiYanService.add(shiYan);
		return "redirect:SheBeiList.do";
	}
	@RequestMapping("admin/doUpdateSheBei.do")
	public String doUpdateSheBei(ModelMap map,int id){
		map.put("sy", ShiYanService.getById(id));
		return "admin/update_SheBei";
	}
//	处理申请设备
	
		@RequestMapping("admin/doAddForderSheBei.do")
	public String doAddForderSheBei(ModelMap map,int id){
		map.put("sy", ShiYanService.getById(id));
		return "admin/add_order_sheBei";
	}
		
//		处理申请耗材
		@RequestMapping("admin/doAddForderHaoCai.do")
		public String doAddForderHaoCai(ModelMap map,int id){
			map.put("sy", ShiYanService.getById(id));
			return "admin/add_order_haoCai";
		}
		
	@RequestMapping("admin/updateSheBei.do")
	public String updateSheBei(HttpServletRequest request,ShiYan ShiYan){
		ShiYanService.update(ShiYan);
		return "redirect:SheBeiList.do";
	}
//	分页查询
	@RequestMapping("admin/SheBeiList.do")
	public String sheBeiList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		Map<String, Object> cmap=new HashMap<String, Object>();
		cmap.put("ftype", "设备");
		pmap.put("ftype", "设备");
		int total=ShiYanService.getCount(cmap);
		pageBean.setTotal(total);
		List<ShiYan> list=ShiYanService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "admin/list_SheBei";
	}
//   分页模糊查询
	@RequestMapping("admin/vagueSheBeiList.do")
	public String vagueSheBeiList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,ShiYan cd){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page),PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		Map<String, Object> cmap=new HashMap<String,Object>();
       if(cd.getName()!=null&&!cd.getName().equals("")){
			cmap.put("name", cd.getName());
			pmap.put("name", cd.getName());
		}
        cmap.put("ftype", "设备");
		pmap.put("ftype", "设备");
		int total=ShiYanService.getCount(cmap);
		pageBean.setTotal(total);
		List<ShiYan> list=ShiYanService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 2);
		return "admin/list_SheBei";
	}
	@RequestMapping("admin/deleteSheBei.do")
	public String deleteSheBei(int id){
		ShiYanService.delete(id);
		return "redirect:SheBeiList.do";
	}
	
	
	
//	耗材管理
	@RequestMapping("admin/addHaoCai.do")
	public String addHaoCai(ModelMap map,ShiYan shiYan,HttpServletRequest request){
		Timestamp time=new Timestamp(System.currentTimeMillis());
		shiYan.setFtype("耗材");
		shiYan.setMstatus("充足");
		shiYan.setIsdel("1");
		shiYan.setPubtime(time.toString().substring(0, 19));
		ShiYanService.add(shiYan);
		return "redirect:HaoCaiList.do";
	}
	@RequestMapping("admin/doUpdateHaoCai.do")
	public String doUpdateHaoCai(ModelMap map,int id){
		map.put("sy", ShiYanService.getById(id));
		return "admin/update_HaoCai";
	}
	@RequestMapping("admin/updateHaoCai.do")
	public String updateHaoCai(HttpServletRequest request,ShiYan ShiYan){
		ShiYanService.update(ShiYan);
		return "redirect:HaoCaiList.do";
	}
//	分页查询
	@RequestMapping("admin/HaoCaiList.do")
	public String haoCaiList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		Map<String, Object> cmap=new HashMap<String, Object>();
		pmap.put("ftype", null);
		cmap.put("name", null);
		cmap.put("ftype", "耗材");
		pmap.put("ftype", "耗材");
		int total=ShiYanService.getCount(cmap);
		pageBean.setTotal(total);
		List<ShiYan> list=ShiYanService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "admin/list_HaoCai";
	}
//   分页模糊查询
	@RequestMapping("admin/vagueHaoCaiList.do")
	public String vagueHaoCaiList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,ShiYan cd){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page),PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		Map<String, Object> cmap=new HashMap<String,Object>();
       if(cd.getName()!=null&&!cd.getName().equals("")){
			cmap.put("name", cd.getName());
			pmap.put("name", cd.getName());
		}
        cmap.put("ftype", "耗材");
		pmap.put("ftype", "耗材");
		int total=ShiYanService.getCount(cmap);
		pageBean.setTotal(total);
		List<ShiYan> list=ShiYanService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 2);
		return "admin/list_HaoCai";
	}
	@RequestMapping("admin/deleteHaoCai.do")
	public String deleteHaoCai(int id){
		ShiYanService.delete(id);
		return "redirect:HaoCaiList.do";
	}
}

实验室设备管理控制层:

@Controller
public class ForderController {
	@Resource
	private ForderServer orderService;
	@Resource
	private SysuserServier userService;
	@Resource
	private ShiYanServer shiYanService;
	

//	文件上传
	public String fileUpload(@RequestParam(value="file",required=false)MultipartFile file,
			HttpServletRequest request,String img){
		String path=request.getSession().getServletContext().getRealPath("upload");
		System.out.println("path==="+path);
		System.out.println("file==="+file);
		String fileName=file.getOriginalFilename();
		System.out.println("fileName==="+fileName);
		File targetFile=new File(path,fileName);
		if(!targetFile.exists()){
			targetFile.mkdirs();
		}
		try {
			file.transferTo(targetFile);
		} catch (IllegalStateException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String pa=request.getContextPath()+"/upload/"+fileName;
		System.out.println("path==="+pa);
		if(fileName!=null&&!fileName.equals("")){
			img=fileName;
		}else{
			img=null;	
		}
		return img;
		
	}
	/*实验室*/
//	分页查询
	@RequestMapping("admin/shiYanShiForderList.do")
	public String shiYanShiList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		if(u==null){
			return "admin/login";
		}else{
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		Map<String, Object> cmap=new HashMap<String,Object>();
		/*Map<String, Object> smap=new HashMap<String,Object>();*/
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		if(u.getUtype().equals("管理员")){
			pmap.put("uid",null);
			cmap.put("uid",null);
		}else{
			pmap.put("uid",u.getUid());
			cmap.put("uid",u.getUid());
		}
		pmap.put("etime","实验室");
		cmap.put("etime","实验室");
		/*smap.put("stime", "实验室");*/
		int total=orderService.getCount(cmap);
		pageBean.setTotal(total);
		List<Forder> list=orderService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		map.put("ulist", userService.getAll(null));
		map.put("slist", shiYanService.getAll(null));
		session.setAttribute("p", 1);
		return "admin/list_order_shiYanShi";
		}
	}
	
//		归还
		@RequestMapping("admin/guiHuan.do")
		public String guiHuan(HttpServletRequest request,Forder yp,ModelMap map,HttpSession session,int id){
			Sysuser u=(Sysuser)session.getAttribute("auser");
			/*Timestamp time=new Timestamp(System.currentTimeMillis());*/
			if(u==null){
				return "admin/login";
			}else{
				Forder syso=orderService.getById(id);
				syso.setIsdel("0");
				syso.setKid(id);
				orderService.update(syso);
				ShiYan sy=shiYanService.getById(syso.getFid());
				sy.setMstatus("空闲中");
				sy.setId(syso.getFid());
				shiYanService.update(sy);
				/*map.put("etime", "实验室");
				map.put("fid", syso.getFid());
				List<Forder> list=orderService.getByPage(map);
				for(Forder o:list){
					if(!o.getKid().equals(id)){
						Forder fo=orderService.getById(o.getKid());
						fo.setStatus("审核失败");
						fo.setKid(id);
						orderService.update(fo);
					}
				}*/
				return "success";
			}

		}
//	申请通过
	@RequestMapping("admin/tongGuoSYS.do")
	public String tongGuoSYS(HttpServletRequest request,Forder yp,ModelMap map,HttpSession session,int id){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		/*Timestamp time=new Timestamp(System.currentTimeMillis());*/
		if(u==null){
			return "admin/login";
		}else{
			Forder syso=orderService.getById(id);
			syso.setStatus("审核通过");
			syso.setKid(id);
			orderService.update(syso);
			ShiYan sy=shiYanService.getById(syso.getFid());
			sy.setMstatus("已预订");
			sy.setId(syso.getFid());
			shiYanService.update(sy);
			map.put("etime", "实验室");
			map.put("fid", syso.getFid());
			List<Forder> list=orderService.getByPage(map);
			for(Forder o:list){
				if(!o.getKid().equals(id)){
					Forder fo=orderService.getById(o.getKid());
					fo.setStatus("审核失败");
					fo.setKid(id);
					orderService.update(fo);
				}
			}
			return "success";
		}

	}
//	申请不通过
	@RequestMapping("admin/buTongGuoSYS.do")
	public String buTongGuoSYS(HttpServletRequest request,Forder yp,HttpSession session,int id){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		//Timestamp time=new Timestamp(System.currentTimeMillis());
		if(u==null){
			return "admin/login";
		}else{
			Forder f=orderService.getById(id);
			f.setStatus("审核失败");
			f.setKid(id);
			orderService.update(f);
			return "success";
		}

	}
//	申请
	@RequestMapping("admin/shenQin.do")
	public String addForder(HttpServletRequest request,Forder yp,HttpSession session,int id){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		Timestamp time=new Timestamp(System.currentTimeMillis());
		if(u==null){
			return "admin/login";
		}else{
			yp.setUid(u.getUid());
			yp.setStatus("待审核");
			yp.setIsdel("1");
			yp.setFid(id);
			yp.setEtime("实验室");
			yp.setPubtime(time.toString().substring(0, 19));
			orderService.add(yp);
			return "success";
		}

	}
	
   /*设备管理*/
//	分页查询
	@RequestMapping("admin/sheBeiForderList.do")
	public String sheBeiForderList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		if(u==null){
			return "admin/login";
		}else{
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		Map<String, Object> cmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		if(u.getUtype().equals("管理员")){
			pmap.put("uid",null);
			cmap.put("uid",null);
		}else{
			pmap.put("uid",u.getUid());
			cmap.put("uid",u.getUid());
		}
		pmap.put("etime","设备");
		cmap.put("etime","设备");
		int total=orderService.getCount(cmap);
		pageBean.setTotal(total);
		List<Forder> list=orderService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		map.put("ulist", userService.getAll(null));
		map.put("slist", shiYanService.getAll(null));
		session.setAttribute("p", 1);
		return "admin/list_order_sheBei";
		}
	}	
	
//	添加设备申请
	@RequestMapping("admin/addForderSheBei.do")
	public String addForderSheBei(HttpServletRequest request,Forder yp,HttpSession session){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		Timestamp time=new Timestamp(System.currentTimeMillis());
		if(u==null){
			return "admin/login";
		}else{
			ShiYan syy=shiYanService.getById(yp.getFid());
			if(syy.getSnum()<yp.getSnum()){
				return "admin/error";
			}else{
				//syy.setSnum(syy.getSnum()-yp.getSnum());
				syy.setId(yp.getFid());
				shiYanService.update(syy);
				yp.setUid(u.getUid());
				yp.setStatus("待审核");
				yp.setIsdel("1");
				yp.setEtime("设备");
				yp.setPubtime(time.toString().substring(0, 19));
				orderService.add(yp);
				return "success";
			}
			
		}

	}
	
//	申请不通过
	@RequestMapping("admin/buTongGuoShenBei.do")
	public String buTongGuoShenBei(HttpServletRequest request,Forder yp,HttpSession session,int id){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		
		if(u==null){
			return "admin/login";
		}else{
			Forder f=orderService.getById(id);
			f.setStatus("审核失败");
			f.setKid(id);
			
			orderService.update(f);
			return "success";
		}
	}
	
//	申请通过
	@RequestMapping("admin/tongGuoShenBei.do")
	public String tongGuoShenBei(HttpServletRequest request,Forder yp,HttpSession session,int id){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		if(u==null){
			return "admin/login";
		}else{
			Forder f=orderService.getById(id);
			ShiYan syy=shiYanService.getById(f.getFid());
			syy.setSnum(syy.getSnum()-f.getSnum());
			shiYanService.update(syy);
			f.setStatus("审核成功");
			f.setKid(id);
			orderService.update(f);
			return "success";
		}
	}
	
	/*耗材*/
//	分页查询
	@RequestMapping("admin/haoCaiForderList.do")
	public String haoCaiForderList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		if(u==null){
			return "admin/login";
		}else{
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		Map<String, Object> cmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		if(u.getUtype().equals("管理员")){
			pmap.put("uid",null);
			cmap.put("uid",null);
		}else{
			pmap.put("uid",u.getUid());
			cmap.put("uid",u.getUid());
		}
		pmap.put("etime","耗材");
		cmap.put("etime","耗材");
		int total=orderService.getCount(cmap);
		pageBean.setTotal(total);
		List<Forder> list=orderService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		map.put("ulist", userService.getAll(null));
		map.put("slist", shiYanService.getAll(null));
		session.setAttribute("p", 1);
		return "admin/list_order_haoCai";
		}
	}	
//	申请耗材
	@RequestMapping("admin/addForderHaoCai.do")
	public String addForderHaoCai(HttpServletRequest request,Forder yp,HttpSession session){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		Timestamp time=new Timestamp(System.currentTimeMillis());
		if(u==null){
			return "admin/login";
		}else{
			ShiYan syy=shiYanService.getById(yp.getFid());
			if(syy.getSnum()<yp.getSnum()){
				return "admin/error";
			}else{
				//syy.setSnum(syy.getSnum()-yp.getSnum());
				syy.setId(yp.getFid());
				shiYanService.update(syy);
				yp.setUid(u.getUid());
				yp.setStatus("待审核");
				yp.setIsdel("1");
				yp.setEtime("耗材");
				yp.setPubtime(time.toString().substring(0, 19));
				orderService.add(yp);
				return "success";
			}
		}

	}
	
//	申请不通过
	@RequestMapping("admin/buTongGuoHaoCai.do")
	public String buTongGuoHaoCai(HttpServletRequest request,Forder yp,HttpSession session,int id){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		if(u==null){
			return "admin/login";
		}else{
			Forder f=orderService.getById(id);
			f.setStatus("审核失败");
			f.setKid(id);
			orderService.update(f);
			return "success";
		}
	}
	
//	申请通过
	@RequestMapping("admin/tongGuoHaoCai.do")
	public String tongGuoHaoCai(HttpServletRequest request,Forder yp,HttpSession session,int id){
		Sysuser u=(Sysuser)session.getAttribute("auser");
		if(u==null){
			return "admin/login";
		}else{
			Forder f=orderService.getById(id);
			ShiYan syy=shiYanService.getById(f.getFid());
			syy.setSnum(syy.getSnum()-f.getSnum());

			shiYanService.update(syy);
			f.setStatus("审核成功");
			f.setKid(id);
			orderService.update(f);
			return "success";
		}
	}
	
//	查询统计
	@RequestMapping("admin/forderTongJiList.do")
	public String forderTongJiList(ModelMap map,HttpSession session,Forder order,String etime1,String stime1){
		System.out.println("stime1==="+stime1);
		System.out.println("etime1==="+etime1);
		System.out.println("etime==="+order.getStime());
		Map<String, Object> pmap=new HashMap<String,Object>();
		if(order.getStime()!=null&&!order.getStime().equals("")){
			pmap.put("etime",order.getStime());
		}
		pmap.put("stime1",stime1);
		pmap.put("etime1",etime1);
        List<TongJi> list=orderService.getTongJi(pmap);	
        System.out.println("list===="+list);
        for(TongJi tj:list){
        	System.out.println("name==="+tj.getName()+"amount==="+tj.getAmount());
        }
		map.put("list", list);
		map.put("etime1", etime1);
		map.put("stime1", stime1);
		session.setAttribute("p", 1);
		return "admin/list_order_tongji";
	}	
	

	@RequestMapping("admin/deleteForder.do")
	public String deleteForder(int id){
		orderService.delete(id);
		return "success";
	}
}

源码获取:俺的博客首页 "资源" 里下载!

猜你喜欢

转载自blog.csdn.net/pastclouds/article/details/125296267