基于javaweb+mysql的ssm+maven旅游管理系统(前台、后台)(java+jsp+ssm+maven+mysql)

该系统是一个使用JavaWeb技术栈开发的旅游管理系统,包括SSM(Spring、SpringMVC、MyBatis)框架,结合Maven进行构建。功能涵盖用户登录注册、景点和酒店管理、论坛互动等,支持管理员和用户的不同操作,如内容发布、评论和搜索。系统实现了文件上传,并对上传的图片进行处理和存储。
摘要由CSDN通过智能技术生成

基于javaweb+mysql的ssm+maven旅游管理系统(前台、后台)(java+jsp+ssm+maven+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

分为前台用户和后台管理员功能

管理员

  • 登录、管理用户、管理景点、管理酒店、管理论坛帖子、管理评论等

用户端

  • 登录、注册、景点、酒店、论坛、评论等功能的浏览和评论等

idea运行/eclipse/MyEclipse运行

前台

后台

技术框架

JavaBean MVC JSP SSM(Spring SpringMVC MyBatis) Maven MySQL jQuery JavaScript CSS

基于javaweb+mysql的SSM+Maven旅游管理系统(前台、后台)(java+jsp+ssm+maven+mysql)

			//全路径
			hotel.setImgUrl(prefix + suffix);
		}
		//传送景点
		model.addAttribute("hotels", hotels);
		return "proscenium/hotel/index";
	}

	/**
	 * 跳转首页
	 */
	@RequestMapping(value = "content", method = RequestMethod.GET)
	public String content(Integer hid, Model model) {

		//封装留言信息
		List<Words> lw_list = viewPointService.findByWords();
		model.addAttribute("lw_list",lw_list);

		//封装回复信息
		List<Reply> lr_list = viewPointService.findByReply();
		model.addAttribute("lr_list",lr_list);

		Hotel hotel = hotelDao.selectByPrimaryKey(hid);
		model.addAttribute("hotel", hotel);

		return "proscenium/hotel/content";
	}

	/**
	 * 钱台酒店模糊搜索
	 */
	@RequestMapping(value = "hotelPointSearch", method = RequestMethod.GET)
	public String hotelPointSearch(String keyword, Model model) {
		String prefix = "/static/upload/hotelAvatar/";

		Hotel hotel = new Hotel();

		hotel.setLocal(keyword);
		hotel.setHouseType(keyword);
		hotel.setBedType(keyword);

		List<Hotel> hotels = hotelDao.hotelPointSearch(hotel);

		for (Hotel hotelForEach : hotels){
			String imgUrl = hotelForEach.getImgUrl();
			hotelForEach.setImgUrl(prefix + imgUrl);
		}
	}

	/**
	 * 跳转到论坛
	 */

	@RequestMapping(value="/toForumArticleView")
	public String toForumArticleView(@RequestParam int tpFid, Model model){
		//封装留言信息
		lw_list = viewPointService.findByWords();
		model.addAttribute("lw_list",lw_list);

		//封装回复信息
		lr_list = viewPointService.findByReply();
		model.addAttribute("lr_list",lr_list);

		//查询文章信息
		Forum forum = forumDao.selectByPrimaryKey(tpFid);

		System.out.println("查询到当前文章的ID值:" + forum.getTpFid());

		if (forum != null) {
			model.addAttribute("forum", forum);
			return "proscenium/forum/content";
		} else {
			return null;
		}
	}

	/**
	 * 保存论坛回复信息
	 */
	@RequestMapping(value="/saveHotelReply")
	public String saveHotelReply(Reply reply){
		if(reply != null){
			viewPointService.saveReply(reply);
			String hid = reply.getLr_hotel_id();
			return "redirect:toHotelArticleView.do?hid=" + hid;
		}else{
			return null;
		}
	}

	/**
	 * 保存论坛留言信息
	 */
	@RequestMapping(value="/saveHotelWords")
	private ForumDao forumDao;
	@Autowired
	private ForumExample example;

	/**
	 * index页用户登录
	 */
	@RequestMapping(value = "login", method = RequestMethod.POST)
	public String userLogin(String uemail, String upwd, Model model) {
		//index页面登录成功图片显示路径
		String prefix = "/static/upload/useravatar/";
		//index页用户登录验证
		if (uemail == null || uemail == "" || upwd == null || upwd == "") {
			session.setAttribute("msg", Msg.fail("邮箱或密码不可为空!"));
			return "redirect:/index";
		}
		User user = userService.userLogin(new User(uemail, upwd));
		if (user != null) {
			String suffix = user.getUpic();
			user.setUpic(prefix+suffix);
			session.setAttribute("user", user);
			return "redirect:/index";
		} else {
			session.setAttribute("msg", Msg.fail("还未注册或邮箱密码错误,请重新输入!"));
			return "redirect:/index";
		}

	}

	/**
	 * 前台用户注销
	 *
	 * @return
	 */
	@RequestMapping(value = "loginout", method = RequestMethod.GET)
	public String loginOut() {
		session.invalidate();
		return "redirect:/index";
	}

	/**
	 * 跳转注册用户
	 *
	 * @return
	 */
	@RequestMapping(value = "regst", method = RequestMethod.GET)
	public String regst() {
		return "proscenium/user/regst";
		//index页用户登录验证
		if (uemail == null || uemail == "" || upwd == null || upwd == "") {
			session.setAttribute("msg", Msg.fail("邮箱或密码不可为空!"));
			return "redirect:/index";
		}
		User user = userService.userLogin(new User(uemail, upwd));
		if (user != null) {
			String suffix = user.getUpic();
			user.setUpic(prefix+suffix);
			session.setAttribute("user", user);
			return "redirect:/index";
		} else {
			session.setAttribute("msg", Msg.fail("还未注册或邮箱密码错误,请重新输入!"));
			return "redirect:/index";
		}

	}

	/**
	 * 前台用户注销
	 *
	 * @return
	 */
	@RequestMapping(value = "loginout", method = RequestMethod.GET)
	public String loginOut() {
		session.invalidate();
		return "redirect:/index";
	}

	/**
	 * 跳转注册用户
	 *
	 * @return
	 */
	@RequestMapping(value = "regst", method = RequestMethod.GET)
	public String regst() {
		return "proscenium/user/regst";
	}

	@RequestMapping(value = "regstform", method = RequestMethod.POST)
	public String regst(String uname, String uemail, String upwd, String reupwd, Model model) {
		if (uemail == null || upwd == null || uemail.trim().equals("") || upwd.trim().equals("")) {
			model.addAttribute("msg", Msg.fail("用户名或密码不可为空,请重新输入!"));
		} else if (!reupwd.equals(upwd)) {
			model.addAttribute("msg", Msg.fail("密码不正确请重新输入!"));
		} else {
			userService.insertUser(uname, uemail, upwd);
			model.addAttribute("msg", Msg.success("用户注册成功!"));
		}
		System.out.println(!uemail.trim().equals(""));
		return "proscenium/user/regst";
	}
		File file = new File(realPath);
		//判断文件是否存在
		if (!file.exists()){
			file.mkdir();
		}
		file = new File(realPath,UUID.randomUUID() + fileSuffix);
		try {
			dropFile.transferTo(file);
		} catch (IOException e) {
			e.printStackTrace();
		}
		result.put("fileName",file.getName());
		return result;
	}

	/**
	 * 后台内容图片上传
	 * @param dropFile
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "hotelContentUpload", method = RequestMethod.POST)
	public Map<String, Object> hotelContentUpload(MultipartFile dropFile, HttpServletRequest request) {
		Map<String, Object> result = new HashMap<>();
		//前缀路径 Scheme服务端提供的协议 getServerName服务器名称 port 端口
		//String server = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();

		//图片显示路径
		String prefix = "/static/upload/hotelFile/";

		//获取文件后缀
		String fileName = dropFile.getOriginalFilename();
		String fileSuffix = fileName.substring(fileName.lastIndexOf('.'));

		//文件存放路径
		String realPath = request.getSession().getServletContext().getRealPath(prefix);

		File file = new File(realPath);
		//判断文件是否存在
		if (!file.exists()){
			file.mkdir();
		}
		file = new File(realPath, UUID.randomUUID() + fileSuffix);
	@Autowired
	private WordsDao wordsDao;
	@Autowired
	private ReplyDao replyDao;

	/**
	 * **********login start***************
	 * 从前端跳转到后台登录
	 */
	@RequestMapping(value = "login", method = RequestMethod.GET)
	public String login() {
		return "admin/login";
	}

	/**
	 * 登录逻辑
	 * handle
	 *
	 * @param aemail 用户邮箱
	 * @param apwd   密码
	 * @return String
	 */
	@RequestMapping(value = "login", method = RequestMethod.POST)
	// @RequestParam(required = true) 为true时意思为不可缺省
	public String login(String aemail, String apwd, HttpSession session) {
		Admin admin = adminService.login(aemail, apwd);
		String timestamp = TimeStampUtil.getTimeFormat();

		//登录失败
		if (admin == null) {
			session.setAttribute("msg", Msg.fail("邮箱或者密码错误!"));
			return login();
		}
		//登录成功
		else {

			// 将登录信息放入session
			session.setAttribute("msg", Msg.success());
			session.setAttribute("timestamp", timestamp);
			session.setAttribute("admin", admin);
			// 明日任务,获取域对象传送user信息
			return "redirect:main";
		}
	}

	/**
	 * 后台注销
	 */
	@RequestMapping(value = "loginout", method = RequestMethod.GET)
	public String loginOut(HttpSession session) {

/**
 * 文件上传控制器
 */
@RequestMapping(value = "upload")
@Controller
public class UploadController {
	@Autowired
	private UserService userService;
	@Autowired
	private ViewPointService viewPointService;

	/**
	 * 文件上传
	 * @param dropFile
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "viewAvatar", method = RequestMethod.POST)
	public Map<String, Object> viewAvatar(MultipartFile dropFile, HttpServletRequest request) {
		Map<String, Object> result = new HashMap<>();
		//文件存放路径
		String filePath = "/static/upload/viewavatar/";
		//获取文件后缀
		String fileName = dropFile.getOriginalFilename();
		String fileSuffix = fileName.substring(fileName.lastIndexOf('.'));
		//文件存放路径
		String realPath = request.getSession().getServletContext().getRealPath(filePath);
		File file = new File(realPath);
		//判断文件是否存在
		if (!file.exists()){
			file.mkdir();
			return "proscenium/forum/edit";
		}
		example.setOrderByClause("tp_fid desc");
		List<Forum> forums = forumDao.selectByExampleWithBLOBs(example);
		model.addAttribute("forums",forums);
		model.addAttribute("msg", Msg.fail("您还未登录!"));
		return "proscenium/forum/index";
	}

	/**
	 * 编辑页面
	 */
	@RequestMapping(value = "edit", method = RequestMethod.GET)
	public String edit(Integer uid, Model model){
		if (uid != null){
			return "proscenium/forum/edit";
		}
		model.addAttribute("msg", Msg.fail("您还未登录!"));
		return "redirect:index";
	}

	/**
	 * content
	 */
	@RequestMapping(value = "savecontent", method = RequestMethod.POST)
	public String saveContent(Forum forum, Model model){
		forumDao.insert(forum);
		model.addAttribute("msg", Msg.success("发帖成功"));
		return "redirect:index";
	}

	/*############后台开始##############*/

}
package com.demo.controller;

	 * 编辑页面
	 */
	@RequestMapping(value = "edit", method = RequestMethod.GET)
	public String edit(Integer uid, Model model){
		if (uid != null){
			return "proscenium/forum/edit";
		}
		model.addAttribute("msg", Msg.fail("您还未登录!"));
		return "redirect:index";
	}

	/**
	 * content
	 */
	@RequestMapping(value = "savecontent", method = RequestMethod.POST)
	public String saveContent(Forum forum, Model model){
		forumDao.insert(forum);
		model.addAttribute("msg", Msg.success("发帖成功"));
		return "redirect:index";
	}

	/*############后台开始##############*/

}
package com.demo.controller;

@Controller
@RequestMapping(value = "view")
public class ViewPointController {
	@Autowired
	private ViewPointService viewPointService;

	private HttpSession session;
	/**
	 * 保存景点留言信息
	 */
	@RequestMapping(value="/saveWords")
	public String saveWords(Words words){
		if(words != null){
			String r_id = words.getLw_for_article_id();
			viewPointService.saveWords(words);
			return "redirect:toArticleView.do?r_id="+r_id;
		}else{
			return null;
		}
	}

	/**
	 * 保存回复信息
	 */
	@RequestMapping(value="/saveReply")
	public String saveReply(Reply reply){
		if(reply != null){
			viewPointService.saveReply(reply);
			String r_id = reply.getLr_for_article_id();
			return "redirect:toArticleView.do?r_id="+r_id;
		}else{
			return null;
		}
	}

	/**
	 * 跳转到查看文章内容页面
	 */
	@RequestMapping(value="/toArticleView")
	public String toArticleView(@RequestParam int r_id, Model model){
		//封装留言信息
		lw_list = viewPointService.findByWords();
		model.addAttribute("lw_list",lw_list);

		//封装回复信息
		lr_list = viewPointService.findByReply();
		model.addAttribute("lr_list",lr_list);

		//查询文章信息
		ViewPoint viewPoint = viewPointService.selectByPrimaryKey(r_id);
		System.out.println("查询到当前文章的ID值:" + viewPoint.getTpVid());

		if (viewPoint != null) {
			model.addAttribute("viewPoint", viewPoint);
			return "proscenium/viewpoint/content";
		} else {
			return null;
		}
	}
	@Autowired
	private ForumExample example;

	/**
	 * index页用户登录
	 */
	@RequestMapping(value = "login", method = RequestMethod.POST)
	public String userLogin(String uemail, String upwd, Model model) {
		//index页面登录成功图片显示路径
		String prefix = "/static/upload/useravatar/";
		//index页用户登录验证
		if (uemail == null || uemail == "" || upwd == null || upwd == "") {
			session.setAttribute("msg", Msg.fail("邮箱或密码不可为空!"));
			return "redirect:/index";
		}
		User user = userService.userLogin(new User(uemail, upwd));
		if (user != null) {
			String suffix = user.getUpic();
			user.setUpic(prefix+suffix);
			session.setAttribute("user", user);
			return "redirect:/index";
		} else {
			session.setAttribute("msg", Msg.fail("还未注册或邮箱密码错误,请重新输入!"));
			return "redirect:/index";
		}

	}

	/**
	 * 前台用户注销
	 *
	 * @return
	 */
	@RequestMapping(value = "loginout", method = RequestMethod.GET)
	public String loginOut() {
		session.invalidate();
		return "redirect:/index";
	}

	/**
	 * 跳转注册用户
	 *
	 * @return
	 */
	@RequestMapping(value = "regst", method = RequestMethod.GET)
	public String regst() {
		return "proscenium/user/regst";
	}

	@RequestMapping(value = "regstform", method = RequestMethod.POST)
	public String regst(String uname, String uemail, String upwd, String reupwd, Model model) {
		if (uemail == null || upwd == null || uemail.trim().equals("") || upwd.trim().equals("")) {
			model.addAttribute("msg", Msg.fail("用户名或密码不可为空,请重新输入!"));
		if (user != null) {
			String suffix = user.getUpic();
			user.setUpic(prefix+suffix);
			session.setAttribute("user", user);
			return "redirect:/index";
		} else {
			session.setAttribute("msg", Msg.fail("还未注册或邮箱密码错误,请重新输入!"));
			return "redirect:/index";
		}

	}

	/**
	 * 前台用户注销
	 *
	 * @return
	 */
	@RequestMapping(value = "loginout", method = RequestMethod.GET)
	public String loginOut() {
		session.invalidate();
		return "redirect:/index";
	}

	/**
	 * 跳转注册用户
	 *
	 * @return
	 */
	@RequestMapping(value = "regst", method = RequestMethod.GET)
	public String regst() {
		return "proscenium/user/regst";
	}

	@RequestMapping(value = "regstform", method = RequestMethod.POST)
	public String regst(String uname, String uemail, String upwd, String reupwd, Model model) {
		if (uemail == null || upwd == null || uemail.trim().equals("") || upwd.trim().equals("")) {
			model.addAttribute("msg", Msg.fail("用户名或密码不可为空,请重新输入!"));
		} else if (!reupwd.equals(upwd)) {
			model.addAttribute("msg", Msg.fail("密码不正确请重新输入!"));
		} else {
			userService.insertUser(uname, uemail, upwd);
			model.addAttribute("msg", Msg.success("用户注册成功!"));
		}
		System.out.println(!uemail.trim().equals(""));
		return "proscenium/user/regst";
	}

	 *
	 * @param tpFids
	 * @param model
	 * @return
	 */
	@ResponseBody//返回给前端
	@RequestMapping(value = "forumMutiDelete", method = RequestMethod.GET)
	public String forumMutiDelete(Integer[] tpFids, Model model) {
		for (Integer tpFid : tpFids) {
			forumDao.deleteByPrimaryKey(tpFid);
		}
		session.setAttribute("msg", Msg.success(Arrays.toString(tpFids) + "号批量删除成功!"));
		return "1";
	}

	/**
	 * forummutidelete
	 */
	@RequestMapping(value = "forumDelete", method = RequestMethod.GET)
	public String forumDelete(Integer tpFid, Model model) {
		forumDao.deleteByPrimaryKey(tpFid);
		model.addAttribute("msg", Msg.success(tpFid + "号批量删除成功!"));
		return "redirect:forumList";
	}

	/**
	 * 酒店
	 * 新增表单跳转
	 */
	@RequestMapping(value = "forumInsertForm", method = RequestMethod.GET)
	public String forumInsertForm() {
		return "admin/forum_insert";
	}

	/**
	 * 酒店新增
	 */
	@RequestMapping(value = "forumInsert", method = RequestMethod.POST)
	public String forumInsert(Forum forum, Model model) {
		if (forum.getTpFid() == null) {
	 */
	@RequestMapping(value = "wordsDelete", method = RequestMethod.GET)
	public String wordsDelete(Integer lw_id, Model model) {
		wordsDao.deleteByPrimaryKey(lw_id);
		model.addAttribute("msg", Msg.success(lw_id + "号删除成功!"));
		return "redirect:wordsList";
	}

	/**
	 * 跳转回复列表
	 * @return
	 */
	@RequestMapping(value = "replyList", method = RequestMethod.GET)
	public String ReplyList(Model model) {
		List<Reply> replys = viewPointService.findByReply();
		model.addAttribute("replys", replys);
		return "admin/reply_list";
	}

	/**
	 * 回复批量删除
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "replyMutiDelete", method = RequestMethod.GET)
	public String replyMutiDelete(Integer[] lr_ids, Model model) {
		for (Integer lr_id : lr_ids){
			replyDao.deleteByPrimaryKey(lr_id);

		}
		model.addAttribute("msg", Msg.success(Arrays.toString(lr_ids) + "号删除成功!"));
		return "1";
	}

	/**
	 * 单击删除
	 * @return
	 */
	@RequestMapping(value = "replyDelete", method = RequestMethod.GET)
	public String replyDelete(Integer lr_id, Model model) {
		replyDao.deleteByPrimaryKey(lr_id);
		model.addAttribute("msg", Msg.success(lr_id + "号删除成功!"));
		return "redirect:replyList";
	}

}
package com.demo.controller;


	/**
	 * 用户单个单击删除
	 */
	@RequestMapping(value = "viewdelete", method = RequestMethod.GET)
	public String viewDelete(Integer tpVid) {
		viewPointService.deleteviews(tpVid);

		session.setAttribute("msg", Msg.success(tpVid + "号用户删除成功!"));
		return "redirect:viewlist";
	}

	/**
	 * 景点新增表单跳转
	 */
	@RequestMapping(value = "viewform", method = RequestMethod.GET)
	public String viewForm() {
		return "admin/view_form";
	}

	/**
	 * 景点新增
	 */
	@RequestMapping(value = "viewinsert", method = RequestMethod.POST)
	public String viewInsert(ViewPoint viewPoint) {
		if (viewPoint.getTpVid() == null) {
			viewPointService.insertView(viewPoint);
			session.setAttribute("msg", Msg.success("新增景点成功!"));
			return "redirect:viewlist";
		}
		session.setAttribute("msg", Msg.fail("新增景点失败!"));
		return "redirect:viewlist";
	}

	/**
	 * 跳转景点编辑更新界面
	 */
	@RequestMapping(value = "viewedit", method = RequestMethod.GET)
	public String viewEdit(Integer tpVid, Model model) {
		ViewPoint viewPoint = viewPointService.selectByPrimaryKey(tpVid);
		model.addAttribute("viewPoint", viewPoint);
		return "admin/view_edit";
	}

	/**
	 * 跳转景点更新业务
	 */
	@RequestMapping(value = "viewedithandle", method = RequestMethod.POST)
	public String viewEditHandle(ViewPoint viewPoint) {
		viewPointService.updateByPrimaryKeySelective(viewPoint);
		session.setAttribute("msg", Msg.success("景点信息保存成功!"));
		return "redirect:viewlist";
		return "redirect:index";
	}

	/**
	 * content
	 */
	@RequestMapping(value = "savecontent", method = RequestMethod.POST)
	public String saveContent(Forum forum, Model model){
		forumDao.insert(forum);
		model.addAttribute("msg", Msg.success("发帖成功"));
		return "redirect:index";
	}

	/*############后台开始##############*/

}
package com.demo.controller;

@Controller
@RequestMapping(value = "view")
public class ViewPointController {
	@Autowired
	private ViewPointService viewPointService;

	private HttpSession session;
	@Autowired
	private ViewPointExample viewPointExample;
	@Autowired
	private ViewPointDao viewPointDao;
	 * 跳转交通新增页面
	 * @return
	 */
	@RequestMapping(value = "trafficInsert", method = RequestMethod.GET)
	public String trafficInsert() {
		return "admin/traffic_insert";
	}

	/**
	 * 提交新增信息
	 * @return
	 */
	@RequestMapping(value = "trafficInsertHandler", method = RequestMethod.POST)
	public String trafficInsertHandler(Traffic traffic, String currentTime, String arriveTime, Model model) {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			// String parseCurrent = simpleDateFormat.format(currentTime);
			// String parseArriveTime = simpleDateFormat.format(arriveTime);
			traffic.setTpCurrentTime(currentTime);
			traffic.setTpArriveTime(arriveTime);
		} catch (Exception e) {
			e.printStackTrace();
		}
		trafficDao.insertSelective(traffic);
		model.addAttribute("msg",Msg.success("新增交通信息成功!"));
		return "redirect:trafficList";
	}

	/**
	 * 单机删除
	 * @return
	 */
	@RequestMapping(value = "trafficDelete", method = RequestMethod.GET)
	public String trafficDelete(Integer tpTid, Model model) {
		trafficDao.deleteByPrimaryKey(tpTid);
		model.addAttribute("msg", Msg.success(tpTid + "号删除成功!"));
		return "redirect:trafficList";
	}
	/**
	 * 批量删除
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "trafficMutiDelete", method = RequestMethod.GET)
	public String trafficsMutiDelete(Integer[] tpTids, Model model) {

		for (Integer tpTid : tpTids){
			trafficDao.deleteByPrimaryKey(tpTid);

		}
		model.addAttribute("msg", Msg.success(Arrays.toString(tpTids) + "号删除成功!"));

@Controller
@RequestMapping(value = "")
public class IndexController {
	@Autowired
	private ViewPointService viewPointService;
	@Autowired
	private HotelDao hotelDao;

	/**
	 * 跳转首页
	 */
	@RequestMapping(value = {"", "index"}, method = RequestMethod.GET)
	public String index(ViewPointExample example, Model model) {
		HotelExample hotelExample = new HotelExample();
		//显示首页的景点
		String prefix = "/static/upload/viewavatar/";
		//酒店
		String prefixHotel = "/static/upload/hotelAvatar/";
		example.setOrderByClause("tp_vid desc");
		List<ViewPoint> viewPoints = viewPointService.selectByExample(example);
		for (ViewPoint viewPoint : viewPoints) {
			String suffix = viewPoint.getTpVpic();
			viewPoint.setTpVpic(prefix + suffix);
		}

		//酒店
		hotelExample.setOrderByClause("hid desc");
		List<Hotel> hotels = hotelDao.selectByExample(hotelExample);
		for (Hotel hotel : hotels) {
			String suffix = hotel.getImgUrl();
			hotel.setImgUrl(prefixHotel + suffix);
		}

		//传送景点
		model.addAttribute("viewPoints", viewPoints);
		model.addAttribute("hotels", hotels);
		return "index";
	}

}

/**
 * 论坛模块
 */
@Controller
@RequestMapping(value = "forum")
public class ForumController {
	@Autowired
    ForumService forumService;
	@Autowired
    ForumExample example;
	@Autowired
    ForumDao forumDao;
	@Autowired
    Words words;
	@Autowired
    Reply reply;
	@Autowired
    ViewPointService viewPointService;

	private Model model;
	/**
	 * 倒序查询帖子 跳转forum页面
	 */
	@RequestMapping(value = "index", method = RequestMethod.GET)
	public String index(Model model){
		example.setOrderByClause("tp_fid desc");
		List<Forum> forums = forumDao.selectByExampleWithBLOBs(example);
		model.addAttribute("forums",forums);
		return "proscenium/forum/index";
	}

	/**
	 * 倒序查询帖子 跳转forum页面
	 */
	@RequestMapping(value = "content", method = RequestMethod.GET)
	public String content(Integer tpFid, Model model){
		//封装留言信息
		List<Words> byWords = viewPointService.findByWords();
		model.addAttribute("lw_list",byWords);

		//封装回复信息
		List<Reply> byReply = viewPointService.findByReply();
		model.addAttribute("lr_list",byReply);

		model.addAttribute("viewPoint", viewPoint);

		return "proscenium/viewpoint/content";
	}

	/**
	 * 前台景点模糊搜索
	 */
	@RequestMapping(value = "viewPointSearch", method = RequestMethod.GET)
	public String viewPointSearch(String keyword, Model model) {
		String prefix = "/static/upload/viewavatar/";

		ViewPoint viewPoint = new ViewPoint();
		viewPoint.setTpVname(keyword);
		viewPoint.setTpVtype(keyword);
		viewPoint.setTpLocation(keyword);
		List<ViewPoint> viewPoints = viewPointDao.viewPointSearch(viewPoint);

		for (ViewPoint vp : viewPoints){
			String imgUrl = vp.getTpVpic();
			vp.setTpVpic(prefix + imgUrl);
		}

		model.addAttribute("viewPoints", viewPoints);
		model.addAttribute("msg", Msg.success("景点查询成功!"));

		return "proscenium/viewpoint/view";
	}

}
package com.demo.controller;


@Controller
@RequestMapping(value = "view")
public class ViewPointController {
	@Autowired
	private ViewPointService viewPointService;

	private HttpSession session;
	@Autowired
	private ViewPointExample viewPointExample;
	@Autowired
	private ViewPointDao viewPointDao;

	/**
	 * 旅游景点跳转
	 * @return
	 */
	@RequestMapping(value = "point", method = RequestMethod.GET)
	public String viewPoint(ViewPointExample example, Model model) {
		example.setOrderByClause("tp_vid desc");
		String prefix = "/static/upload/viewavatar/";

		List<ViewPoint> viewPoints = viewPointService.selectByExample(example);
		for (ViewPoint viewPoint : viewPoints){
			String suffix = viewPoint.getTpVpic();
			//前端img标签路径
			viewPoint.setTpVpic(prefix+suffix);
		}
		model.addAttribute("viewPoints", viewPoints);
		return "proscenium/viewpoint/view";
	}

	/**
	 * 前台景点模糊搜索
	 *
	 * 待完成
	 *
		System.out.println(uid);
		String prefix = "/static/upload/useravatar/";
		userService.userDelete(uid);
		List<User> users = userService.selectAll();
		for (User user : users){
			String imgUrl = user.getUpic();
			user.setUpic(prefix + imgUrl);
		}
		session.setAttribute("users", users);
		session.setAttribute("msg", Msg.success(uid + "号用户删除成功!"));
		return "admin/user_list";
	}

	/**
	 * 用户新增表单跳转
	 */
	@RequestMapping(value = "userform", method = RequestMethod.GET)
	public String userForm() {
		return "admin/user_form";
	}

	/**
	 * 用户新增
	 */
	@RequestMapping(value = "userinsert", method = RequestMethod.POST)
	public String userInsert(String uname, String uemail, String upwd) {
		userService.insertUser(uname, uemail, upwd);
		session.setAttribute("msg", Msg.success("新增用户成功"));
		return "redirect:userlist";
	}

	/**
	 * 用户批量删除功能
	 */
	@RequestMapping(value = "usersectiondelete", method = RequestMethod.GET)
	@ResponseBody//返回给前端
	public String userSectionDelete(String[] uids) {
		for (String uid : uids) {
			userService.userDelete(uid);
		}
		session.setAttribute("msg", Msg.success(Arrays.toString(uids) + "号用户批量删除成功!"));
		return "1";
	}

	/**
	 * 跳转用户编辑更新界面
	 */
	}

	/**
	 * 后台论坛模糊搜索
	 */
	@RequestMapping(value = "forumPointSearch", method = RequestMethod.GET)
	public String forumPointSearch(String keyword, Model model) {

		Forum forum = new Forum();

		forum.setTpTag(keyword);
		forum.setTpTitle(keyword);
		forum.setTpSubTitle(keyword);
		forum.setTpAuthor(keyword);

		List<Forum> forums = forumDao.forumPointSearch(forum);

		model.addAttribute("forums", forums);
		model.addAttribute("msg", Msg.success("论坛查询成功!"));

		return "proscenium/forum/index";
	}

	/**
	 * 发帖功能 跳转编辑页面
	 */
	@RequestMapping(value = "issue", method = RequestMethod.GET)
	public String issue(Integer uid, Model model){
		if (uid != null){
			return "proscenium/forum/edit";
		}
		example.setOrderByClause("tp_fid desc");
		List<Forum> forums = forumDao.selectByExampleWithBLOBs(example);
		model.addAttribute("forums",forums);
		model.addAttribute("msg", Msg.fail("您还未登录!"));
		return "proscenium/forum/index";
	}

	/**
	 * 编辑页面
	 */
	@RequestMapping(value = "edit", method = RequestMethod.GET)
		List<Hotel> hotels = hotelDao.selectByExample(example);
		for (Hotel hotel : hotels){
			String fileSuffix = hotel.getImgUrl();
			hotel.setImgUrl(filePath + fileSuffix);
		}
		System.out.println(hotels);
		return hotels;
	}
}
package com.demo.controller;

@Controller
@RequestMapping(value = "")
public class IndexController {
	@Autowired
	private ViewPointService viewPointService;
	@Autowired
	private HotelDao hotelDao;

	/**
	 * 跳转首页
	 */
	@RequestMapping(value = {"", "index"}, method = RequestMethod.GET)
	public String index(ViewPointExample example, Model model) {
		HotelExample hotelExample = new HotelExample();
		//显示首页的景点
		String prefix = "/static/upload/viewavatar/";
		//酒店
		String prefixHotel = "/static/upload/hotelAvatar/";
		example.setOrderByClause("tp_vid desc");
		List<ViewPoint> viewPoints = viewPointService.selectByExample(example);
		for (ViewPoint viewPoint : viewPoints) {
			String suffix = viewPoint.getTpVpic();
			viewPoint.setTpVpic(prefix + suffix);
		}

		//酒店
		//获取文件后缀
		String fileName = dropFile.getOriginalFilename();
		String fileSuffix = fileName.substring(fileName.lastIndexOf('.'));
		//文件存放路径
		String realPath = request.getSession().getServletContext().getRealPath(filePath);
		File file = new File(realPath);
		//判断文件是否存在
		if (!file.exists()){
			file.mkdir();
		}
		file = new File(realPath,UUID.randomUUID() + fileSuffix);
		try {
			dropFile.transferTo(file);
		} catch (IOException e) {
			e.printStackTrace();
		}
		result.put("fileName",file.getName());
		return result;
	}

	/**
	 * 后台内容图片上传
	 * @param dropFile
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "viewContentUpload", method = RequestMethod.POST)
	public Map<String, Object> viewContentUpload(MultipartFile dropFile, HttpServletRequest request) {
		Map<String, Object> result = new HashMap<>();
		//前缀路径 Scheme服务端提供的协议 getServerName服务器名称 port 端口
		//String server = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();

		//图片显示路径
		String prefix = "/static/upload/contentFile/";

		//获取文件后缀
		String fileName = dropFile.getOriginalFilename();
		String fileSuffix = fileName.substring(fileName.lastIndexOf('.'));

		//文件存放路径
		String realPath = request.getSession().getServletContext().getRealPath(prefix);
	@RequestMapping(value = "forumEditForm", method = RequestMethod.GET)
	public String forumEditForm(Integer tpFid, Model model) {
		Forum forum = forumDao.selectByPrimaryKey(tpFid);
		model.addAttribute("forum", forum);
		return "admin/forum_edit";
	}

	/**
	 * 景点新增
	 */
	@RequestMapping(value = "forumEdit", method = RequestMethod.POST)
	public String forumEdit(Forum forum, Model model) {
		forumDao.updateByPrimaryKeySelective(forum);
		model.addAttribute("msg", Msg.success("更新成功!"));
		return "redirect:forumList";
	}

	/**Traffic**
	 * 跳转交通列表页面
	 */
	@RequestMapping(value = "trafficList", method = RequestMethod.GET)
	public String trafficList(Model model) {
		TrafficExample example = new TrafficExample();
		example.setOrderByClause("tp_Tid desc");
		List<Traffic> traffics = trafficDao.selectByExample(example);

		model.addAttribute("traffics", traffics);
		return "admin/traffic_list";
	}

	/**
	 * 跳转交通新增页面
	 * @return
	 */
	@RequestMapping(value = "trafficInsert", method = RequestMethod.GET)
	public String trafficInsert() {
		return "admin/traffic_insert";
	}

	/**
	 * 提交新增信息
	 * @return
	 */
	@RequestMapping(value = "trafficInsertHandler", method = RequestMethod.POST)
	public String trafficInsertHandler(Traffic traffic, String currentTime, String arriveTime, Model model) {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			// String parseCurrent = simpleDateFormat.format(currentTime);
			// String parseArriveTime = simpleDateFormat.format(arriveTime);

请添加图片描述

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

软件名称: 乐旅旅游网站管理系统 英文简称: Lelvw 软件版本: V 3.9.0 软件类型:免费版 运行环境:Asp + IIs6 + Access + Windows2003 程序构造: ASP + Access AJAX + XML + DIV + CSS + HTML 乐旅旅游网站系统: 是一套面向中小型旅游企业一体化管理旅游系统,无论在稳定性、代码优化、运行效率、负载能力、安全等级、功能可操控性和权限严密性等方面都居国内外同类产品领先地位。帮助中小型旅游企业实现管理,应用了新一代的B/S结构,巧妙地结合了酒店、机票、线路、景区、会员等多种功能于一体,它以浏览器为软件界面的导航式操作,快速完成日常管理中的会员,订单等操作,并结合准确、高效的统计和业务分析功能,通过交互式的数据中心与一目了然的统计,使企业决策者最关心的往来订单、会员状况等能够即点即现。 在当今瞬机万变的市场环境中,快速高效的IT解决方案是您业务成功的关键。我们Lelvw因为能为您量身打造完全符合需求的解决方案而自豪,运用我们的系统,我们可以让您的企业更高效,从而在市场中获得更大的利润。 20130222更新: 1、全面升级Kindetior编辑器 2、编辑兼容火狐,360浏览器器 20130120更新: 1、新增后台登陆日志 2、安全加载SQL防注 3、底部列表显示整理 20121220更新: 1、首页页面优化显示 2、关于我们优化显示 3、广告链接字段加长 20121121更新: 1、修复酒店城市搜索 2、首页图片加载美化 3、管理密码长度修正 20121015更新: 1、租车详细界面优化 2、酒店详细界面优化 3、线路详细界面优化 特点和优势 1、基于B/S架构,通过本地电脑、局域网、互联网皆可使用,使得企业的管理与业务不受地域限制 2. 客户端无需安装专用软件,使用浏览器即可实现异地、实时业务办理 3、软件完全独立安装在用户自己的电脑或是服务器上,提供数据备份工具,数据资料彻底安全 4. 管理权限分配灵活严谨,可以设置操作人员不同级别的操作权限,避免越权操作,数据相互保密 5、账号不限,可以任意添加、修改、删除用户帐号 6、使用期限不限,一次购买,终身使用 7、安装简单,使用简捷方便,技术支持使您更快熟悉软件功能 注意事项: 1.本程序只需支持ASP空间即可运行,使用前请先联系空间商。 2.上传wwwroot文件夹到你的网站根目录,然后运行即可。 3.免费版适用个人用途,如需建立商业站点或公司使用请购买商业版。 版权所有:乐旅网 主站:http://www.lelvw.com 演示:http://www.lelvw.com/lv
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值