Design and implementation of tourism information platform based on SpringCloud microservice technology

Author Homepage: Programming Compass

About the author: High-quality creator in the Java field, CSDN blog expert, CSDN content partner, invited author of Nuggets, Alibaba Cloud blog expert, 51CTO invited author, many years of architect design experience, resident lecturer of Tencent classroom

Main content: Java project, Python project, front-end project, artificial intelligence and big data, resume template, learning materials, interview question bank, technical mutual assistance

Favorites, likes, don't get lost, it's good to follow the author

Get the source code at the end of the article 

Item number: BS-PT-087

1. Environmental introduction

Locale: Java: jdk1.8

Database: Mysql: mysql5.7

Application server: Tomcat: tomcat8.5.31

Development tools: IDEA or eclipse

Background development technology: springcloud microservice architecture system

Front-end development technology: vue+elementui

2. Project introduction

2.1 Introduction

Tourism, as an important module of services, plays an important role in promoting my country's economic development. The impact of the epidemic in recent years has led to a complete stagnation of the tourism industry, which has had a great impact on the country's economic development. Therefore, the recovery of the tourism industry has been accelerated. , Multi-faceted synergy to promote the development of the tourism industry can form a huge boost to the healthy and stable development of the country's economy. The IT industry can help the development of the tourism industry. It can use the existing mature technology to create a user-interactive and friendly tourism information platform, solve the contradiction between users and tourism, and realize the information visualization between users and tourism. Features such as information security and personalized service bring users a more friendly and comfortable travel experience.

This paper designs and implements a tourism information platform system based on the SpringCloud microservice architecture. According to the existing relevant platforms in the market, by analyzing and summarizing their advantages and disadvantages, the functional structure of the system is determined. This system pays more attention to user-friendliness and user interaction, and divides the system into micro-service modules such as basic service, order service, timed task, user center, and payment service. The UI interface of the tourism information platform is beautifully designed, the page is neat, and the visual comfort of the user is enhanced; the system has complete functions and simple operation, which increases the usability and versatility of the platform. In addition, it is developed using the SpringCloud micro-service architecture to increase the scalability of the platform.

2.2 Demand Analysis

The system consists of ten modules, and each module is divided into micro-service system modules that can run independently, namely background management system module, front-end system module, user system module, order system module, single sign-on system module, hotel system module , ticket system module, train ticket system module, strategy and attractions module.

Background management system module: Front display management, user management, administrator management, hotel management, air ticket management, train ticket management, strategy attractions management, order management, system statistics, administrator management and other functions. It includes the management of user front desk, user information, administrator information, hotel information, air ticket information, strategy and scenic spot information, system data information, and order information.

Front-end system module: including front-end display, user module, hotel module, air ticket module, train ticket module, strategy attraction module, order module, etc. Mainly, users and tourists can register accounts in the front-end system, log in to the system, and browse all products (including Hotels, air tickets, train tickets, scenic spot tickets) information, purchase goods, check orders and other operations. Membership system module: users can inquire about orders in the system, manage orders, coupons and other information.

User system module: users can register accounts, log in, and modify personal information such as passwords, avatars, etc. Users who have not logged in can only enjoy some functions of the system, such as querying hotel information, and cannot book hotel rooms.

Order system module: System users can face or book hotels, air tickets, train tickets, scenic spot tickets, etc. in this system. After the purchase or reservation is completed, there will be corresponding order information. Users can view or modify the order information through the order or according to the account information.

Single sign-on system module: In this multiple application system, users only need to log in once to access all systems on this platform.

Hotel system module: users can view hotel information, including searching for the hotel information they want by city, name, rating, location, etc., and also provide hotel information rankings to help users quickly find the hotel information they want. The hotel system first searches for the hotel, and then searches for the room information of the hotel to complete the room reservation.

Ticket system module: users can query ticket information by date, departure city and destination city as query conditions.

Train ticket system module: users can query train ticket information by date, departure city and destination city as query conditions.

Raiders and Attractions Module: This module includes the purchase of attractions tickets and the sharing of Raiders. Attraction tickets can be fuzzy searched by city and scenic spot name. At the same time, a hot list of scenic spots is set up to display the most popular scenic spots recently to attract users to check in.

Its main functional module diagram is shown in Figure 1

Figure 1 Functional module diagram

 2.3 System Architecture

This tourism information platform is based on the web project deployed by spring cloud micro-service technology. According to the expected demand, development difficulty and performance requirements, the architectural form adopted is a layered architecture. The specific layered architecture deployment of the system is shown in Figure 2.

Figure 2 System deployment diagram

The system is divided into front-end and back-end users. Foreground users are mainly ordinary users, and ordinary users include logged-in users and unlogged-in users. Depending on whether you are logged in or not, the scope of user access and the functions that can be used are different. Background users are mainly background maintenance personnel and background administrator users. Figure 3 and Figure 4 show the user access scope resources of the front and back ends.

Figure 3 front desk use case diagram of tourism information platform

Figure 4 Backstage of travel information platform

Three, system display

Front-end user registration and login

 

 Hotel module management 

 

 

 Ticket information display

 train ticket module

 

 Attraction information module

 

 Strategy module

 

 Backstage management

 

 Other slightly

Fourth, the core code display

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();
        }


    }

}

5. Display of related works

Practical projects based on Java development, Python development, PHP development, C# development and other related language development

Front-end practical projects developed based on Nodejs, Vue and other front-end technologies

Related works based on WeChat applet and Android APP application development

Development and application of embedded IoT based on 51 single-chip microcomputer

AI intelligent application based on various algorithms

Various data management and recommendation systems based on big data

 

 

Guess you like

Origin blog.csdn.net/whirlwind526/article/details/131614275