项目介绍
springboot景区管理系统。该项目分为前台网站展示与后台管理。
前台网站主要功能有:用户登录、注册;首页有热门酒店、热门景点、景区游玩攻略、热门路线等模块;其次导航栏有景区游玩路线、我关注的路线;景区游玩攻略、我发布的攻略、我关注的攻略;在线酒店预订、景点预订、我的预订等;
后台管理主要功能有:用户管理、酒店管理、景点管理、攻略管理、路线管理等;
环境需要
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项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7版本;
技术栈
-
后端:SpringBoot
-
前端:html+layui+bootstrap+jQuery
使用说明
-
使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包;
-
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
-
将项目中application.yml配置文件中的数据库配置改为自己的配置
-
配置tomcat,然后运行项目,输入localhost:8087/travel 登录
-
后台管理员账户:admin 密码:admin
前台普通用户账户:user 密码:123456
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
@RequestMapping("/loginUI")
public String loginUI() {
return "login/index-login";
}
@RequestMapping("/login")
@ResponseBody
public Result login(Model model, User user, HttpServletResponse response) {
return loginService.login(user, response);
}
@RequestMapping("/logout")
public String logout(HttpServletRequest request, HttpServletResponse response) {
loginService.logout(request, response);
//SpringMVC重定向
return "redirect:/";
}
@RequestMapping("/registerUI")
public String registerUI() {
return "login/index-register";
}
@RequestMapping("/register")
@ResponseBody
public Result register(Model model, User user) {
return loginService.register(user);
}
}
日程安排控制层:
@Controller
@Autowired
private StrategyService strategyService;
@RequestMapping("/travelStrategyListUI")
public String travelStrategyListUI(Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) {
Page<TravelStrategy> page = strategyService.TravelStrategyListUI(searchName, pageable);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("page", page);
return "strategy/travelStrategy";
}
@RequestMapping("/travelStrategyDetailsUI")
public String travelStrategyDetailsUI(Model model, HttpServletRequest request, @RequestParam(name = "id") String id) {
TravelStrategy travelStrategy = strategyService.findTravelStrategyById(id);
//如果用户显示已经关注,就是查看关注列表
Boolean flag = strategyService.isStrategy(request, id);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("travelStrategy", travelStrategy);
model.addAttribute("flag", flag);
return "strategy/travelStrategy-details";
}
@RequestMapping("/cancelTravelStrategyReserve")
@ResponseBody
public Result cancelTravelStrategyReserve(HttpServletRequest request, String id) {
return strategyService.cancelTravelStrategyReserve(request, id);
}
@RequestMapping("/strategyManageUI")
model.addAttribute("top10Attractions", top10Attractions);
model.addAttribute("hotel", hotel);
model.addAttribute("flag", flag);
return "reserve/reserve-hotel-details";
}
@RequestMapping("/reserveManageUI")
public String reserveManageUI(Model model, HttpServletRequest request) {
List<UserHotel> userHotelList = reserveService.getReserveHotelByUser(request);
List<UserAttractions> userAttractionsList = reserveService.getReserveAttractionsByUser(request);
model.addAttribute("userHotelList", userHotelList);
model.addAttribute("userAttractionsList",userAttractionsList);
return "reserve/reserve-user-manage";
}
@RequestMapping("/cancelReserve")
@Autowired
private StrategyService strategyService;
@RequestMapping("/travelStrategyListUI")
public String travelStrategyListUI(Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) {
Page<TravelStrategy> page = strategyService.TravelStrategyListUI(searchName, pageable);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("page", page);
return "strategy/travelStrategy";
}
@RequestMapping("/travelStrategyDetailsUI")
public String travelStrategyDetailsUI(Model model, HttpServletRequest request, @RequestParam(name = "id") String id) {
TravelStrategy travelStrategy = strategyService.findTravelStrategyById(id);
//如果用户显示已经关注,就是查看关注列表
Boolean flag = strategyService.isStrategy(request, id);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
private UserCenterService userCenterService;
@RequestMapping("/centerUI")
public String centerUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("user", user);
return "center/user-center";
}
@RequestMapping("/centerEditUI")
public String centerEditUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("user", user);
return "center/user-center-edit";
}
@RequestMapping("/centerEdit")
@ResponseBody
public Result centerEdit(Model model, User user) {
return userCenterService.centerEdit(user);
}
@RequestMapping("/centerEditPWUI")
public String centerEditPWUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("id", user.getId());
Page<TravelStrategy> page = strategyService.TravelStrategyListUI(searchName, pageable);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("page", page);
return "strategy/travelStrategy";
}
@RequestMapping("/travelStrategyDetailsUI")
public String travelStrategyDetailsUI(Model model, HttpServletRequest request, @RequestParam(name = "id") String id) {
TravelStrategy travelStrategy = strategyService.findTravelStrategyById(id);
//如果用户显示已经关注,就是查看关注列表
Boolean flag = strategyService.isStrategy(request, id);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
public Result register(Model model, User user) {
return loginService.register(user);
}
}
日程安排控制层:
@Controller
@RequestMapping("/strategy")
public class StrategyController {
@Autowired
private StrategyService strategyService;
@RequestMapping("/travelStrategyListUI")
public String travelStrategyListUI(Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) {
Page<TravelStrategy> page = strategyService.TravelStrategyListUI(searchName, pageable);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("page", page);
return "strategy/travelStrategy";
}
@RequestMapping("/travelStrategyDetailsUI")
public String travelStrategyDetailsUI(Model model, HttpServletRequest request, @RequestParam(name = "id") String id) {
@RequestMapping("/reserve")
public class ReserveController {
@Autowired
private ReserveService reserveService;
@RequestMapping("/reserveHotelListUI")
public String reserveHotelListUI(Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) {
Page<Hotel> page = reserveService.reserveHotelListUI(searchName, pageable);
List<Hotel> top10Hotel = reserveService.getTop10Hotel();
List<Attractions> top10Attractions = reserveService.getTop10Attractions();
model.addAttribute("top10Hotel", top10Hotel);
model.addAttribute("top10Attractions", top10Attractions);
model.addAttribute("page", page);
return "reserve/reserve-hotel";
}
@RequestMapping("/hotelDetailsUI")
public String hotelDetailsUI(Model model, HttpServletRequest request, @RequestParam(name = "id") String id) {
Hotel hotel = reserveService.findHotelById(id);
//如果用户显示已经预约,就是查看预约列表
Boolean flag = reserveService.isReserveHotel(request, id);
List<Hotel> top10Hotel = reserveService.getTop10Hotel();
List<Attractions> top10Attractions = reserveService.getTop10Attractions();
model.addAttribute("top10Hotel", top10Hotel);
model.addAttribute("top10Attractions", top10Attractions);
List<Hotel> top10Hotel = reserveService.getTop10Hotel();
List<Attractions> top10Attractions = reserveService.getTop10Attractions();
model.addAttribute("top10Hotel", top10Hotel);
model.addAttribute("top10Attractions", top10Attractions);
model.addAttribute("hotel", hotel);
model.addAttribute("flag", flag);
return "reserve/reserve-hotel-details";
}
@RequestMapping("/reserveManageUI")
public String reserveManageUI(Model model, HttpServletRequest request) {
List<UserHotel> userHotelList = reserveService.getReserveHotelByUser(request);
List<UserAttractions> userAttractionsList = reserveService.getReserveAttractionsByUser(request);
model.addAttribute("userHotelList", userHotelList);
model.addAttribute("userAttractionsList",userAttractionsList);
return "reserve/reserve-user-manage";
}
@RequestMapping("/cancelReserve")
@ResponseBody
public Result cancelReserve(HttpServletRequest request,String id) {
return reserveService.cancelReserve(request,id);
@RequestMapping("/centerUI")
public String centerUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("user", user);
return "center/user-center";
}
@RequestMapping("/centerEditUI")
public String centerEditUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("user", user);
return "center/user-center-edit";
}
@RequestMapping("/centerEdit")
@ResponseBody
}
@RequestMapping("/strategyManageUI")
public String strategyManageUI(Model model, HttpServletRequest request) {
List<UserStrategy> userStrategyList = strategyService.getTravelStrategyByUser(request);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("userStrategyList", userStrategyList);
return "strategy/strategy-manage";
}
@RequestMapping("/saveTravelStrategy")
@ResponseBody
public Result saveTravelStrategy(HttpServletRequest request, TravelStrategy travelStrategy) {
return strategyService.saveTravelStrategy(request, travelStrategy);
}
@RequestMapping("/pushStrategyListUI")
public String pushStrategyListUI(HttpServletRequest request, Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) {
Page<TravelStrategy> page = strategyService.PushStrategyListUI(request,searchName, pageable);
List<TravelStrategy> top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("page", page);
return "strategy/pushStrategy";
}
}