# phenocam_back **Repository Path**: calways/phenocam_back ## Basic Information - **Project Name**: phenocam_back - **Description**: 物候监测组网数据公开 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-18 - **Last Updated**: 2025-09-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Phenocam Backend Project Documentation ## Project Overview This project serves as the backend service for Phenocam, developed using the Spring Boot framework. It provides functionalities such as FTP file access, image URL management, user registration, and login. It is suitable for building a management and display platform for plant observation image data. ## Functional Modules - **FTP Access**: Connect to the server via the FTP protocol to display and download files. - **Image URL Management**: Query image URLs by dimensions such as site, year, month, and date. - **User Management**: Provides user registration and login functionality. - **Cross-Origin Configuration**: Supports cross-origin requests, facilitating frontend-backend separation during development. ## Technology Stack - Java 8 - Spring Boot - MySQL (or other databases, accessed via JdbcTemplate) - FTPClient (for FTP file access) - RESTful API Design ## Directory Structure ``` src/ ├── main/ │ ├── java/ │ │ └── com/phenocam/phenocam_back/ │ │ ├── controller/ # Controller classes for handling HTTP requests │ │ ├── dao/ # Data Access Objects for interacting with the database │ │ ├── entity/ # Entity classes mapping to database tables │ │ ├── service/ # Business logic processing │ │ ├── config/ # Configuration classes │ │ └── PhenocamBackApplication.java # Application startup class │ └── resources/ │ ├── application.yml # Configuration file │ └── static/ # Static resources (e.g., index.html) └── test/ └── com/phenocam/phenocam_back/ └── PhenocamBackApplicationTests.java # Test class ``` ## Installation and Deployment ### Running Locally 1. Ensure JDK 8 and Maven are installed. 2. Execute the following command to start the project: ```bash mvn spring-boot:run ``` ### Deploying with Docker 1. Build the project: ```bash mvn clean package ``` 2. Build the Docker image: ```bash docker build -t phenocam-back . ``` 3. Run the Docker container: ```bash docker run -d -p 9022:9022 phenocam-back ``` ## API Documentation ### FTP Interface - **GET /api/ftp/list**: Retrieve a list of files in the specified directory. - Parameter: `dir` (directory path) - **GET /api/ftp/download**: Download the specified file. - Parameter: `path` (file path) ### Image URL Interface - **GET /api/gallery**: Retrieve image URLs for all sites. - **GET /api/browse/{siteName}**: Retrieve image URLs for the specified site. - **GET /api/browse/{siteName}/{year}**: Retrieve image URLs for the specified site and year. - **GET /api/browse/{siteName}/{year}/{month}**: Retrieve image URLs for the specified site, year, and month. - **GET /api/browse/{siteName}/{year}/{month}/{day}**: Retrieve image URLs for the specified site, year, month, and day. ### User Interface - **POST /api/login**: User login. - Request body: `{ "username": "xxx", "password": "xxx" }` - **POST /api/register**: User registration. - Request body: `{ "username": "xxx", "password": "xxx" }` ## Configuration Details - `application.yml`: Configure database connection, FTP server information, etc. - `Dockerfile`: Used to build the Docker image, exposing port 9022. ## Testing - Use the `contextLoads` method in the `PhenocamBackApplicationTests` class to test whether the Spring context is loaded correctly. ## License This project is licensed under the MIT License. Please refer to the [LICENSE](LICENSE) file for more details.