微服务项目|基于SpringCloud微服务技术的旅游信息平台的设计与实现

作者主页:编程千纸鹤

作者简介:Java、前端、Python开发多年,做过高程,项目经理,架构师

主要内容:Java项目开发、Python项目开发、大学数据和AI项目开发、单片机项目设计、面试技术整理、最新技术分享

收藏点赞不迷路  关注作者有好处

文末获得源码

项目编号:BS-PT-087

目录

一,环境介绍

二,项目简介

2.1 绪论

2.2 需求分析

 2.3  系统架构

三,系统展示

四,核心代码展示

五,相关作品展示


一,环境介绍

语言环境:Java:  jdk1.8

数据库:Mysql: mysql5.7

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

后台开发技术:springcloud微服务架构体系

前台开发技术:vue+elementui

二,项目简介

2.1 绪论

旅游业作为服务也的一个重要的模块,对推动我国经济发展有着重大作用,近几年的疫情影响导致旅游行业的全面停滞,对国家经济发展产生了极大的影响,因此加快旅游产业的恢复,多方面协同助力促进旅游业的发展,对推动国家的经济健康稳定发展可以形成巨大助力。IT行业实现助力旅游行业的发展,可以采用现有的成熟技术,打造一个用户交互性和友好型的旅游信息平台,解决用户与旅游之间的矛盾,实现用户与旅游之间到的信息可视化,信息安全化,服务个性化等特点,给用户带来更友好,舒适的旅游体验。

本文设计并实现了一款基于SpringCloud微服务架构旅游信息平台系统,根据市场上现有的相关平台,通过分析和总结它们的优缺点,确定本系统的功能结构。本系统更注重用户的友好性以及用户的交互性,将系统分为基础服务,订单服务,定时任务,用户中心,支付服务等微服务模块。该旅游信息平台UI界面美观化设计,页面整洁,增强用户的视觉舒适度;系统功能俱全,操作简单,增加平台的可用性和通用型。另外,使用SpringCloud微服务架构开发,增加平台的可扩展性。

2.2 需求分析

该系统由十个模块组成,每个模块拆分成能够独立运行的微服务系统模块,即后台管理系统模块、前台系统模块、用户系统模块、订单系统模块、单点登录系统模块、酒店系统模块、机票系统模块、火车票系统模块、攻略与景点模块。

后台管理系统模块:前台展示管理、用户管理、管理员管理、酒店管理、机票管理、火车票管理、攻略景点管理、订单管理、系统统计、管理员管理等功能。它包括对用户前台、用户信息、管理员信息、酒店信息、机票信息、攻略与景点信息、系统数据信息、订单信息的管理。

前台系统模块:包含前台展示、用户模块、酒店模块、机票模块、火车票模块、攻略景点模块、订单模块等,主要有用户与游客可以在前台系统中注册账号、登录系统、浏览所有商品(包括酒店、机票、火车票、景点门票)信息、购买商品,查看订单等操作。会员系统模块:用户可以查询系统中的订单、管理订单、优惠券等信息。

用户系统模块:用户可以注册账号、登录账号、修改个人信息比如密码,头像等,未登录的用户只能享受系统的部分功能,如酒店信息的查询,无法进行酒店房间预定服务。

订单系统模块:系统用户可以在本系统构面或预定酒店、机票、火车票、景区门票等,购买或预定完成会有相应的订单信息,用户可以通过订单或者根据账号信息查看或者修改订单信息。

单点登录系统模块:在本多个应用系统中,用户只需要登录一次就可以访问本平台所有的系统。

酒店系统模块:用户可以查看酒店信息,包括按城市、名称、评分、位置等搜索自己想要的酒店信息,同时还提供酒店信息排行榜,帮助用户快速的找到自己想要的酒店信息。酒店系统先通过查找酒店,再通过酒店查找所属的房间信息,完成房间的预定。

机票系统模块:用户可以按日期、出发城市以及目的地城市作为查询条件查询机票信息。

火车票系统模块:用户可以按日期、出发城市以及目的地城市作为查询条件查询火车票信息。

攻略与景点模块:该模块包括景点门票的购买以及攻略的分享。景点门票可通过城市、景点名称进行模糊查询。同时设置了一个景点热度榜,显示最近比较热度的景点,吸引用户打卡。

其主要功能模块图如图1所示

图1功能模块图

 2.3  系统架构

本旅游信息平台基于spring cloud微服务技术部署的Web项目,根据预计的需求,开发难度和性能需求等采用的架构形式是分层架构。系统的具体分层架构部署如图2所示。

图2系统部署图

系统分为前后台用户,前台用户主要是普通用户,普通用户包括登录用户和未登录用户。根据是否登录状态,用户访问的范围以及能够使用的功能都是不同的。后台用户主要是后台维护人员和后台管理员用户。前后台的用户访问范围资源如图3、图4所示。

图3旅游信息平台前台用例图

图4旅游信息平台后台

三,系统展示

前端用户注册登录

 

 酒店模块管理 

 

 机票信息展示

 火车票模块

 

 景点信息模块

 

 攻略模块

 

 后台管理

 其它略

四,核心代码展示

package com.lypt.controller;


import com.lypt.api.CommonResult;
import com.lypt.pojo.springcloud_graduation.User;
import com.lypt.pojo.vo.PhoneCode;
import com.lypt.service.UserService;
import com.lypt.uitls.RandomUtil;
import com.lypt.uitls.SMSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    public UserService userService;

    @Autowired
    SMSUtils smsUtils;


    /**
     * 登录
     * @param user
     * @return
     */
    @RequestMapping(value = "/login")
    public CommonResult login( User user) {
        System.out.println(user.toString());
        User user1 = userService.userByUsernameUserPass(user);
        if (user1 != null)
            return CommonResult.success(user1);
        else
            return CommonResult.validateFailed();
    }

    /**
     * 获取所有用户信息
     * @return
     */
    @RequestMapping("/getAll")
    public List<User> getAll(){
        List<User> list = userService.getAll();
        return list;
    }

    /**
     * 根据用户uid查询用户信息
     * @return
     */
    @RequestMapping("/getUserByUid")
    public CommonResult getUserByUid(Integer uid){
        User userByUid = userService.getUserByUid(uid);

        return CommonResult.success(userByUid);
    }

    /**
     * 修改用户信息
     * @return
     */
    @RequestMapping("/updateUser")
    public CommonResult updateUser(User user){
        User user1 = userService.updateUser(user);
        if (user1 != null){
            return CommonResult.success(user1);
        }else {
            return CommonResult.failed();
        }
    }

    /**
     * 添加用户信息
     * @return
     */
    @RequestMapping("/addUser")
    public CommonResult addUser(User user){
        User user1 = userService.addUser(user);
        if (user1 != null){
            return CommonResult.success(user1);
        }else {
            return CommonResult.failed();
        }
    }


    /**
     * 发送短信验证码
     * @param phone
     * @return
     */
    @RequestMapping("/code")
    public CommonResult code(String phone){

        //获取长度为四的验证码
        String getcode = RandomUtil.getcode(4);
        //发送短信验证码
        smsUtils.sendMsg(phone,getcode);

        PhoneCode phoneCode = new PhoneCode();
        phoneCode.setCode(getcode);
        phoneCode.setPhone(phone);
        //讲手机号和验证码发送给前台
        return CommonResult.success(phoneCode);
    }


}
package com.lypt.controller.admin;

import com.lypt.api.CommonResult;
import com.lypt.pojo.vo.*;
import com.lypt.service.*;
import com.lypt.uitls.ComparatorSort;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;

@RestController
@RequestMapping("/admin/echarts")
public class AdminEchartsController {

    @Autowired
    TrainOrderService trainOrderService;
    @Autowired
    ScenicOrderService scenicOrderService;
    @Autowired
    PlaneOrderService planeOrderService;
    @Autowired
    BookOrderService bookOrderService;
    @Autowired
    UserService userService;


    @RequestMapping("/topData")
    public CommonResult topData(){
        AdminTopData adminTopData = new AdminTopData();
        //用户数量
        adminTopData.setUserNumber(userService.AllUserNumber());
        //一周销售额
        Double totalPrice = 0.00;
        totalPrice+= trainOrderService.weekData();
        totalPrice+= scenicOrderService.weekData();
        totalPrice+=planeOrderService.weekData();
        totalPrice+= bookOrderService.weekData();

        adminTopData.setWeekSalesVolume(totalPrice);


        AllTypeOrderData allTypeOrderData1 = trainOrderService.allOrderData();
        AllTypeOrderData allTypeOrderData2 = scenicOrderService.allOrderData();
        AllTypeOrderData allTypeOrderData3 = planeOrderService.allOrderData();
        AllTypeOrderData allTypeOrderData4 = bookOrderService.allOrderData();
        //所有订单数量
        int totalNumber = 0;
        totalNumber+=allTypeOrderData1.getTotal();
        totalNumber+=allTypeOrderData2.getTotal();
        totalNumber+=allTypeOrderData3.getTotal();
        totalNumber+=allTypeOrderData4.getTotal();

        adminTopData.setAllOrderNumber(totalNumber);
        //总销售额
        Double allOrderPrice = 0.00;
        allOrderPrice+=allTypeOrderData1.getTotalPrice();
        allOrderPrice+=allTypeOrderData2.getTotalPrice();
        allOrderPrice+=allTypeOrderData3.getTotalPrice();
        allOrderPrice+=allTypeOrderData4.getTotalPrice();

        adminTopData.setAllSalesVolume(allOrderPrice);

        return CommonResult.success(adminTopData);

    }


    @RequestMapping("/weekBuyRanking")
    public CommonResult weekBuyRanking(){
        WeekSalesVolume weekSalesVolume1 = new WeekSalesVolume();
        WeekSalesVolume weekSalesVolume2 = new WeekSalesVolume();
        WeekSalesVolume weekSalesVolume3 = new WeekSalesVolume();
        WeekSalesVolume weekSalesVolume4 = new WeekSalesVolume();

        weekSalesVolume1.setTypeName("酒店");
        weekSalesVolume1.setMoney(bookOrderService.weekData());
        weekSalesVolume2.setTypeName("机票");
        weekSalesVolume2.setMoney(planeOrderService.weekData());
        weekSalesVolume3.setTypeName("火车票");
        weekSalesVolume3.setMoney(trainOrderService.weekData());
        weekSalesVolume4.setTypeName("景点门票");
        weekSalesVolume4.setMoney(scenicOrderService.weekData());

        ArrayList<Object> list = new ArrayList<>();
        list.add(weekSalesVolume1);
        list.add(weekSalesVolume2);
        list.add(weekSalesVolume3);
        list.add(weekSalesVolume4);

        ComparatorSort comparatorSort = new ComparatorSort();
        Collections.sort(list,comparatorSort);

        return CommonResult.success(list);

    }

    @RequestMapping("/allBuyTotal")
    public CommonResult allBuyTotal(){
        ArrayList<Object> list = new ArrayList<>();

        AllSalesVolume allSalesVolume1 = new AllSalesVolume();
        AllSalesVolume allSalesVolume2 = new AllSalesVolume();
        AllSalesVolume allSalesVolume3 = new AllSalesVolume();
        AllSalesVolume allSalesVolume4 = new AllSalesVolume();
        allSalesVolume1.setName("酒店");
        allSalesVolume1.setValue(bookOrderService.allOrderData().getTotalPrice());
        allSalesVolume2.setName("机票");
        allSalesVolume2.setValue(planeOrderService.allOrderData().getTotalPrice());
        allSalesVolume3.setName("火车票");
        allSalesVolume3.setValue(trainOrderService.allOrderData().getTotalPrice());
        allSalesVolume4.setName("景区门票");
        allSalesVolume4.setValue(scenicOrderService.allOrderData().getTotalPrice());

        list.add(allSalesVolume1);
        list.add(allSalesVolume2);
        list.add(allSalesVolume3);
        list.add(allSalesVolume4);

        return CommonResult.success(list);

    }


    @RequestMapping("/weekScenicDay")
    public CommonResult weekScenicDay(){
        WeekOnDay weekOnDay = scenicOrderService.weekOrderNumber();

        return CommonResult.success(weekOnDay);
    }







}
package com.lypt.controller.admin;


import com.github.pagehelper.PageInfo;
import com.lypt.api.CommonResult;
import com.lypt.pojo.springcloud_graduation.Manage;
import com.lypt.pojo.vo.Page;
import com.lypt.pojo.vo.Users;
import com.lypt.pojo.vo.Users2;
import com.lypt.service.ManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@PropertySource("classpath:nginxconfig.properties")
@RestController
@RequestMapping("/admin")
public class AdminManageController {

    @Value("${pichost}")
    private String pichost;

    @Autowired
    ManageService manageService;

    @RequestMapping("/userInfo")
    public CommonResult userInfo(){

        ArrayList<String> list = new ArrayList<>();
        list.add("admin");

        Users user = new Users();
        user.setUsername("admin");
        user.setAvatar("https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        user.setPermissions(list);

        return CommonResult.success(user);
    }

    @RequestMapping("/login")
    public CommonResult login(){

        Users2 users2 = new Users2();

        users2.setAccessToken("admin");

        return CommonResult.success(users2);

    }


    @RequestMapping("/manage/getAllList")
    public CommonResult getAllList(Page page,Manage manage){

        List<Manage> allList = manageService.getAllList(page, manage);

        PageInfo pageInfo = new PageInfo(allList);

        return CommonResult.success(pageInfo);

    }


    /**
     * 上传图片
     * @param tupian
     * @return
     */
    @RequestMapping("/manage/uploadImg")
    public CommonResult uploadFile(MultipartFile tupian){
        System.out.println("nihao");
        String url=null;
        if(tupian!=null&&!tupian.isEmpty()){
            String name= UUID.randomUUID().toString();//生成随机的uuid作为文件名
            int pos=tupian.getOriginalFilename().lastIndexOf(".");//后缀的位置
            String fileName=name+tupian.getOriginalFilename().substring(pos);//得到文件名
            try {
                tupian.transferTo(new File("D:\\date\\images\\bysj\\user\\"+fileName));
            } catch (IOException e) {
                e.printStackTrace();
            }
            url=pichost+"bysj/user/"+fileName;
            System.out.println(url);
        }
        return CommonResult.success(url);
    }

    /**
     * 添加/修改管理员
     * @param manage
     * @return
     */
    @RequestMapping("/manage/addManage")
    public CommonResult addManage(Manage manage){

        Boolean aBoolean = manageService.addManage(manage);

        if (aBoolean){
            return CommonResult.success("添加/修改管理员成功");
        }else {
            return CommonResult.failed();
        }


    }

}

五,相关作品展示

基于Java开发、Python开发、PHP开发、C#开发等相关语言开发的实战项目

基于Nodejs、Vue等前端技术开发的前端实战项目

基于微信小程序和安卓APP应用开发的相关作品

基于51单片机等嵌入式物联网开发应用

基于各类算法实现的AI智能应用

基于大数据实现的各类数据管理和推荐系统

 

 

猜你喜欢

转载自blog.csdn.net/BS009/article/details/131614438