欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

springboot+layUI可视化旅游网站 旅游管理系统 开发分享

程序员文章站 2024-01-15 22:26:16
...

介绍

我哥家公司开业了,接了一个旅游网站,我俩一起开发的,在这里跟大家分享一下开发过程,帮助大家捋顺软件开发过程

开发技术

前端:layUI echarts thymeleaf

后端:springboot jpa mysql maven

模块介绍以及源代码分享

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
具体实现代码如下:

package com.cn.travel.web.portal;

import com.cn.travel.cms.strategy.service.imp.StrategyService;
import com.cn.travel.web.base.BaseController;
import com.cn.travel.web.base.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class StrategyPortalController extends BaseController {

    @Autowired
    StrategyService strategyService;

    @RequestMapping("/strategy")
    public ModelAndView strategy(PageParam pageParam) throws Exception {
        ModelAndView mv = this.getModeAndView();
        if(pageParam.getPageNumber()<1){
            pageParam =new PageParam();
            long count = 0;
            try {
                count = strategyService.state1count();
            } catch (Exception e) {
                e.printStackTrace();
            }
            pageParam.setCount(count);
            if(count<=7){
                pageParam.setSize(1);
            }else{
                pageParam.setSize(count%7==0?count/7:count/7+1);
            }
            pageParam.setPageNumber(1);
            pageParam.setPageSize(7);
        }
        mv.addObject("pageData", strategyService.findByPage(pageParam.getPageNumber(),pageParam.getPageSize()));
        mv.addObject("pageParam",pageParam);
        mv.setViewName("portal/strategy");
        return mv;
    }

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

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
具体实现代码如下:

package com.cn.travel.web.portal;

import com.cn.travel.cms.insurance.entity.Insurance;
import com.cn.travel.cms.insurance.service.imp.InsuranceService;
import com.cn.travel.cms.order.entity.Order;
import com.cn.travel.cms.order.service.imp.OrderService;
import com.cn.travel.cms.travelRoute.entity.TravelRoute;
import com.cn.travel.cms.travelRoute.service.imp.TravelRouteService;
import com.cn.travel.role.user.entity.User;
import com.cn.travel.role.user.service.imp.UserService;
import com.cn.travel.utils.Tools;
import com.cn.travel.web.base.BaseController;
import com.cn.travel.web.base.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;
import java.util.Date;

@Controller
public class InsurancePortalController extends BaseController {
    @Autowired
    InsuranceService insuranceService;
    @Autowired
    UserService userService;
    @Autowired
    OrderService orderService;

    @RequestMapping("/insurance")
    public ModelAndView insurance(PageParam pageParam){
        ModelAndView mv = this.getModeAndView();
        if(pageParam.getPageNumber()<1){
            pageParam =new PageParam();
            long count = 0;
            try {
                count = insuranceService.state1count();
            } catch (Exception e) {
                e.printStackTrace();
            }
            pageParam.setCount(count);
            if(count<=7){
                pageParam.setSize(1);
            }else{
                pageParam.setSize(count%7==0?count/7:count/7+1);
            }
            pageParam.setPageNumber(1);
            pageParam.setPageSize(7);
        }
        mv.addObject("pageData", insuranceService.findByPage(pageParam.getPageNumber(),pageParam.getPageSize()));
        mv.addObject("pageParam",pageParam);
        mv.setViewName("portal/insurance");
        return mv;
    }

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

    @RequestMapping("/insuranceCreatOrder")
    public ModelAndView travelRouteCreatOrder(String id,HttpSession httpSession){
        ModelAndView mv = this.getModeAndView();
        try {
            Insurance insurance = insuranceService.findById(id);
            User user = userService.findByUserName(httpSession.getAttribute("userName").toString());
            Order order  = new Order();
            order.setImgUrl(insurance.getImgUrl());
            order.setId(Tools.getUUID());
            order.setUserId(user.getId());
            order.setUserName(user.getUserName());
            order.setProductId(insurance.getId());

            order.setProductName(insurance.getTitle());
            order.setFee(insurance.getPrice());
            order.setProductType(4);
            order.setLinkTel(user.getLinkTel());
            order.setIcCode(user.getIcCode());
            order.setRequirement("无");
            order.setState(0);
            order.setOrderCode("O"+Tools.getUUID().substring(0,6).toUpperCase());
            order.setOrderTime(Tools.date2Str(new Date(),"yyyy-MM-dd"));
            order.setSetoffTime(Tools.date2Str(new Date(),"yyyy-MM-dd"));
            orderService.save(order);
            mv.addObject("entity",insurance);
            mv.addObject("CreatSuccess",true);
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("portal/insuranceView");
        return mv;
    }
}

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
具体实现代码如下:

package com.cn.travel.web.portal;

import com.cn.travel.cms.order.entity.Order;
import com.cn.travel.cms.order.service.imp.OrderService;
import com.cn.travel.cms.travelRoute.entity.TravelRoute;
import com.cn.travel.cms.travelRoute.service.imp.TravelRouteService;
import com.cn.travel.role.user.entity.User;
import com.cn.travel.role.user.service.imp.UserService;
import com.cn.travel.utils.Tools;
import com.cn.travel.web.base.BaseController;
import com.cn.travel.web.base.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;
import java.util.Date;

@Controller
public class TravelRoutePortalController extends BaseController {

    @Autowired
    TravelRouteService travelRouteService;
    @Autowired
    UserService userService;
    @Autowired
    OrderService orderService;

    @RequestMapping("/travelRoute")
    public ModelAndView travelRoute(PageParam pageParam){
        ModelAndView mv = this.getModeAndView();
        if(pageParam.getPageNumber()<1){
            pageParam =new PageParam();
            long count = 0;
            try {
                count = travelRouteService.count2();
            } catch (Exception e) {
                e.printStackTrace();
            }
            pageParam.setCount(count);
            if(count<=7){
                pageParam.setSize(1);
            }else{
                pageParam.setSize(count%7==0?count/7:count/7+1);
            }
            pageParam.setPageNumber(1);
            pageParam.setPageSize(7);
        }
        mv.addObject("pageData", travelRouteService.findByPage(pageParam.getPageNumber(),pageParam.getPageSize()));
        mv.addObject("pageParam",pageParam);
        mv.setViewName("portal/travelRoute");
        return mv;
    }

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

    @RequestMapping("/travelRouteCreatOrder")
    public ModelAndView travelRouteCreatOrder(String id,HttpSession httpSession){
        ModelAndView mv = this.getModeAndView();
        try {
            TravelRoute travelRoute = travelRouteService.findById(id);
            User user = userService.findByUserName(httpSession.getAttribute("userName").toString());
            Order order  = new Order();
            order.setImgUrl(travelRoute.getImgUrl());
            order.setId(Tools.getUUID());
            order.setUserId(user.getId());
            order.setUserName(user.getUserName());
            order.setProductId(travelRoute.getId());
            order.setProductName(travelRoute.getTitle());
            order.setFee(travelRoute.getPrice());
            order.setProductType(0);
            order.setLinkTel(user.getLinkTel());
            order.setIcCode(user.getIcCode());
            order.setRequirement("无");
            order.setState(0);
            order.setOrderCode("O"+Tools.getUUID().substring(0,6).toUpperCase());
            order.setOrderTime(Tools.date2Str(new Date(),"yyyy-MM-dd"));
            order.setSetoffTime(travelRoute.getStartTime());
            orderService.save(order);
            mv.addObject("entity",travelRoute);
            mv.addObject("CreatSuccess",true);
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("portal/travelRouteView");
        return mv;
    }
}

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

package com.cn.travel.web.portal;

import com.cn.travel.cms.hotel.entity.Hotel;
import com.cn.travel.cms.hotel.service.imp.HotelService;
import com.cn.travel.cms.order.entity.Order;
import com.cn.travel.cms.order.service.imp.OrderService;
import com.cn.travel.role.user.entity.User;
import com.cn.travel.role.user.service.imp.UserService;
import com.cn.travel.utils.Tools;
import com.cn.travel.web.base.BaseController;
import com.cn.travel.web.base.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Date;

@Controller
public class HotelPortalController extends BaseController {

    @Autowired
    HotelService hotelService;
    @Autowired
    UserService userService;
    @Autowired
    OrderService orderService;

    @RequestMapping("/hotelAccommodation")
    public ModelAndView hotelAccommodation(PageParam pageParam){
        ModelAndView mv = this.getModeAndView();
        if(pageParam.getPageNumber()<1){
            pageParam =new PageParam();
            long count = 0;
            try {
                count = hotelService.count();
            } catch (Exception e) {
                e.printStackTrace();
            }
            pageParam.setCount(count);
            if(count<=7){
                pageParam.setSize(1);
            }else{
                pageParam.setSize(count%7==0?count/7:count/7+1);
            }
            pageParam.setPageNumber(1);
            pageParam.setPageSize(7);
        }
        mv.addObject("pageData", hotelService.findByPage(pageParam.getPageNumber(),pageParam.getPageSize()));
        mv.addObject("pageParam",pageParam);
        mv.setViewName("portal/hotelAccommodation");
        return mv;
    }

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

    @RequestMapping("/goReserve")
    public ModelAndView goReserve(String id,HttpSession httpSession){
        ModelAndView mv = this.getModeAndView();
        try {
            mv.addObject("entity",hotelService.findById(id));
            mv.addObject("user",userService.findByUserName(httpSession.getAttribute("userName").toString()));
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("portal/reserve");
        return mv;
    }

    @RequestMapping("/hotelCreatOrder")
    public ModelAndView hotelCreatOrder(String hotelId, HttpServletRequest request,HttpSession httpSession){
        ModelAndView mv = this.getModeAndView();
        try {
            Hotel hotel = hotelService.findById(hotelId);
            User user = userService.findByUserName(httpSession.getAttribute("userName").toString());
            Order order  = new Order();
            this.bindValidateRequestEntity(request,order);
            order.setId(Tools.getUUID());
            order.setUserId(user.getId());
            if(Tools.isEmpty(order.getUserName())){
                order.setUserName(user.getUserName());
            }
            if(Tools.isEmpty(order.getLinkTel())){
                order.setLinkTel(user.getLinkTel());
            }
            if(Tools.isEmpty(order.getIcCode())){
                order.setIcCode(user.getIcCode());
            }
            order.setProductId(hotel.getId());
            order.setImgUrl(hotel.getImgUrl());
            order.setProductName(hotel.getHotelName());
            order.setProductType(2);
            order.setState(0);
            order.setOrderCode("O"+Tools.getUUID().substring(0,6).toUpperCase());
            order.setOrderTime(Tools.date2Str(new Date(),"yyyy-MM-dd"));
            orderService.save(order);
            mv.addObject("entity",hotel);
            mv.addObject("CreatSuccess",true);
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("portal/hotelAccommodationView");
        return mv;
    }
}

springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

package com.cn.travel.web.portal;

import com.cn.travel.cms.hotel.entity.Hotel;
import com.cn.travel.cms.hotel.service.imp.HotelService;
import com.cn.travel.cms.order.entity.Order;
import com.cn.travel.cms.order.service.imp.OrderService;
import com.cn.travel.role.user.entity.User;
import com.cn.travel.role.user.service.imp.UserService;
import com.cn.travel.utils.Tools;
import com.cn.travel.web.base.BaseController;
import com.cn.travel.web.base.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Date;

@Controller
public class HotelPortalController extends BaseController {

    @Autowired
    HotelService hotelService;
    @Autowired
    UserService userService;
    @Autowired
    OrderService orderService;

    @RequestMapping("/hotelAccommodation")
    public ModelAndView hotelAccommodation(PageParam pageParam){
        ModelAndView mv = this.getModeAndView();
        if(pageParam.getPageNumber()<1){
            pageParam =new PageParam();
            long count = 0;
            try {
                count = hotelService.count();
            } catch (Exception e) {
                e.printStackTrace();
            }
            pageParam.setCount(count);
            if(count<=7){
                pageParam.setSize(1);
            }else{
                pageParam.setSize(count%7==0?count/7:count/7+1);
            }
            pageParam.setPageNumber(1);
            pageParam.setPageSize(7);
        }
        mv.addObject("pageData", hotelService.findByPage(pageParam.getPageNumber(),pageParam.getPageSize()));
        mv.addObject("pageParam",pageParam);
        mv.setViewName("portal/hotelAccommodation");
        return mv;
    }

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

    @RequestMapping("/goReserve")
    public ModelAndView goReserve(String id,HttpSession httpSession){
        ModelAndView mv = this.getModeAndView();
        try {
            mv.addObject("entity",hotelService.findById(id));
            mv.addObject("user",userService.findByUserName(httpSession.getAttribute("userName").toString()));
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("portal/reserve");
        return mv;
    }

    @RequestMapping("/hotelCreatOrder")
    public ModelAndView hotelCreatOrder(String hotelId, HttpServletRequest request,HttpSession httpSession){
        ModelAndView mv = this.getModeAndView();
        try {
            Hotel hotel = hotelService.findById(hotelId);
            User user = userService.findByUserName(httpSession.getAttribute("userName").toString());
            Order order  = new Order();
            this.bindValidateRequestEntity(request,order);
            order.setId(Tools.getUUID());
            order.setUserId(user.getId());
            if(Tools.isEmpty(order.getUserName())){
                order.setUserName(user.getUserName());
            }
            if(Tools.isEmpty(order.getLinkTel())){
                order.setLinkTel(user.getLinkTel());
            }
            if(Tools.isEmpty(order.getIcCode())){
                order.setIcCode(user.getIcCode());
            }
            order.setProductId(hotel.getId());
            order.setImgUrl(hotel.getImgUrl());
            order.setProductName(hotel.getHotelName());
            order.setProductType(2);
            order.setState(0);
            order.setOrderCode("O"+Tools.getUUID().substring(0,6).toUpperCase());
            order.setOrderTime(Tools.date2Str(new Date(),"yyyy-MM-dd"));
            orderService.save(order);
            mv.addObject("entity",hotel);
            mv.addObject("CreatSuccess",true);
        }catch (Exception e){
            e.printStackTrace();
        }
        mv.setViewName("portal/hotelAccommodationView");
        return mv;
    }
}

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

    @RequestMapping("/registering")
    public ModelAndView registering(HttpServletRequest request, String checkPassword, RedirectAttributes redirectAttributes) throws Exception{
        User user = new User();
        this.bindValidateRequestEntity(request,user);
        if(Tools.isEmpty(user)){
            redirectAttributes.addFlashAttribute("message","用户名密码不得为空!");
            return new ModelAndView(new RedirectView("/register"));
        }
        if(!user.getPassword().equals(checkPassword)){
            redirectAttributes.addFlashAttribute("message","密码与确认密码不一致!");
            return new ModelAndView(new RedirectView("/register"));
        }
        User entity = userService.findByUserName(user.getUserName());
        if (entity != null) {
            redirectAttributes.addFlashAttribute("message","用户名已存在!");
            return new ModelAndView(new RedirectView("/register"));
        }
        try {
            user.setId(Tools.getUUID());
            user.setState(1);
            userService.save(user);
        } catch (Exception e) {
            e.printStackTrace();
        }
        redirectAttributes.addFlashAttribute("message","注册成功,请登陆!");
        return new ModelAndView(new RedirectView("/goLogin"));
    }

springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

    @RequestMapping("/userLoging")
    public ModelAndView userLoging(String userName,String password,RedirectAttributes redirectAttributes,HttpSession httpSession){
        if(Tools.notEmpty(httpSession.getAttribute("userName"))){
            return new ModelAndView(new RedirectView("/userCenter"));
        }
        if (Tools.isEmpty(userName)||Tools.isEmpty(password)){
            redirectAttributes.addFlashAttribute("message","用户名密码不得为空!");
            return new ModelAndView(new RedirectView("/goLogin"));
        }
        try {
            User user = userService.login(userName, password);
            if (Tools.isEmpty(user)){
                redirectAttributes.addFlashAttribute("message","用户名不存在或密码错误!");
                return new ModelAndView(new RedirectView("/goLogin"));
            }else{
                if (user.getState() == 1) {
                    httpSession.setAttribute("userName",userName);
                    return new ModelAndView(new RedirectView("/userCenter"));
                } else {
                    redirectAttributes.addFlashAttribute("message","账户已被注销!");
                    return new ModelAndView(new RedirectView("/goLogin"));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ModelAndView(new RedirectView("/goLogin"));
    }

springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

package com.cn.travel.web.portal;

import com.cn.travel.web.base.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class UserCenterController extends BaseController {

    @RequestMapping("/userCenter")
    public ModelAndView userCenter(){
        ModelAndView mv = this.getModeAndView();
        mv.setViewName("portal/userCenter");
        return mv;
    }

}

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
具体实现代码如下:

package com.cn.travel.web.portal;

import com.cn.travel.cms.order.entity.Order;
import com.cn.travel.cms.order.service.imp.OrderService;
import com.cn.travel.role.user.entity.User;
import com.cn.travel.role.user.service.imp.UserService;
import com.cn.travel.web.base.BaseController;
import com.cn.travel.web.base.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

@Controller
public class OrderPortalController extends BaseController {

    @Autowired
    UserService userService;
    @Autowired
    OrderService orderService;

    @RequestMapping("/myOrder")
    public ModelAndView myOrder(HttpSession httpSession,
                                @RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
                                @RequestParam(value = "pageSize", required = false, defaultValue = "7") int pageSize
    ) throws Exception {
        ModelAndView mv = this.getModeAndView();
        User user = userService.findByUserName(httpSession.getAttribute("userName").toString());
        PageParam pageParam = orderService.findByPageByUserId(pageNum,pageSize,user.getId());
        mv.addObject("pageData", pageParam.getResult());
        mv.addObject("pageParam",pageParam);
        mv.setViewName("portal/myOrder");
        return mv;
    }

    @RequestMapping("/payOrder")
    public String payOrder(String id) throws Exception {
        Order order = orderService.findById(id);
        order.setState(1);
        orderService.update(order);
        return REDIRECT+"/myOrder";
    }

    @RequestMapping("/deleteOrder")
    public String deleteOrder(String id) throws Exception {
        Order order = orderService.findById(id);
        order.setState(2);
        orderService.update(order);
        return REDIRECT+"/myOrder";
    }
}

springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

package com.cn.travel.web.portal;

import com.cn.travel.cms.message.entity.Message;
import com.cn.travel.cms.message.service.IMessageService;
import com.cn.travel.role.user.entity.User;
import com.cn.travel.role.user.service.imp.UserService;
import com.cn.travel.utils.Tools;
import com.cn.travel.web.base.BaseController;
import com.cn.travel.web.base.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class MessagePortalController extends BaseController {

    @Autowired
    IMessageService messageService;
    @Autowired
    UserService userService;

    @RequestMapping("/myMessage")
    public ModelAndView myMessage(HttpSession httpSession) throws Exception {
        ModelAndView mv = this.getModeAndView();
        User user = userService.findByUserName(httpSession.getAttribute("userName").toString());
        mv.addObject("messageCount", messageService.countByUserId(user.getId()));
        mv.setViewName("portal/myMessage");
        return mv;
    }

    @RequestMapping("/saveMeessage")
    public ModelAndView saveMeessage(HttpSession httpSession,HttpServletRequest request) throws Exception {
        ModelAndView mv = this.getModeAndView();
        User user = userService.findByUserName(httpSession.getAttribute("userName").toString());
        Message message = new Message();
        this.bindValidateRequestEntity(request,message);
        message.setId(Tools.getUUID());
        message.setUserId(user.getId());
        message.setUserName(user.getUserName());
        message.setName(user.getName());
        message.setState(1);
        messageService.save(message);
        mv.addObject("messageCount", messageService.countByUserId(user.getId()));
        mv.addObject("message","保存成功!");
        mv.setViewName("portal/myMessage");
        return mv;
    }

    @RequestMapping("/messageList")
    public ModelAndView messageList(
            HttpSession httpSession,
            @RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
            @RequestParam(value = "pageSize", required = false, defaultValue = "7") int pageSize
    ) throws Exception {
        ModelAndView mv = this.getModeAndView();
        User user = userService.findByUserName(httpSession.getAttribute("userName").toString());
        PageParam pageParam = messageService.findByPageByUserId(pageNum,pageSize,user.getId());
        mv.addObject("pageData", pageParam.getResult());
        mv.addObject("pageParam",pageParam);
        mv.setViewName("portal/messageList");
        return mv;
    }
}

springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

package com.cn.travel.web.manager;

import com.cn.travel.role.admin.entity.Admin;
import com.cn.travel.role.admin.service.imp.AdminService;
import com.cn.travel.utils.Tools;
import com.cn.travel.web.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpServletRequest;

@Controller
public class LoginController extends BaseController {

    @Autowired
    AdminService adminService;

    @RequestMapping("/login")
    public String login(HttpServletRequest request){
        Object user = request.getSession().getAttribute("admin");
        if (user != null) {
            return REDIRECT+"/manager/index";
        }
        return "login";
    }

    @RequestMapping("/loging")
    public String loging(String userName,String password,RedirectAttributes redirectAttributes,HttpServletRequest request){
        if (Tools.isEmpty(userName)||Tools.isEmpty(password)){
            redirectAttributes.addFlashAttribute("message","用户名密码不得为空!");
            return REDIRECT+"/login";
        }
        try {
            Admin admin = adminService.login(userName, password);
            if (Tools.isEmpty(admin)){
                redirectAttributes.addFlashAttribute("message","用户名不存在或密码错误!");
                return REDIRECT+"/login";
            }else{
                if (admin.getState() == 1) {
                    request.getSession().setAttribute("admin", admin);
                    return REDIRECT+"/manager/index";
                } else {
                    redirectAttributes.addFlashAttribute("message","账户已被停用!");
                    return REDIRECT+"/login";
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return REDIRECT+"/login";
    }

    @RequestMapping("/logout")
    public String logout(HttpServletRequest request){
        Object user = request.getSession().getAttribute("admin");
        if (user != null) {
            request.getSession().removeAttribute("admin");
        }
        return "/login";
    }
}

springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

   @RequestMapping("/userData")
    public ModelAndView userDate()throws Exception{
        ModelAndView mv=this.getModeAndView();
        mv.addObject("state1",userService.state1count());
        mv.addObject("state2",userService.state2count());
        mv.setViewName("data/userData");
        return mv;
    }

springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

    @RequestMapping("/travelRouteData")
    public ModelAndView travelRouteDate()throws Exception{
        ModelAndView mv=this.getModeAndView();
        mv.addObject("state0",travelRouteService.state0count());
        mv.addObject("state1",travelRouteService.state1count());
        mv.addObject("state2",travelRouteService.state2count());
        mv.setViewName("data/travelRouteData");
        return mv;
    }

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
具体实现代码如下:

    @RequestMapping("/scenicSpotData")
    public ModelAndView scenicSpotDate()throws Exception{
        ModelAndView mv=this.getModeAndView();
        mv.addObject("state0",scenicSpotService.state0count());
        mv.addObject("state1",scenicSpotService.state1count());
        mv.addObject("state2",scenicSpotService.state2count());
        mv.setViewName("data/scenicSpotData");
        return mv;
    }

springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

    @RequestMapping("/orderData")
    public ModelAndView orderDate()throws Exception{
        ModelAndView mv=this.getModeAndView();
        mv.addObject("state0",orderService.state0count());
        mv.addObject("state1",orderService.state1count());
        mv.addObject("state2",orderService.state2count());
        mv.setViewName("data/orderData");
        return mv;
    }

springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

    @RequestMapping("/hotelData")
    public ModelAndView hotelDate()throws Exception{
        ModelAndView mv=this.getModeAndView();
        mv.addObject("state0",hotelService.state0count());
        mv.addObject("state1",hotelService.state1count());
        mv.addObject("state2",hotelService.state2count());
        mv.setViewName("data/hotelData");
        return mv;
    }

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
具体实现代码如下:

   @RequestMapping("/strategyData")
    public ModelAndView strategyDate()throws Exception{
        ModelAndView mv=this.getModeAndView();
        mv.addObject("state0",strategyService.state0count());
        mv.addObject("state1",strategyService.state1count());
        mv.addObject("state2",strategyService.state2count());
        mv.setViewName("data/strategyData");
        return mv;
    }

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
具体实现代码如下:

    @RequestMapping("/carData")
    public ModelAndView carDate()throws Exception{
        ModelAndView mv=this.getModeAndView();
        mv.addObject("state0",carService.state0count());
        mv.addObject("state1",carService.state1count());
        mv.addObject("state2",carService.state2count());
        mv.addObject("type0",carService.type0count());
        mv.addObject("type1",carService.type1count());
        mv.addObject("type2",carService.type2count());
        mv.setViewName("data/carData");
        return mv;
    }

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
springboot+layUI可视化旅游网站 旅游管理系统 开发分享

具体实现代码如下:

    @RequestMapping("/insuranceData")
    public ModelAndView insuranceDate()throws Exception{
        ModelAndView mv=this.getModeAndView();
        mv.addObject("state0",insuranceService.state0count());
        mv.addObject("state1",insuranceService.state1count());
        mv.addObject("state2",insuranceService.state2count());
        mv.addObject("company0",insuranceService.company0count());
        mv.addObject("company1",insuranceService.company1count());

        mv.setViewName("data/insuranceData");
        return mv;
    }

springboot+layUI可视化旅游网站 旅游管理系统 开发分享
springboot+layUI可视化旅游网站 旅游管理系统 开发分享
springboot+layUI可视化旅游网站 旅游管理系统 开发分享

讲两嘴

其实数据分析很简单,就是统计sql转化为json,前端用jQuery构造echarts图表,echarts这玩意直接官网超个例子,将对齐的json数据扔到echarts的模板代码里面即可,是不是很简单,然后利用springboot开发系统也简单,几行配置项目就启动了,没啥难度

运行视频

springboot可视化旅游网站 旅游管理系统 旅游平台