源码获取:博客首页 "资源" 里下载!
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版本;
1. 后端:SpringBoot
2. 前端:html+layui+bootstrap+jQuery
1. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包;
2. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置
4. 配置tomcat,然后运行项目,输入localhost:8087/travel 登录
5. 后台管理员账户:admin 密码:admin
前台普通用户账户:user 密码:123456
@Controller
@RequestMapping("/user")
public class UserCenterController {
@Autowired
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());
return "center/user-center-editpw";
}
@RequestMapping("/centerEditPW")
@ResponseBody
public Result centerEditPW(HttpServletRequest request, HttpServletResponse response, Model model, @RequestParam("id") String id, @RequestParam("oldPassword") String oldPassword, @RequestParam("newPassword") String newPassword) {
return userCenterService.centerEditPW(request, response, id, oldPassword, newPassword);
}
}
@Controller
public class LoginController {
@Autowired
private LoginService loginService;
@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
@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 page = strategyService.TravelStrategyListUI(searchName, pageable);
List 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 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")
public String strategyManageUI(Model model, HttpServletRequest request) {
List userStrategyList = strategyService.getTravelStrategyByUser(request);
List 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 page = strategyService.PushStrategyListUI(request,searchName, pageable);
List top10Strategy = strategyService.findTop10Strategy();
model.addAttribute("top10Strategy", top10Strategy);
model.addAttribute("page", page);
return "strategy/pushStrategy";
}
}
@Controller
@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 page = reserveService.reserveHotelListUI(searchName, pageable);
List top10Hotel = reserveService.getTop10Hotel();
List 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 top10Hotel = reserveService.getTop10Hotel();
List 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 userHotelList = reserveService.getReserveHotelByUser(request);
List 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("/reserveAttractionsListUI")
public String reserveAttractionsListUI(Model model, @ModelAttribute("searchName") String searchName, @PageableDefault(size = 10) Pageable pageable) {
Page page = reserveService.reserveAttractionsListUI(searchName,pageable);
List top10Hotel = reserveService.getTop10Hotel();
List top10Attractions = reserveService.getTop10Attractions();
model.addAttribute("top10Hotel", top10Hotel);
model.addAttribute("top10Attractions", top10Attractions);
model.addAttribute("page", page);
return "reserve/reserve-attractions";
}
@RequestMapping("/attractionsDetailsUI")
public String attractionsDetailsUI(Model model, HttpServletRequest request, @RequestParam(name = "id") String id) {
Attractions attractions = reserveService.findAttractionsById(id);
//如果用户显示已经预约,就是查看预约列表
Boolean flag = reserveService.isReserveAttractions(request, id);
List top10Hotel = reserveService.getTop10Hotel();
List top10Attractions = reserveService.getTop10Attractions();
model.addAttribute("top10Hotel", top10Hotel);
model.addAttribute("top10Attractions", top10Attractions);
model.addAttribute("attractions", attractions);
model.addAttribute("flag", flag);
return "reserve/reserve-attractions-details";
}
@RequestMapping("/cancelAttractionsReserve")
@ResponseBody
public Result cancelAttractionsReserve(HttpServletRequest request,String id) {
return reserveService.cancelAttractionsReserve(request,id);
}
}
源码获取:博客首页 "资源" 里下载!