当前位置:   article > 正文

基于javaweb+jsp的旅游景点门票管理系统(java+SSM+jsp+Mysql)_eclipse旅游管理系统javajsp

eclipse旅游管理系统javajsp

基于javaweb+jsp的旅游景点门票管理系统(java+SSM+jsp+Mysql)
jsp+ssm(spring+springMVC+mybatis)+MySQL实现的在线旅游景点信息管理系统,系统主要实现的功能有:用户浏览搜索景点游玩路线、用户注册登录、下单预定旅游产品等。后台管理员可对旅游产品进行管理、包括旅游的主题、产品、用户、定制、订单等。

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

适用

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

    }
	
	/**
	 * 增加
	 * @param admin
	 */
	@ResponseBody
	@RequestMapping(method=RequestMethod.POST)
	public Result add(@RequestBody Admin admin  ){
		adminService.add(admin);
		return new Result(true,StatusCode.OK,"增加成功");
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
	}
	/**
	 * 管理员退出登录
	 * @return
	 */
	@RequestMapping(value = "/logout")
	public String logout(HttpSession session){
		session.removeAttribute("admin");
		return "admin/login/login";
	}
	/**
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
    public Result findSearch( @RequestBody Map searchMap){
        return new Result(true,StatusCode.OK,"查询成功",adminService.findSearch(searchMap));
    }
	
	/**
	 * 增加
	 * @param admin
	 */
	@ResponseBody
	@RequestMapping(method=RequestMethod.POST)
	public Result add(@RequestBody Admin admin  ){
		adminService.add(admin);
		return new Result(true,StatusCode.OK,"增加成功");
	}
	
	/**
	 * 修改
	 * @param admin
	 */
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
	 * 酒店评分
	 * @param hotel
	 * @return
	 */
	@ResponseBody
	@PostMapping("/hotelOrderStar")
	public Result hotelOrderStar(Hotel hotel,@RequestParam("orderId")Long orderId){
		Long id = hotel.getId();
		Hotel newHotel = hotelService.findById(id);
		if(newHotel==null){
			return new Result(false,StatusCode.ERROR,"未找到该酒店!");
		}
		Integer currentStar = hotel.getStar();
		Integer totalStar = newHotel.getStar();
		if(currentStar<0){
			return new Result(false,StatusCode.ERROR,"请选择评分!");
		}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
		}
		if(StringUtils.isEmpty(hotel.getName())){
			return new Result(false,StatusCode.ERROR,"请填写酒店名称");
		}
		BeanUtils.copyProperties(hotel,hotelById,"id","img","miaoshu","day","startdate","addr","commentCount");
		if(hotelService.update(hotelById)==null){
			return new Result(false,StatusCode.ERROR,"酒店编辑失败");
		}
		return new Result(true,StatusCode.OK,"修改成功");
	}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
	public Result findAll(){
		return new Result(true, StatusCode.OK,"查询成功",adminService.findAll());
	}
	
	/**
	 * 根据ID查询
	 * @param id ID
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.GET)
	public Result findById(@PathVariable Long id){
		return new Result(true,StatusCode.OK,"查询成功",adminService.findById(id));
	}
	/**
	 * 分页+多条件查询
	 * @param searchMap 查询条件封装
	 * @param page 页码
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
			}else {
				model.addAttribute("scenics",scenics);
			}
		return "page/hotelDetail::table_refresh";
	}
}
管理员控制层:
/**
 * 控制器层
 * @author yy
 *
 */
@Controller
@CrossOrigin
@RequestMapping("/admin")
public class AdminController {
	@Autowired
	private AdminService adminService;
	
	@Autowired
	BCryptPasswordEncoder encoder;
	/**
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
		model.addAttribute("oneAttr",scenic);
		return "page/hotelDetail";
	}
	@RequestMapping("/local")
	public String localRefresh(Model model,Long id) {
		Hotel hotel=hotelService.findById(id);
			//	Sort sort=new Sort(Sort.Direction.DESC,"star");
			System.out.println("1111"+hotel.toString());
			List<Scenic> scenics=scenicService.findByCountryLike(hotel.getAddr());
			System.out.println("2222"+scenics.toString());
			Collections.sort(scenics, new Comparator<Scenic>() {
				@Override
				public int compare(Scenic o1, Scenic o2) {
					if (o1.getStart()<o2.getStart()){
						return 2;
					}
					if (o1.getStart().equals(o2.getStart()) ){
						return 1;
					}
					return -1;
				}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
	/**
	 * 分页+多条件查询
	 * @param searchMap 查询条件封装
	 * @param page 页码
	 * @param size 页大小
	 * @return 分页结果
	 */
	@ResponseBody
	@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
	public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
	public String hotelAdd(){
		return "admin/hotelmanage/hotelAdd";
	}
	/**
	 * 查询单个酒店
	 * @param model
	 * @param id
	 * @return
	 */
	@RequestMapping("/oneAttr")
	public String One_attr(Model model, Long id){
		Hotel scenic=hotelService.findById(id);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
    }
	
	/**
	 * 订单添加操作
	 * @param orders
	 */
	@ResponseBody
	@RequestMapping(value ="/add",method=RequestMethod.POST)
	public Result add(Orders orders, HttpSession session){
		//获取数量
		User user = (User) session.getAttribute("user");
		if (user == null){
			return new Result(false,StatusCode.ACCESSERROR,"请登录");
		}
		return ordersService.add(orders,user.getId(),orders.getId(),orders.getQty());
	}
	
	/**
	 * 修改
	 * @param
	 */
	@ResponseBody
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
		}
		if(StringUtils.isEmpty(hotel.getMiaoshu())){
			return new Result(false,StatusCode.ERROR,"请填写酒店描述");
		}
		hotel.setCommentCount(0);
		hotel.setStar(0);
		if(hotelService.add(hotel)==null){
			return new Result(false,StatusCode.ERROR,"酒店添加失败");
		}
		return new Result(true,StatusCode.OK,"添加成功");
	}
	/**
	 * 分页+多条件查询
	 * @param searchMap 查询条件封装
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.GET)
	public Result findById(@PathVariable Long id){
		return new Result(true,StatusCode.OK,"查询成功",hotelService.findById(id));
	}
	/**
	 * 酒店添加操作
	 * @param hotel
	 */
	@ResponseBody
	@RequestMapping(value = "/add",method=RequestMethod.POST)
	public Result add(Hotel hotel){
		if(StringUtils.isEmpty(hotel.getName())){
			return new Result(false,StatusCode.ERROR,"请填写酒店名称");
		}
		if(StringUtils.isEmpty(hotel.getImg())){
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
					}
					return -1;
				}
			});
			if (scenics.size()>=4){
				List newList=scenics.subList(0,3);
				model.addAttribute("scenics",newList);
			}else {
				model.addAttribute("scenics",scenics);
			}
		return "page/hotelDetail::table_refresh";
	}
}
管理员控制层:
/**
 * 控制器层
 * @author yy
 *
 */
@Controller
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
	 * @return
	 */
	@RequestMapping("/oneAttr")
	public String One_attr(Model model, Long id){
		Hotel scenic=hotelService.findById(id);
		model.addAttribute("oneAttr",scenic);
		return "page/hotelDetail";
	}
	@RequestMapping("/local")
	public String localRefresh(Model model,Long id) {
		Hotel hotel=hotelService.findById(id);
			//	Sort sort=new Sort(Sort.Direction.DESC,"star");
			System.out.println("1111"+hotel.toString());
			List<Scenic> scenics=scenicService.findByCountryLike(hotel.getAddr());
			System.out.println("2222"+scenics.toString());
			Collections.sort(scenics, new Comparator<Scenic>() {
				@Override
				public int compare(Scenic o1, Scenic o2) {
					if (o1.getStart()<o2.getStart()){
						return 2;
					}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
	@ResponseBody
	@RequestMapping(method=RequestMethod.POST)
	public Result add(@RequestBody Admin admin  ){
		adminService.add(admin);
		return new Result(true,StatusCode.OK,"增加成功");
	}
	
	/**
	 * 修改
	 * @param admin
	 */
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.PUT)
	public Result update(@RequestBody Admin admin, @PathVariable Long id ){
		admin.setId(id);
		adminService.update(admin);		
		return new Result(true,StatusCode.OK,"修改成功");
	}
	
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
		}
	}
}
订单管理控制层:
/**
 * 控制器层
 * @author yy
 *
 */
@Controller
@CrossOrigin
@RequestMapping("/orders")
public class OrdersController {
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
	@Autowired
	BCryptPasswordEncoder encoder;
	/**
	 * 查询全部数据
	 * @return
	 */
	@ResponseBody
	@RequestMapping(method= RequestMethod.GET)
	public Result findAll(){
		return new Result(true, StatusCode.OK,"查询成功",adminService.findAll());
	}
	
	/**
	 * 根据ID查询
	 * @param id ID
	 * @return
	 */
	@ResponseBody
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
	@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
	public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
		Page<Orders> pageList = ordersService.findSearch(searchMap, page, size);
		return  new Result(true,StatusCode.OK,"查询成功",  new PageResult<Orders>(pageList.getTotalElements(), pageList.getContent()) );
	}
	/**
     * 根据条件查询
     * @param searchMap
     * @return
     */
	@ResponseBody
    @RequestMapping(value="/search",method = RequestMethod.POST)
    public Result findSearch( @RequestBody Map searchMap){
        return new Result(true,StatusCode.OK,"查询成功",ordersService.findSearch(searchMap));
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
	 * 景点评分
	 * @param scenic
	 * @return
	 */
	@ResponseBody
	@PostMapping("/travelOrderStar")
	public Result travelOrderStar(Scenic scenic,@RequestParam("orderId")Long orderId){
		Long id = scenic.getId();
		Scenic newScenic = scenicService.findById(id);
		if(newScenic==null){
			return new Result(false,StatusCode.ERROR,"未找到该景点!");
		}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
	@ResponseBody
	@RequestMapping(value = "/list",method= RequestMethod.GET)
	public Result findAll(){
		List<Orders> all = ordersService.findAll();
		return new Result(true, StatusCode.OK,"查询成功",all,all.size());
	}
	/**
	 * 查询全部订单
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/allorders",method = RequestMethod.POST)
	public String findAllOrders(HttpSession session, Model model) throws ParseException {
		User user= (User) session.getAttribute("user");
		model.addAttribute("orders",ordersService.findOrders(user.getId().toString()));
		return "index_header::table_refresh";
	}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
	@ResponseBody
	@RequestMapping(value = "/allorders",method = RequestMethod.POST)
	public String findAllOrders(HttpSession session, Model model) throws ParseException {
		User user= (User) session.getAttribute("user");
		model.addAttribute("orders",ordersService.findOrders(user.getId().toString()));
		return "index_header::table_refresh";
	}
	/**
	 * 查询全部订单
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/allorder",method = RequestMethod.POST)
	public List<Orders> findAllOrder(HttpSession session) throws ParseException {
		User user= (User) session.getAttribute("user");
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
     */
	@ResponseBody
    @RequestMapping(value="/search",method = RequestMethod.POST)
    public Result findSearch( @RequestBody Map searchMap){
        return new Result(true,StatusCode.OK,"查询成功",adminService.findSearch(searchMap));
    }
	
	/**
	 * 增加
	 * @param admin
	 */
	@ResponseBody
	@RequestMapping(method=RequestMethod.POST)
	public Result add(@RequestBody Admin admin  ){
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
		Admin admindmin= (Admin) session.getAttribute("admin");
		Admin admins=adminService.findById(admindmin.getId());
		boolean old=encoder.matches(oldpad,admins.getPassword());
		if (old){
			String newPassd=encoder.encode(passwd);
			admins.setPassword(newPassd);
			adminService.update(admins);
			return new Result(true,StatusCode.OK,"成功");
		}else {
			return new Result(false,StatusCode.ERROR,"更新失败");
		}
	}
}
订单管理控制层:
/**
 * 控制器层
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
		return ordersService.add(orders,user.getId(),orders.getId(),orders.getQty());
	}
	
	/**
	 * 修改
	 * @param
	 */
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.PUT)
	public Result update(@PathVariable Long id){
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
			return new Result(false,StatusCode.ERROR,"请填写酒店地址");
		}
		if(StringUtils.isEmpty(hotel.getMiaoshu())){
			return new Result(false,StatusCode.ERROR,"请填写酒店描述");
		}
		hotel.setCommentCount(0);
		hotel.setStar(0);
		if(hotelService.add(hotel)==null){
			return new Result(false,StatusCode.ERROR,"酒店添加失败");
		}
		return new Result(true,StatusCode.OK,"添加成功");
	}
	/**
	 * 分页+多条件查询
	 * @param searchMap 查询条件封装
	 * @param page 页码
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
		adminService.update(admin);		
		return new Result(true,StatusCode.OK,"修改成功");
	}
	
	/**
	 * 删除
	 * @param id
	 */
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
	public Result delete(@PathVariable String id ){
		adminService.deleteById(id);
		return new Result(true,StatusCode.OK,"删除成功");
	}
	/**
	 * 管理员跳转
	 * @return
	 */
	@RequestMapping(value = "/adminlogin")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
	 */
	@ResponseBody
	@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
	public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
		Page<Orders> pageList = ordersService.findSearch(searchMap, page, size);
		return  new Result(true,StatusCode.OK,"查询成功",  new PageResult<Orders>(pageList.getTotalElements(), pageList.getContent()) );
	}
	/**
     * 根据条件查询
     * @param searchMap
     * @return
     */
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
@Controller
@CrossOrigin
@RequestMapping("/orders")
public class OrdersController {
	@Autowired
	private OrdersService ordersService;
	@Autowired
	private HotelOrdersService hotel_ordersService;
	@Autowired
	private HotelService hotelService;
	@Autowired
	private ScenicService scenicService;
	
	/**
	 * 查询全部数据
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

适用

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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/213120
推荐阅读
相关标签
  

闽ICP备14008679号