Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Design and Implementation of Dormitory Repair Management System Based on SpringBoot, Vue, and WeChat Mini-Program

Tech Oct 2 1

Technical Architecture

Backend: Spring Boot Framework

Spring Boot is an open-source framework designed for rapid development of Spring-based applications. It follows the "convention over configuration" principle, providing sensible defaults that allow developers to focus on business logic rather than configuration files.

Key characteristics include:

  • Auto-configuration: Automatically configures components based on project dependencies
  • Embedded server support: Ships with embedded Tomcat, Jetty, or Undertow servers
  • Starter dependencies: Simplifies dependency management through curated dependency sets
  • Production-ready features: Includes health checks, metrics, and externalized configuration

The backend architecture leverages Maven for dependency management and build automation. Developers can generate project scaffolding using Spring Initializr, then customize as needed by selecting appropriate dependencies.

Frontend: Vue.js Framework

Vue.js provides an incrementally adoptable ecosystem for building user interfaces. The framework focuses on the view layer and integrates well with other libraries or existing projects.

Core features:

  • Reactive data binding: Automatic synchronization between view and model through directives like v-model
  • Component-based architecture: Enables reusable, self-contained UI components
  • Lifecycle hooks: Allows custom logic execution at different stages (creation, mounting, updating, destruction)
  • Virtual DOM: Optimizes rendering performance through efficient DOM updates

Mobile: WeChat Mini-Program with uni-app

The mobile client utilizes uni-app, a cross-platform framework that compiles to multiple platforms including WeChat mini-programs. This approach allows code sharing across iOS, Android, and web applications while maintaining native performance.

System Design

Feasibility Analysis

Before implementation, feasibility assessment ensures the project's viability across multiple dimensions:

Technical Feasibility: Java-based implementation leverages mature, stable technologies. Spring Boot's extensive ecosystem and Vue's component architecture provide robust foundations. The combination supports maintainable codebases with clear separation of concerns.

Economic Feasibility: The architecture minimizes infrastructure costs through containerized deployment and cloud-native design patterns. Open-source technology stack eliminates licensing expenses.

Operational Feasibility: The user interface prioritizes intuitive interactions. Role-based access control ensures appropriate permissions for students, maintenance staff, and administrators.

Database Design

CREATE TABLE `repair_order` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time',
  `order_number` varchar(64) DEFAULT NULL COMMENT 'Order number',
  `dormitory_code` varchar(64) DEFAULT NULL COMMENT 'Dormitory identifier',
  `room_number` varchar(12) DEFAULT NULL COMMENT 'Room number',
  `description` varchar(500) DEFAULT NULL COMMENT 'Issue description',
  `category` varchar(64) DEFAULT NULL COMMENT 'Repair category',
  `urgency_level` varchar(32) DEFAULT NULL COMMENT 'Priority level',
  `status` varchar(32) DEFAULT NULL COMMENT 'Current status',
  `reporter_name` varchar(64) DEFAULT NULL COMMENT 'Reporter name',
  `contact_phone` varchar(20) DEFAULT NULL COMMENT 'Contact number',
  `assigned_to` bigint DEFAULT NULL COMMENT 'Assigned technician ID',
  `appointment_time` datetime DEFAULT NULL COMMENT 'Scheduled repair time',
  `completion_time` datetime DEFAULT NULL COMMENT 'Completion timestamp',
  `rating` int DEFAULT NULL COMMENT 'Service rating',
  `feedback` text COMMENT 'User feedback',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `user` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time',
  `username` varchar(200) NOT NULL COMMENT 'Username',
  `password` varchar(200) NOT NULL COMMENT 'Password',
  `real_name` varchar(200) DEFAULT NULL COMMENT 'Full name',
  `gender` varchar(200) DEFAULT NULL COMMENT 'Gender',
  `avatar` varchar(200) DEFAULT NULL COMMENT 'Profile picture',
  `phone` varchar(200) DEFAULT NULL COMMENT 'Phone number',
  `role` varchar(50) DEFAULT NULL COMMENT 'System role',
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `message_board` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time',
  `userid` bigint NOT NULL COMMENT 'User identifier',
  `username` varchar(200) DEFAULT NULL COMMENT 'Username',
  `content` longtext NOT NULL COMMENT 'Message content',
  `reply` longtext COMMENT 'Admin response',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `token` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
  `userid` bigint NOT NULL COMMENT 'User identifier',
  `username` varchar(100) NOT NULL COMMENT 'Username',
  `tablename` varchar(100) DEFAULT NULL COMMENT 'Related table',
  `role` varchar(100) DEFAULT NULL COMMENT 'User role',
  `token` varchar(200) NOT NULL COMMENT 'Authentication token',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Token creation time',
  `expiration_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Token expiry time',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

System Testing

Testing Objectives

System testing serves as the final validation checkpoint before deployment. This phase identifies discrepancies between actual behavior and expected outcomes, ensuring the system meets specified requirements.

Primary testing goals:

  • Defect detection: Systematically uncover functional gaps and logic errors
  • Requirements validation: Verify implementation matches design specifications
  • Quality assurance: Confirm system reliability under normal and stress conditions
  • User experience verification: Validate intuitive operation across all user roles

Functional Testing

Login Module Testing

Test Input Expected Result Actual Result Analysis
Username: admin, Password: 123456, Valid captcha System access granted Login successful Matches expectasion
Username: admin, Password: wrongpas, Valid captcha Authentication failure Error: Incorrect password Matches expectation
Username: admin, Password: 123456, Invalid captcha Validation error Error: Captcha mismatch Matches expectation
Username: empty, Password: 123456, Valid captcha Validation error Error: Username required Matches expectation
Username: admin, Password: empty, Valid captcha Validation error Error: Password required Matches expectation

User Management Testing

Test Scenario Expected Result Actual Result Analysis
Complete user registration form User added to system New user appears in user list Matches expectation
Update existing user profile Changes saved successfully Modified data displayed Matches expectation
Delete user with confirmation Record removed from database User no longer queryable Matches expectation
Submit form with missing required fields Validation warning displayed Field-level error shown Matches expectation
Register with existing username Registration blocked Error: Username exists Matches expectation

Testing Methodology

Black-box testing techniques validate system behavior without examining internal code structure. Test cases cover:

  • Boundary value analysis: Testing at input limits
  • Equivalence partitioning: Valid and invalid input groups
  • Required field validation: Mandatory versus optional fields
  • Role-based access verification: Permission enforcement across user types

Implementation Examples

Back end Controller

@RestController
@RequestMapping("/api/repair")
public class RepairController {
    
    @Autowired
    private RepairService repairService;
    
    @Autowired
    private TokenService tokenService;
    
    @PostMapping("/submit")
    public R submitRepairRequest(@RequestBody RepairRequest request, 
                                 @RequestHeader String token) {
        // Validate authentication token
        UserEntity currentUser = tokenService.validateToken(token);
        if (currentUser == null) {
            return R.error("Authentication expired, please login again");
        }
        
        // Validate request parameters
        if (StringUtils.isEmpty(request.getDescription())) {
            return R.error("Issue description is required");
        }
        
        // Create repair order
        RepairOrder order = new RepairOrder();
        order.setOrderNumber(generateOrderNumber());
        order.setDormitoryCode(request.getDormitoryCode());
        order.setDescription(request.getDescription());
        order.setReporterName(currentUser.getRealName());
        order.setContactPhone(request.getContactPhone());
        order.setStatus("PENDING");
        order.setCreateTime(new Date());
        
        repairService.save(order);
        return R.ok().put("data", order);
    }
    
    @GetMapping("/list")
    public R getRepairOrders(
            @RequestParam(required = false) String status,
            @RequestParam(defaultValue = "1") int page,
            @RequestParam(defaultValue = "10") int limit) {
        QueryWrapper<RepairOrder> wrapper = new QueryWrapper<>();
        if (status != null && !status.isEmpty()) {
            wrapper.eq("status", status);
        }
        wrapper.orderByDesc("create_time");
        Page<RepairOrder> pageResult = repairService.page(
            new Page<>(page, limit), wrapper);
        return R.ok().put("data", pageResult);
    }
}

Service Layer

@Service
public class RepairService extends ServiceImpl<RepairMapper, RepairOrder> {
    
    public Page<RepairOrder> queryPage(Map<String, Object> params) {
        Page<RepairOrder> page = new QueryBuilding<RepairOrder>()
            .getPage(params, "create_time");
        QueryWrapper<RepairOrder> wrapper = new QueryWrapper<>();
        
        // Status filtering
        String status = (String) params.get("status");
        if (status != null && !status.isEmpty()) {
            wrapper.eq("status", status);
        }
        
        // Category filtering
        String category = (String) params.get("category");
        if (category != null && !category.isEmpty()) {
            wrapper.eq("category", category);
        }
        
        return this.baseMapper.selectPage(page, wrapper);
    }
}

System Configuration

Location Services Integration

@RequestMapping("/api/location")
public R resolveLocation(String longitude, String latitude) {
    if (StringUtils.isEmpty(baiduMapKey)) {
        ConfigEntity config = configService.selectOne(
            new EntityWrapper<ConfigEntity>()
                .eq("name", "baidu_map_key"));
        baiduMapKey = config != null ? config.getValue() : null;
        
        if (baiduMapKey == null) {
            return R.error("Map services not configured");
        }
    }
    
    Map<String, String> locationData = BaiduMapUtil.getCityInfo(
        baiduMapKey, longitude, latitude);
    return R.ok().put("data", locationData);
}

Image Processing

@RequestMapping("/api/upload")
public R uploadFile(MultipartFile file) {
    String originalFilename = file.getOriginalFilename();
    String extension = originalFilename.substring(
        originalFilename.lastIndexOf("."));
    String newFilename = UUID.randomUUID().toString() + extension;
    
    String uploadPath = ResourceUtils.getFile("classpath:static/uploads")
        .getAbsolutePath();
    
    File destFile = new File(uploadPath + File.separator + newFilename);
    file.transferTo(destFile);
    
    return R.ok().put("url", "/uploads/" + newFilename);
}

Security Considerations

  • Token-based authentication: JWT tokens with configurable expiration
  • Input validation: Server-side validation prevents injection attacks
  • Role-based access control: Endpoints protected by permission checks
  • Data encryption: Sensitive fields encrypted at rest
  • Session management: Automatic timeout and secure logout mechanisms

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.