Microservice Design|Design and Implementation of Tourism Information Platform Based on SpringCloud Microservice Technology

About the author: a full-stack development project, engaged in the development and research of Java, Python, front-end, and small programs, interested in big data applications and development,

Main content: Java project, front-end project, Python project, small program development, big data project, microcontroller

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

Get the source code at the end of the article 

Thank you for your attention, please bookmark to avoid forgetting, like to show encouragement, comment to give suggestions, love you

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

2. Project introduction

2.1 Project background

Some existing travel information platforms on the market, such as Ctrip, Tuniu, and Mafengwo, can only meet part of the needs of users, and cannot bring the best experience to the majority of users. In addition, the update of information such as push and policy between the platform and local scenic spots is not timely, and the contradiction between users and tourism is not resolved. When the policy of the tourist destination changes, the user cannot know it in time. Other platforms are used to obtain the latest local tourism information. If some users do not use other platforms to understand local information, phenomena such as "traveling in vain" may occur, which will reduce the user's sense of experience.

The design and implementation of the tourism information platform system in this paper absorbed the strengths of other tourism information systems in the market, and also paid attention to the problems of untimely information exchange, user experience and interactivity. In order to solve the contradictions between users and tourism, such as uncertainty, mistrust, and inconvenience, realize the characteristics of information visualization, information security, and personalized services between users and tourism, and bring more friendliness to users. Comfortable travel experience.

As the development of the social era has entered the ladder of 2022, the economic development model of the entire society has undergone great changes from the past. The emerging service industry has become one of the main driving forces for the country's economic development, and tourism, as one of the important modules of the service industry, has also attracted more and more attention. Tourism has developed rapidly. The continuous expansion of the industry scale has become a key development project of the country, and the tourism market is gradually expanding. With the development of the market economy and the further improvement of people's income level, people's demand for tourism consumption is also increasing, so the status and role of tourism in the national economy is very important. The development of tourism is of great significance.

The rapid development of the tourism industry has also brought challenges in management, with the influx of information from various aspects, and the construction of an intelligent information system is imminent. The emerging IT industry, as an information technology industry, uses information means and technologies to collect, sort out, store, and transmit information, provide information services, and provide corresponding information means, information technology and other services. Nowadays, technologies in the IT field are constantly being overcome, and major data breakthroughs have been made in the fields of enterprise-level project development, microservices, and big data. The use of modern technology to promote the sustainable and stable development of the tourism industry has become the direction of future development, and it is bound to become a trend to build a tourism information platform to realize convenient data management.

2.2 Analysis of Functional Requirements

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 Design

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

3.1  Implementation of front desk login and registration

When a user enters the system, he can click Login on the interface to jump to the login interface. If the user clicks functions such as query order and order creation, he will directly jump to the login interface even if he is not logged in. The login interface has a path to jump to the registration interface. For the realization of account registration, the user enters information such as mobile phone number, account password, email account number, etc., and the user needs to confirm the password twice, and the two passwords are the same to register. Each mobile phone number can only create one account, and the mobile phone number will be verified when registering. For the implementation of login, the user enters the mobile phone number and password, and can also choose to log in through mobile phone number verification. The realized UI interface is shown in Figure 3-1 and Figure 3-2.

Figure 3-1 User registration UI diagram

Figure 3-2 User login UI diagram

3.2  Realization of hotel module

The hotel module is the first display module for users to enter the system. The home page of the hotel module is equipped with hotel information search, hotel recommendation and hotel ranking information promotion. Hotel search, through fuzzy query based on the hotel name, city, location and other information, the search will jump to the hotel information list page to display the hotel information, and at the same time display the map location information of a hotel on the page. Users can click on the recommended hotel to directly enter the hotel details and enter the hotel details by clicking View Details in the hotel list. The hotel details display the detailed introduction of the hotel and the room information of the hotel. Users can book rooms on this interface, create After the order is completed and the hotel reservation is completed, the reserved room will be locked, and other users cannot view the information status of the room. The realized UI interfaces are shown in Figure 3-3, 3-4, and 3-5.

Figure 3-3 UI map of the hotel homepage

Figure 3-4 Hotel query UI interface

Figure 3-5 UI diagram of hotel details and room information

3.3  Realization of ticket module

The user jumps to the ticket module through the sidebar. The top part of the ticket implementation is the search for ticket information. The query conditions for the ticket are the destination city, the departure city, the departure airport, the destination airport, and time. If the query result is empty, a prompt will pop up, and the queried information can be sorted by time and price. The realized UI interface is shown in Figure 5-6.

Figure 3-6 UI diagram of ticket information

3.4  Realization of train ticket module

Users can enter the train ticket module through the sidebar. The search for train tickets provides time, city, and train type (including high-speed rail, bullet train, and train) as query conditions. Users can directly enter the train ticket and create an order through the ticket purchase button on the train list. interface. When the location changes, a departure and destination policy content will pop up on the page to notify the user. The user can directly enter the function of creating an order by clicking Buy Tickets through the ticket list. The realized UI interface is shown in Figure 3-7 and Figure 3-8.

Figure 3-7 Local policy automatic sending UI diagram

Figure 3-8 Train ticket information display UI diagram

3.5  Realization of attractions module functions

The scenic spot module is mainly to facilitate the purchase of scenic spot tickets. Users can query scenic spots through the city, scenic spot name (fuzzy query), click details through the scenic spot list or through the hotel recommendation list, and can enter to view the detailed information of the scenic spot, including scenic spot introduction, service measures, For public facilities and other content, users can also purchase tickets for scenic spots on this interface. The realized UI interface is shown in Figure 5-9.

Figure 3-9 UI diagram of attraction information

Figure 3-10 Hotel detailed information UI diagram

3.6  Raiders module implementation

The guide module is mainly for viewing the guides of scenic spots published by users and the guides of scenic spots. The guides can be liked and commented on. The realized UI interface is shown in Figure 5-10 and Figure 5-11.

Figure 3-10 Raiders Information UI Diagram

Figure 5-11 Raiders Details UI Diagram

3.7  User Module Implementation

The user module is mainly for viewing and modifying user information, and at the same time, users can view various types of orders of their own. The realized UI interface is shown in Figure 5-12.

Figure 3-12 User center UI diagram

5.8  Implementation of order module

The order module is mainly for users to create orders when purchasing or booking hotels, train tickets, air tickets, and scenic spot tickets. When creating an order, a basic information of the order will be displayed, including order number, order amount and other information. The user can choose the payment method to pay, and if the payment is successful, it will jump to an interface prompting the payment success. The realized UI interface is shown in Figure 5-13 and Figure 5-14.

Figure 3-13 payment interface UI diagram

Figure 3-14 Payment success prompt UI diagram

3.9  Realization of background home page

The background home page is the first page displayed by the administrator when entering the background management interface. The page mainly contains charts, statistics and other information. The administrator can visually see the data content such as the number of orders, the number of registered users, and the amount of all orders. The realized UI interface is shown in Figure 3-15.

Figure 3-15 Background home page UI interface

Fourth, the core code display

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


    }

}

V. Project Summary

The main research topic of this system is to analyze the development bottleneck of the current tourism industry and the factors that affect people's travel, how to solve the current difficulties and needs of people's travel by combining today's IT industry technology, and design and implement a micro-service based on user-oriented services. service system. This system adopts the development mode of enterprise-level projects and adopts the current mature front-end and back-end separation development. The project architecture is built based on the spring cloud micro-service architecture. According to the characteristics of large user base and high concurrency of service requests, in order to achieve the system Availability and stability, using redis and mysql database systems to reduce the pressure on the system database, and provide solutions for enterprise-level project development.

In an enterprise-level project, the system must consider system performance, system scalability, high availability, high concurrency, system stability, and data security requirements. The project should build a database cluster to avoid data loss. The project should adopt the concept of distributed micro-services for deployment, use clusters and multi-servers to launch the project, and design a reasonable mechanism to ensure the normal communication of services between systems. Due to my limited resources and time in the design and implementation process, these needs cannot be met.

Nowadays, there are many similar systems on the market, which can withstand huge access requests, and it is better to have two accesses for PC and mobile APP. However, I have checked most of the similar systems and found that each has advantages and disadvantages. Here I will summarize some of their shortcomings, such as messy and unsightly interface, information and local policies cannot be fed back to users in a timely manner, and users have a poor sense of presence and sharing. , the information flow is not enough. I hope that there will be a better system in the future that can solve these problems, and at the same time develop a small program entrance to facilitate users' use.

Guess you like

Origin blog.csdn.net/znzbs/article/details/131975258