Java项目:旅游综合服务管理系统(java+SSM+JSP+bootstrap+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项目:否;

技术栈

1. 后端:Spring+SpringMVC+Mbytes
2. 前端:JSP+css+javascript+bootstrap+jQuery

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中config-jdbc.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入localhost:8080/ssm_lvyou_fuwu

 

 

 

 

 

房间管理控制层:

@Controller
@RequestMapping("/room")
public class RoomController {
	private RoomService roomService;

	public RoomService getRoomService() {
		return roomService;
	}

	@Autowired
	public void setRoomService(RoomService roomService) {
		this.roomService = roomService;
	}

	@Autowired
	private HttpServletRequest request;
	@Autowired
	private HttpServletResponse response;

	@SuppressWarnings("finally")
	@RequestMapping("/add")
	public String add() {
		return "admin/addroom";
	}
	
	@SuppressWarnings("finally")
	@RequestMapping("/room_add")
	public String add(Room r) {
		Map<String,Object> map = new HashMap<String,Object>();
		try {
			System.out.println(r);
			String id=request.getParameter("id").trim().length()==0?"0":request.getParameter("id");
			String tv=r.getTv()==null?"无":"有";
			String kt=r.getKongtiao()==null?"无":"有";
			r.setHotelId(Integer.parseInt(request.getParameter("hid")));
			r.setTv(tv);
			r.setKongtiao(kt);
			r.setId(Integer.parseInt(id));
			int count=0;
			if(r.getId()==0)
				count = roomService.Add(r);
			else
				count=roomService.Edit(r);
			if(count>0)
			{
				map.put("mgf", "操作成功");
				map.put("success", true);
			}
			else
			{
				map.put("mgf", "操作失败");
				map.put("success", false);
			}
		} catch (Exception e) {
			map.put("mgf", "错误:"+e.getMessage());
			map.put("success", false);
		} 
		String result = new JSONObject(map).toString();
		ResponseUtil.write(response, result);
		return null;
	}

	@RequestMapping("/room_list")
	public String GetByHotelID() {
		try {
			
			int hid=Integer.parseInt(request.getParameter("hid"));
			List<Room> list = roomService.GetByHotelID(hid);
			System.out.println(list);
			request.setAttribute("list", list);
			return "admin/room";
		} catch (Exception e) {
			return null;
		}
		
	}
	
	@RequestMapping("/web_list")
	public String GetByHotelID2() {
		try {
			
			int hid=Integer.parseInt(request.getParameter("hid"));
			List<Room> list = roomService.GetByHotelID(hid);
			System.out.println(list);
			request.setAttribute("list", list);
			return "room";
		} catch (Exception e) {
			return null;
		}
		
	}
	
	@RequestMapping("/room_messhow")
	public String GetByID() {
		try {
			int id=Integer.parseInt(request.getParameter("id"));
			Room r = roomService.GetByID(id);
			request.setAttribute("room", r);
			return "admin/addroom";
		} catch (Exception e) {
			return null;
		}
	}
	
	@SuppressWarnings("finally")
	@RequestMapping(value="/room_del", method = RequestMethod.POST)
	public String Del(@RequestParam(value = "id") String id,
			@RequestParam(value = "hid") String hid) {
		
		Map<String,Object> map = new HashMap<String,Object>();
		try {
			System.out.println("================================");
			System.out.println(id);
			//int id=Integer.parseInt(request.getParameter("id"));
			
			int r = roomService.Del(Integer.parseInt(id),Integer.parseInt(hid));
			
			if(r>0)
			{
				map.put("mgf", "删除成功");
				map.put("success", true);
			}
			else
			{
				map.put("mgf", "删除失败");
				map.put("success", false);
			}
		} catch (Exception e) {
			map.put("mgf", "错误:"+e.getMessage());
			map.put("success", false);
		} 
		String result = new JSONObject(map).toString();
		ResponseUtil.write(response, result);
		return null;
	}
	
	
}

管理员管理控制层: 

@Controller
public class AdminController {
	private AdminService adminService;
	@Autowired
	private IntroduceService introduceService;
	@Autowired
	private JinService jinService;
	@Autowired
	private LineService lineService;
	@Autowired
	private QiuTypeService qiutypeService;
 

	public AdminService getAdminService() {
		return adminService;
	}

	@Autowired
	public void setAdminService(AdminService adminService) {
		this.adminService = adminService;
	}

	@Autowired
	private HttpServletRequest request;
	@Autowired
	private HttpServletResponse response;
	

	
	
	@RequestMapping("login")
	public String Login(Admin admin) {
		Map<String,Object> map = new HashMap<String,Object>();
		try {
			Admin a = adminService.Login(admin.getLogin());
			System.out.println(admin);
			if(a==null)
			{
				map.put("mgf", "用户不存在");
				map.put("success", false);
			}
			else if(!a.getPwd().equals(admin.getPwd()))
			{
				map.put("mgf", "密码错误");
				map.put("success", false);
			}
			else
			{
				request.getSession().setAttribute("admin", a);
				map.put("mgf", "验证通过!");
				map.put("success", true);
			}
		} catch (Exception e) {
			map.put("mgf", "错误:"+e.getMessage());
			map.put("success", false);
		} 
		String result = new JSONObject(map).toString();
		ResponseUtil.write(response, result);
		return null;
	}

	
	@RequestMapping("/exit")
	public String Exit() {
		Map<String,Object> map = new HashMap<String,Object>();
		try {
			request.getSession().removeAttribute("admin");
			map.put("mgf", "已安全退出!");
			map.put("success", true);
		} catch (Exception e) {
			map.put("mgf", "错误:"+e.getMessage());
			map.put("success", false);
		} 
		String result = new JSONObject(map).toString();
		ResponseUtil.write(response, result);
		return null;
	}
	
	@RequestMapping("/tui")
	public String tui(Model model) {
		Pages p=new Pages();
		p.setPagesize(6);
		Jin j=new Jin();
		j.setPage(p);
		Line l=new Line();
		l.setPage(p);
		List<Jin> jin = jinService.Get(j);
		Introduce intr = introduceService.GetByID(1);
		List<Line> ls = lineService.Get(l);
		model.addAttribute("jin", jin);
		model.addAttribute("intr", intr);
		request.getSession().setAttribute("left_line", ls);
		request.getSession().setAttribute("top_qiutype", qiutypeService.Get());
		return "index";
	}
}

酒店管理控制层:

@Controller
@RequestMapping("/hotel")
public class HotelController {
	private HotelService hotelService;

	public HotelService getHotelService() {
		return hotelService;
	}

	@Autowired
	public void setHotelService(HotelService hotelService) {
		this.hotelService = hotelService;
	}

	@Autowired
	private HttpServletRequest request;
	@Autowired
	private HttpServletResponse response;

	@SuppressWarnings("finally")
	@RequestMapping("/add")
	public String add() {
		return "admin/addhotel";
	}
	
	@SuppressWarnings("finally")
	@RequestMapping("/hotel_add")
	public String add(Hotel h) {
		Map<String,Object> map = new HashMap<String,Object>();
		try {
			System.out.println(h);
			String id=request.getParameter("id").trim().length()==0?"0":request.getParameter("id");
			h.setId(Integer.parseInt(id));
			int count=0;
			if(h.getId()==0)
				count = hotelService.Add(h);
			else
				count=hotelService.Edit(h);
			if(count>0)
			{
				map.put("mgf", "操作成功");
				map.put("success", true);
			}
			else
			{
				map.put("mgf", "操作失败");
				map.put("success", false);
			}
		} catch (Exception e) {
			map.put("mgf", "错误:"+e.getMessage());
			map.put("success", false);
		} 
		String result = new JSONObject(map).toString();
		ResponseUtil.write(response, result);
		return null;
	}

	@RequestMapping("/hotel_list")
	public String Get(Hotel h) {
		//分页参数设置
		Pages p=new Pages();
		p.setPagesize(10);//每页显示数量 
		int startindex=request.getParameter("startindex")==null?0:Integer.parseInt(request.getParameter("startindex"));//起始页,默认从第1页开始读
		p.setStartindex(startindex);
		h.setPage(p);
		try {
			List<Hotel> list = hotelService.Get(h);
			System.out.println(list);
			request.setAttribute("list", list);
			//分页
			request.setAttribute("pages", PageList.Page(request,"hotel/hotel_list.do", hotelService.GetCount(h), 
					p.getPagesize(), p.getStartindex(),request.getQueryString()));
			return "admin/hotel";
		} catch (Exception e) {
			return null;
		}
		
	}
	
	@RequestMapping("/web_list")
	public String Get2(Hotel h) {
		//分页参数设置
		Pages p=new Pages();
		p.setPagesize(10);//每页显示数量 
		int startindex=request.getParameter("startindex")==null?0:Integer.parseInt(request.getParameter("startindex"));//起始页,默认从第1页开始读
		p.setStartindex(startindex);
		h.setPage(p);
		try {
			List<Hotel> list = hotelService.Get(h);
			System.out.println(list);
			request.setAttribute("list", list);
			//分页
			request.setAttribute("pages", PageList.Page(request,"hotel/hotel_list.do", hotelService.GetCount(h), 
					p.getPagesize(), p.getStartindex(),request.getQueryString()));
			return "hotel";
		} catch (Exception e) {
			return null;
		}
		
	}
	
	@RequestMapping("/hotel_messhow")
	public String GetByID() {
		try {
			int id=Integer.parseInt(request.getParameter("id"));
			Hotel h = hotelService.GetByID(id);
			request.setAttribute("hotel", h);
			return "admin/addhotel";
		} catch (Exception e) {
			return null;
		}
	}
	
	@SuppressWarnings("finally")
	@RequestMapping(value="/hotel_del", method = RequestMethod.POST)
	public String Del(@RequestParam(value = "id") int id) {
		
		Map<String,Object> map = new HashMap<String,Object>();
		try {
			System.out.println("================================");
			System.out.println(id);
			//int id=Integer.parseInt(request.getParameter("id"));
			
			int r = hotelService.Del(id);
			
			if(r>0)
			{
				map.put("mgf", "删除成功");
				map.put("success", true);
			}
			else
			{
				map.put("mgf", "删除失败");
				map.put("success", false);
			}
		} catch (Exception e) {
			map.put("mgf", "错误:"+e.getMessage());
			map.put("success", false);
		} 
		String result = new JSONObject(map).toString();
		ResponseUtil.write(response, result);
		return null;
	}
	
	
}

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

OldWinePot

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值