Travel Management System Implementation with Java, SSM, and Vue

This article presents a comprehensive travel management system built using Java with the SSM (Spring, SpringMVC, MyBatis) framework on the backend and Vue.js on the frontend. The system is designed to streamline travel-related operations, providing a robust platform for managing various aspects of travel services.

Technical Architecture

Backend Framework: SpringBoot

Spring Boot is a powerful framework for building standalone, production-grade Spring-based applications. Its primary goal is to simplify the Spring application development process by providing out-of-the-box functionality while maintaining the core strength and flexibility of Spring.

Spring Boot enables rapid application developmant through auto-configuration and convention-over-configuration principles, reducing the amount of boilerplate code developers need to write. Its design philosophy emphasizes "convention over configuration," allowing developers to focus on implementing business logic rather than writing configuration files.

Spring Boot includes embedded web servers like Tomcat, Undertow, or Jetty, making it possible to package applications as executable JAR files. This design simplifies deployment and execution, requiring only a java -jar command to run the application. Additionally, Spring Boot provides extensive Actuator support for runtime monitoring and management capabilities.

Furthermore, Spring Boot offers rich plugin and extension mechanisms for easily integrating various functionalities such as security authentication, data access, message queues, and caching. Through Spring Boot Starter dependencies, developers can effortlessly add required functional modules and configure them with minimal setup.

Frontend Framework: Vue

Vue.js is a popular JavaScript framework used for building user interfaces (UI) and single-page applications (SPA). Created by Evan You in 2014, it is a lightweight, easy-to-learn, and flexible framework.

The core strength of Vue.js lies in its reactive data binding system, which enables developers to efficiently manage view and data changes. It also provides a set of concise and intuitive APIs that make the development process more efficient and flexible.

Vue's component-based development approach allows developers to break down applications into small, independent components, which are then combined to form complete applications. This pattern enhances code reusability and makes maintenance and testing more straightforward.

Additionally, Vue.js boasts a very active community that offers numerous useful plugins and tools, along with extensive documentation and tutorials. This makes learning and using Vue.js more accessible and enjoyable.

Core Implementation

Application Main Class

package com;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

@SpringBootApplication
@MapperScan(basePackages = {"com.repository"})
public class TravelManagementApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(TravelManagementApplication.class, args);
    }
    
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) {
        return applicationBuilder.sources(TravelManagementApplication.class);
    }
}

User Controller Implementation

package com.controller;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.UserEntity;
import com.entity.view.UserView;

import com.service.UserService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.MapUtils;
import com.utils.CommonUtil;
import java.io.IOException;

/**
 * User Controller
 * Backend API
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @Autowired
    private TokenService tokenService;
    
    /**
     * Login
     */
    @IgnoreAuth
    @RequestMapping(value = "/login")
    public R login(String username, String password, String captcha, HttpServletRequest request) {
        UserEntity user = userService.selectOne(new EntityWrapper<userentity>().eq("username", username));
        if(user == null || !user.getPassword().equals(password)) {
            return R.error("Invalid username or password");
        }
        
        String token = tokenService.generateToken(user.getId(), username, "user", "User");
        return R.ok().put("token", token);
    }

    /**
     * Register
     */
    @IgnoreAuth
    @RequestMapping("/register")
    public R register(@RequestBody UserEntity user) {
        UserEntity existingUser = userService.selectOne(new EntityWrapper<userentity>().eq("username", user.getUsername()));
        if(existingUser != null) {
            return R.error("Username already exists");
        }
        Long userId = new Date().getTime();
        user.setId(userId);
        userService.insert(user);
        return R.ok();
    }

    /**
     * Logout
     */
    @RequestMapping("/logout")
    public R logout(HttpServletRequest request) {
        request.getSession().invalidate();
        return R.ok("Logout successful");
    }
    
    /**
     * Get current user session information
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request) {
        Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * Password reset
     */
    @IgnoreAuth
    @RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request) {
        UserEntity user = userService.selectOne(new EntityWrapper<userentity>().eq("username", username));
        if(user == null) {
            return R.error("Username does not exist");
        }
        user.setPassword("123456");
        userService.updateById(user);
        return R.ok("Password has been reset to: 123456");
    }

    /**
     * Backend list
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<string object=""> params, UserEntity user, HttpServletRequest request) {
        EntityWrapper<userentity> wrapper = new EntityWrapper<userentity>();

        PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(wrapper, user), params), params));

        return R.ok().put("data", page);
    }
    
    /**
     * Frontend list
     */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<string object=""> params, UserEntity user, HttpServletRequest request) {
        EntityWrapper<userentity> wrapper = new EntityWrapper<userentity>();

        PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(wrapper, user), params), params));
        return R.ok().put("data", page);
    }

    /**
     * List all
     */
    @RequestMapping("/lists")
    public R list(UserEntity user) {
        EntityWrapper<userentity> wrapper = new EntityWrapper<userentity>();
        wrapper.allEq(MPUtil.allEQMapPre(user, "user")); 
        return R.ok().put("data", userService.selectListView(wrapper));
    }

    /**
     * Query
     */
    @RequestMapping("/query")
    public R query(UserEntity user) {
        EntityWrapper<userentity> wrapper = new EntityWrapper<userentity>();
        wrapper.allEq(MPUtil.allEQMapPre(user, "user")); 
        UserView userView = userService.selectView(wrapper);
        return R.ok("User query successful").put("data", userView);
    }
    
    /**
     * Backend details
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id) {
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * Frontend details
     */
    @IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id) {
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * Backend save
     */
    @RequestMapping("/save")
    public R save(@RequestBody UserEntity user, HttpServletRequest request) {
        if(userService.selectCount(new EntityWrapper<userentity>().eq("username", user.getUsername())) > 0) {
            return R.error("Username already exists");
        }
        user.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue());
        UserEntity existingUser = userService.selectOne(new EntityWrapper<userentity>().eq("username", user.getUsername()));
        if(existingUser != null) {
            return R.error("Username already exists");
        }
        user.setId(new Date().getTime());
        userService.insert(user);
        return R.ok();
    }
    
    /**
     * Frontend save
     */
    @RequestMapping("/add")
    public R add(@RequestBody UserEntity user, HttpServletRequest request) {
        if(userService.selectCount(new EntityWrapper<userentity>().eq("username", user.getUsername())) > 0) {
            return R.error("Username already exists");
        }
        user.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue());
        UserEntity existingUser = userService.selectOne(new EntityWrapper<userentity>().eq("username", user.getUsername()));
        if(existingUser != null) {
            return R.error("Username already exists");
        }
        user.setId(new Date().getTime());
        userService.insert(user);
        return R.ok();
    }

    /**
     * Update
     */
    @RequestMapping("/update")
    @Transactional
    public R update(@RequestBody UserEntity user, HttpServletRequest request) {
        if(userService.selectCount(new EntityWrapper<userentity>().ne("id", user.getId()).eq("username", user.getUsername())) > 0) {
            return R.error("Username already exists");
        }
        userService.updateById(user);
        return R.ok();
    }

    /**
     * Delete
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}</userentity></userentity></userentity></userentity></userentity></userentity></userentity></userentity></userentity></userentity></userentity></string></userentity></userentity></string></userentity></userentity></userentity>

System Testing

Testing Objectives

Identifying system issues from multiple perspectives is the primary objective of the testing phase for this travel management system. Through functional testing, we aim to discover and rectify system defects, ensuring a robust final product. During the testing process, we verify that the system meets client requirements, identify any shortcomings, and implement necessary improvements.

In the development lifecycle of a travel management system, system testing is an essential and meticulous process. Its importance lies in being the final quality assurance step and the last comprehensive inspection of the entire development process.

System testing primarily aims to prevent issues during user operation and enhance the user experience. To avoid disrupting user activities, we need to consider potential problems from various angles and approaches, using different simulation scenarios to identify and resolve defects. The testing process also provides insights into the system's quality, functionality completeness, and logical flow. A thorough system testing process significantly improves system quality and usability. The goal is to verify that the system aligns with the requirements specification and to identify any inconsistencies or conflicts with the specification. Throughout testing, it's crucial to maintain a user perspective, avoiding unrealistic scenarios that waste testing time and might lead to discrepancies between expected and actual results.

Functional Testing

We conducted functional testing of the system modules using black-box testing methods, including clicking operations, boundary value inputs, and validation of required and optional fields. Test cases were developed and executed according to predefined scenarios, leading to comprehensive testing conclusions.

Login functionality testing: When accessing the system, users are authenticated through account credentials. The system validates input against stored database data, prompting for errors when incorrect information is provided. This interface also includes role-based authorization checks, preventing access when users attempt to log in with inappropriate role permissions.

Testing Results

This system primarily employed black-box testing methodology, simulating user interactions across all functions to develop and execute test cases, ensuring proper system workflow. System testing is indispensable for system refinement and enhances overall usability.

Testing this system aimed to verify that the functional modules meet the original design requirements and confirm the logical correctness of each module. The system avoids complex logic processing to facilitate user-friendly operation. The ultimate testing objective centers on user experience. All testing scenarios should align with user needs without deviating from requirements. When issues arise, they should be addressed from a user perspective. After a comprehensive testing process, the final results indicate that the implemented system satisfies both functional and performance design requiremants.

Tags: java SpringBoot Vue.js SSM MyBatis

Posted on Wed, 01 Jul 2026 17:37:21 +0000 by xatter