Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Automated Class Reminders via WeChat with Dynamic Scheduling

Tech Apr 19 20

The system uses Spring Boot for backend services, WxPush for messaging, and xxl-job for distributed task scheduling.

Dependencies

<dependency>
    <groupId>com.lxgnb</groupId>
    <artifactId>xxl-job-boot-starter</artifactId>
    <version>2.4.0</version>
</dependency>
<dependency>
    <groupId>com.zjiecode</groupId>
    <artifactId>wxpusher-java-sdk</artifactId>
    <version>2.2.0</version>
</dependency>

Core Workflow

  1. Create WxPush application with callback URL to capture user UIDs
  2. Store UID-taskID mappings in data base
  3. Trigger messsages via WxPush when xxl-job executes

Task Registration Logic

String[] inputSegments = rawInput.split(" ");
String schedulePattern = inputSegments[0];

// Validate cron syntax
if(!CronValidator.isValid(schedulePattern)) {
    PushMessage failureAlert = new PushMessage()
        .setType(MessageType.TEXT)
        .setTargetUser(uid)
        .setAppToken(appToken)
        .setBody("Invalid schedule pattern");
    WxPusher.send(failureAlert);
    return;
}

String alertContent = inputSegments[1];

JobConfiguration jobConfig = new JobConfiguration()
    .setContactEmail("admin@domain.com")
    .setOwner("scheduler")
    .setSummary("Class reminder")
    .setHandlerName("classAlertHandler")
    .setTriggerType(ScheduleMode.CRON)
    .setCronExpression(schedulePattern);

int generatedTaskId = jobManager.registerJob(jobConfig);
if(generatedTaskId > 0) {
    TaskMapping mapping = new TaskMapping()
        .setTaskIdentifier(generatedTaskId)
        .setUserId(uid)
        .setAlertText(alertContent);
    taskRepository.persist(mapping);
    jobManager.enableTask(generatedTaskId);
    
    PushMessage successNotice = new PushMessage()
        .setType(MessageType.TEXT)
        .setTargetUser(uid)
        .setAppToken(appToken)
        .setBody("Alert scheduled. Send DEL to cancel");
    WxPusher.send(successNotice);
}

Class Schedule Processing

  • Python scraper collects institutional timetables weekly
  • Database stores class schedules with week indices
  • UID-class mappings determine notification recipients
  • xxl-job executor checks mappings and triggers alerts when classes start

Scheduling Interface

Users submit cron expressions and alert messages. Future enhancement will integrate LLM-based cron generation from natural language requests.

Related Articles

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...

SBUS Signal Analysis and Communication Implementation Using STM32 with Fus Remote Controller

Overview In a recent project, I utilized the SBUS protocol with the Fus remote controller to control a vehicle's basic operations, including movement, lights, and mode switching. This article is aimed...

Leave a Comment

Anonymous

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