Skip to content

适用于使用智慧笑联的学校 帮助你更快的找到没有人的淋浴头 Suitable for schools which use Xiaolian to help you quickly find shower heads which are unoccupied.

License

Notifications You must be signed in to change notification settings

aquamarine5/XiaolianShowerSense

Repository files navigation

XiaolianShowerSense

totallines FOSSA Status 2-XiaolianShowerSense-DesignedApplicationAndDeployed.png

XiaolianShowerSense participated in Designed an application and successfully deployed it.

  • 适用于任何使用智慧笑联的学校,http://wash.aquamarine5.fun/目前仅适用于河北大学,不过可以更改参数以适配所有宿舍。

Note

请勿使用HTTPS访问。

Changelog

  • v0.8: 针对MySQL的性能更新,关于从低版本的MySQL结构迁移到新版本的结构步骤,详见SQL Structure Migration to v0.8
  • v0.7: 加入了分析图标功能。
  • v0.6: 加入了浴室地图功能。
  • v0.5: 更新了UI设计。
  • v0.4: 支持多浴室查询。

For developers

Tech stack

  • 前端:Vue.js
  • 后端:Springboot with MySQL, JDK21

Build and run

MySQL

CREATE DATABASE xiaolian;

CREATE TABLE xiaolian.residenceIndex (
    residenceId INT PRIMARY KEY,
    floorId INT NOT NULL,
    buildingId INT NOT NULL,
    name TEXT NOT NULL,
    mapdata JSON,
    contributors TEXT,
    analyseStartTime MEDIUMINT UNSIGNED,
    analyseEndTime MEDIUMINT UNSIGNED
) CHARACTER SET utf8mb4;

CREATE TABLE xiaolian.showers (
    deviceId INT PRIMARY KEY,
    location VARCHAR(50) NOT NULL,
    displayNo TINYINT(3) NOT NULL,
    status TINYINT(2) NOT NULL,
    lastUsedTime TIMESTAMP NOT NULL,
    lastWashTime TIMESTAMP NOT NULL,
    residenceId INT NOT NULL
) CHARACTER SET utf8mb4;

CREATE TABLE xiaolian.analyses (
    minv SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    avgv SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    maxv SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    timePos SMALLINT UNSIGNED NOT NULL,
    count SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    residenceId INT UNSIGNED NOT NULL,
    PRIMARY KEY (residenceId, timePos)
) CHARACTER SET utf8mb4;

CREATE TABLE xiaolian.config (
    accessToken TEXT NOT NULL,
    refreshToken TEXT NOT NULL,
    avgWashCount MEDIUMINT UNSIGNED DEFAULT 0,
    avgWashTime MEDIUMINT UNSIGNED DEFAULT 0,
    requestTimes MEDIUMINT UNSIGNED DEFAULT 0,
    isAnalysisEnabled BOOLEAN DEFAULT TRUE NOT NULL
) CHARACTER SET utf8mb4;

启动后端 (for server)

gradle build
java -jar build/libs/XiaolianShowerSense-${version}.jar 
  • 环境变量MYSQL_PASSWORD是必须的。
  • Springboot 将会监听localhost:3017, 请确保MySQL服务正在运行并有一个名为xiaolian的数据库,在application.properties更改更多数据库配置。

启动前端

npm run dev
  • Vue 将会把页面呈现在localhost:5173上。

HTTP API

  • /wash?id=${residenceId}
    返回浴室的所有数据,包括淋浴头名称。
  • /refresh?id=${residenceId}
    返回浴室的关键数据,不包括淋浴头名称。
  • /list
    返回可供查询的浴室列表。
  • /map?id=${residenceId}
    返回浴室的地图数据(如果存在)。
  • /analysis?residenceId=${residenceId}
    返回浴室的分析数据(若地图数据不存在,则分析数据无效,将返回'x')。
  • /analyser_enabled & /analyser_disabled
    分别启用和禁用分析功能。

Only for test

  • /force_analyse
    ResidenceController.shouldUpdateAnalysis强制设置为true,从而在下一次数据更新中统计分析数据。
  • /force_update
    强制执行ResidenceController.updateAllResidences(),从而更新所有浴室的数据。

Features

2-XiaolianShowerSense-DesignedApplicationAndDeployed.p2.png 2-XiaolianShowerSense-DesignedApplicationAndDeployed.p3.png 2-XiaolianShowerSense-DesignedApplicationAndDeployed.p4.png 2-XiaolianShowerSense-DesignedApplicationAndDeployed.p6.png

Alt

License

FOSSA Status

About

适用于使用智慧笑联的学校 帮助你更快的找到没有人的淋浴头 Suitable for schools which use Xiaolian to help you quickly find shower heads which are unoccupied.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •