Java项目:旅游管理系统(java+SpringBoot+Mybaits+Vue+elementui+mysql)

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

项目介绍

基于Springboot+vue的旅游网站的设计与实现

本系统分为前后台,包含管理员、用户两种角色,前台为普通用户登录,后台为管理员、用户分别登录。

前台主要功能:首页、旅游线路、最新线路、旅游资讯、个人中心、购物车、客服、用户登录、用户注册等功能;

后台管理员主要功能:首页、个人中心、用户管理、线路分类管理、旅游线路管理、最新线路管理、系统管理、订单管理等。


环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;


技术栈

后端:SpringBoot+Mybaits

前端:Vue+elementui


使用说明

项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入地址:
前台地址:http://localhost:8080/springbootmt74k/front/index.html

后台地址
http://localhost:8080/springbootmt74k/admin/dist/index.html
管理员:abo 密码:abo


注意项目文件路径中不能含有中文、空格、特殊字符等,否则图片会上传不成功。

系统登录页面展示:

旅游路线页面展示:

 

最新线路页面展示:

 

 轮播图管理页面展示:

 

旅游咨询页面展示:

 

旅游路线推荐页面展示:

 

路线页面展示:

 

 

路线名称管理页面展示:

 

 旅游用户登录页面展示:

用户管理控制层: 

@Controller
@RequestMapping("/manager")
public class UserController extends BaseController {

    @Autowired
    UserService userService;

    @RequestMapping("/userList")
    public ModelAndView userList(PageParam pageParam, @RequestParam(value = "query", required = false) String query) {
        ModelAndView mv = this.getModeAndView();
        if(pageParam.getPageNumber()<1){
            pageParam =new PageParam();
            long count = 0;
            try {
                count = userService.count();
            } catch (Exception e) {
                e.printStackTrace();
            }
            pageParam.setCount(count);
            if(count<=10){
                pageParam.setSize(1);
            }else{
                pageParam.setSize(count%10==0?count/10:count/10+1);
            }
            pageParam.setPageNumber(1);
            pageParam.setPageSize(10);
        }
        List<User> list = userService.findByPage(pageParam.getPageNumber(),pageParam.getPageSize(), query);
        mv.addObject("pageData", list);
        if (Tools.notEmpty(query)) {
            mv.addObject("query", query);
            pageParam.setCount(list.size());
            if (list.size() > pageParam.getPageSize()) {
                pageParam.setSize(list.size() / pageParam.getPageSize());
            } else {
                pageParam.setSize(1);
            }
        }
        mv.addObject("pageParam",pageParam);
        mv.setViewName("user/allUsers");
        return mv;
    }


    @RequestMapping("/userAdd")
    public ModelAndView userAdd(){
        ModelAndView mv = this.getModeAndView();
        mv.addObject("entity",new User());
        mv.setViewName("user/userEdit");
        return mv;
    }

    @RequestMapping("/userView")
    public ModelAndView userView(String id){
        ModelAndView mv = this.getModeAndView();
        try {
            mv.addObject("entity",userService.findById(id));
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("user/userView");
        return mv;
    }

    @RequestMapping("/userEdit")
    public ModelAndView userEdit(String id){
        ModelAndView mv = this.getModeAndView();
        try {
            mv.addObject("entity",userService.findById(id));
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("user/userEdit");
        return mv;
    }

    @RequestMapping("/userSave")
    public ModelAndView userSave(HttpServletRequest request, String id, RedirectAttributes redirectAttributes){
        ModelAndView mv = this.getModeAndView();
        User entity = null;
        try {
            if(Tools.notEmpty(id)){
                entity = userService.findById(id);
            }else{
                entity = new User();
            }
            this.bindValidateRequestEntity(request,entity);
            if (Tools.isEmpty(entity.getId())){
                User object = userService.findByUserName(entity.getUserName());
                if (object != null) {
                    mv.addObject("message","用户名已存在!");
                    mv.addObject("entity",entity);
                    mv.setViewName("user/userEdit");
                    return mv;
                }
                entity.setId(Tools.getUUID());
                userService.save(entity);
            }else{
                userService.update(entity);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        mv.addObject("pageData", userService.findByPage(1, 10,null));
        PageParam pageParam =new PageParam();
        long count = 0;
        try {
            count = userService.count();
        } catch (Exception e) {
            e.printStackTrace();
        }
        pageParam.setCount(count);
        if(count<=10){
            pageParam.setSize(1);
        }else{
            pageParam.setSize(count%10==0?count/10:count/10+1);
        }
        pageParam.setPageNumber(1);
        pageParam.setPageSize(10);
        mv.addObject("pageParam",pageParam);
        mv.setViewName("user/allUsers");
        return mv;
    }

    @RequestMapping("/userDelete")
    public String userDelete(String id){
        if(Tools.notEmpty(id)){
            try {
                userService.deleteByid(id);
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return REDIRECT+"/manager/userList";
    }
}

 管理员订单管理控制层:

@Controller
@RequestMapping("/manager")
public class OrderController extends BaseController {

    @Autowired
    OrderService orderService;

    @RequestMapping("/orderList")
    public ModelAndView orderList(PageParam pageParam, @RequestParam(value = "query", required = false) String query) {
        ModelAndView mv = this.getModeAndView();
        if(pageParam.getPageNumber()<1){
            pageParam =new PageParam();
            long count = 0;
            try {
                count = orderService.count();
            } catch (Exception e) {
                e.printStackTrace();
            }
            pageParam.setCount(count);
            if(count<=10){
                pageParam.setSize(1);
            }else{
                pageParam.setSize(count%10==0?count/10:count/10+1);
            }
            pageParam.setPageNumber(1);
            pageParam.setPageSize(10);
        }
        List<Order> list = orderService.findByPage(pageParam.getPageNumber(),pageParam.getPageSize(), query);
        mv.addObject("pageData", list);
        if (Tools.notEmpty(query)) {
            mv.addObject("query", query);
            pageParam.setCount(list.size());
            if (list.size() > pageParam.getPageSize()) {
                pageParam.setSize(list.size() / pageParam.getPageSize());
            } else {
                pageParam.setSize(1);
            }
        }
        mv.addObject("pageParam",pageParam);
        mv.setViewName("order/orderList");
        return mv;
    }

    @RequestMapping("/orderAdd")
    public ModelAndView travelRouteAdd(){
        ModelAndView mv = this.getModeAndView();
        mv.addObject("entity",new Order());
        mv.setViewName("order/orderEdit");
        return mv;
    }

    @RequestMapping("/orderView")
    public ModelAndView orderView(String id){
        ModelAndView mv = this.getModeAndView();
        try {
            mv.addObject("entity",orderService.findById(id));
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("order/orderView");
        return mv;
    }

    @RequestMapping("/orderEdit")
    public ModelAndView orderEdit(String id){
        ModelAndView mv = this.getModeAndView();
        try {
            mv.addObject("entity",orderService.findById(id));
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("order/orderEdit");
        return mv;
    }

    @RequestMapping("/orderSave")
    public String orderSave(HttpServletRequest request, String id){
        Order entity = null;
        try {
            if(Tools.notEmpty(id)){
                entity = orderService.findById(id);
            }else{
                entity = new Order();
            }
            this.bindValidateRequestEntity(request,entity);
            if (Tools.isEmpty(entity.getId())){
                entity.setId(Tools.getUUID());
                orderService.save(entity);
            }else{
                orderService.update(entity);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return REDIRECT+"/manager/orderList";
    }

    @RequestMapping("/orderDelete")
    public String orderDelete(String id){
        if(Tools.notEmpty(id)){
            try {
                orderService.deleteByid(id);
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return REDIRECT+"/manager/orderList";
    }
}

旅行路线管理控制层: 

@Controller
@RequestMapping("/manager")
public class TravelRouteController extends BaseController {

    @Autowired
    TravelRouteService travelRouteService;

    @Value("${yuanlrc.filePath}")
    private String filePath;
    @RequestMapping("/travelRouteList")
    public ModelAndView travelRouteList(PageParam pageParam, @RequestParam(value = "query", required = false) String query){
        ModelAndView mv = this.getModeAndView();
        if(pageParam.getPageNumber()<1){
            pageParam =new PageParam();
            long count = 0;
            try {
                count = travelRouteService.count();
            } catch (Exception e) {
                e.printStackTrace();
            }
            pageParam.setCount(count);
            if(count<=10){
                pageParam.setSize(1);
            }else{
                pageParam.setSize(count%10==0?count/10:count/10+1);
            }
            pageParam.setPageNumber(1);
            pageParam.setPageSize(10);
        }
        List<TravelRoute> list = travelRouteService.findByPage(pageParam.getPageNumber(),pageParam.getPageSize(), query);
        mv.addObject("pageData", list);
        if (Tools.notEmpty(query)) {
            mv.addObject("query", query);
            pageParam.setCount(list.size());
            if (list.size() > pageParam.getPageSize()) {
                pageParam.setSize(list.size() / pageParam.getPageSize());
            } else {
                pageParam.setSize(1);
            }
        }
        mv.addObject("pageParam",pageParam);
        mv.setViewName("travelRoute/travelRouteList");
        return mv;
    }

    @RequestMapping("/travelRouteAdd")
    public ModelAndView travelRouteAdd(){
        ModelAndView mv = this.getModeAndView();
        mv.addObject("entity",new TravelRoute());
        mv.setViewName("travelRoute/travelRouteEdit");
        return mv;
    }

    @RequestMapping("/travelRouteView")
    public ModelAndView travelRouteView(String id){
        ModelAndView mv = this.getModeAndView();
        try {
            mv.addObject("entity",travelRouteService.findById(id));
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("travelRoute/travelRouteView");
        return mv;
    }

    @RequestMapping("/travelRouteEdit")
    public ModelAndView travelRouteEdit(String id){
        ModelAndView mv = this.getModeAndView();
        try {
            mv.addObject("entity",travelRouteService.findById(id));
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("travelRoute/travelRouteEdit");
        return mv;
    }

    @RequestMapping("/travelRouteSave")
    public String travelRouteSave(HttpServletRequest request, String id, @RequestParam("fileName") MultipartFile file){
        TravelRoute entity = null;
        try {
            if(Tools.notEmpty(id)){
                entity = travelRouteService.findById(id);
            }else{
                entity = new TravelRoute();
            }
            this.bindValidateRequestEntity(request,entity);
            if(file != null && !file.isEmpty()){
                String fileName = file.getOriginalFilename();
                int size = (int) file.getSize();
                System.out.println(fileName + "-->" + size);

                String path =filePath+"/travelRoute";
                File dest = new File(path + "/" + fileName);
                if(!dest.getParentFile().exists()){ //判断文件父目录是否存在
                    dest.getParentFile().mkdir();
                }
                try {
                    file.transferTo(dest); //保存文件
                    entity.setImgUrl("/travelRoute/" + fileName);
                } catch (IllegalStateException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (Tools.isEmpty(entity.getId())){
                entity.setId(Tools.getUUID());
                travelRouteService.save(entity);
            }else{
                travelRouteService.update(entity);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return REDIRECT+"/manager/travelRouteList";
    }

    @RequestMapping("/travelRouteDelete")
    public String travelRouteDelete(String id){
        if(Tools.notEmpty(id)){
            try {
                travelRouteService.deleteByid(id);
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return REDIRECT+"/manager/travelRouteList";
    }
}

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

beyondwild

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

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

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

打赏作者

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

抵扣说明:

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

余额充值