All checks were successful
iot-test-platform CI/CD / build-and-deploy (push) Successful in 15s
61 lines
1.5 KiB
Markdown
61 lines
1.5 KiB
Markdown
# JT808 Spring Boot Transport Server
|
|
|
|
This project has been modernized to a Spring Boot 3 + Netty architecture, supporting both TCP (JT808) and HTTP API channels.
|
|
|
|
## Features
|
|
|
|
- **Dual Channel**:
|
|
- **TCP (Port 20048)**: Standard JT808 protocol for device connections.
|
|
- **HTTP API (Port 8080)**: RESTful API for testing or third-party integration.
|
|
- **Web UI**: Built-in Dashboard at `http://localhost:8080/`.
|
|
- **Docker Ready**: Simple deployment via Docker.
|
|
|
|
## Structure
|
|
|
|
- `src/main/java/com/iot/transport/jt808`
|
|
- `Jt808Application.java`: Spring Boot Entry Point.
|
|
- `server/Jt808NettyServer.java`: Netty Server Wrapper.
|
|
- `controller/DeviceController.java`: HTTP API Controller.
|
|
- `service/`: Business Logic Layer.
|
|
- `tcp/`: Original JT808 Protocol Logic.
|
|
- `src/main/resources/static`: Frontend Static Files (Vue 3 Dashboard).
|
|
|
|
## How to Run
|
|
|
|
### Local Development
|
|
```bash
|
|
mvn clean spring-boot:run
|
|
```
|
|
Access Dashboard: http://localhost:8080/
|
|
|
|
### Docker
|
|
1. Build JAR:
|
|
```bash
|
|
mvn clean package -DskipTests
|
|
```
|
|
2. Build Image:
|
|
```bash
|
|
docker build -t jt808-server .
|
|
```
|
|
3. Run:
|
|
```bash
|
|
docker run -d -p 8080:8080 -p 20048:20048 --name jt808 jt808-server
|
|
```
|
|
|
|
## CI/CD
|
|
|
|
参考 [`docs/ci-cd.md`](docs/ci-cd.md) 了解如何通过 Gitea Actions + Runner 构建容器、推送镜像并在目标主机上自动部署 `jt808-server`。
|
|
|
|
## API Usage
|
|
|
|
**Report Location (HTTP):**
|
|
POST /api/v1/device/location
|
|
```json
|
|
{
|
|
"imei": "123456789012",
|
|
"lat": 30.123456,
|
|
"lon": 120.654321,
|
|
"speed": 60.0
|
|
}
|
|
```
|