A multi-module car‑pooling platform repository containing mobile clients (Android & iOS), a Java backend (Struts2-based web API), and a web-based manager/admin UI.
This README gives a concise orientation, quick-start steps to run the project locally, configuration notes, and troubleshooting tips.
- Backend: Java web services (Struts2, servlet-based), MyBatis-style mappers, many web actions under
service/srcandmanager/src. - Web admin: Traditional Java web app (JSP) in
manager/(deployable to Tomcat). - Mobile clients:
- Android modules:
android/CarPoolingApp(primary) andandroid/MainApp(companion). - iOS projects:
ios/CarPoolingApp/BJPinCheandios/MainApp/BJMainApp(Xcode projects).
- Android modules:
- Database: MySQL schema and seed file —
database/pinche.sql. - Integrations: Baidu Maps & Push, UMeng social SDKs, AFNetworking/SDWebImage on iOS, many 3rd-party libs.
Below is a concise features table that maps the platform's main capabilities to the modules and locations in the repository where their implementations live. This provides a quick reference for contributors who want to find and work on a specific capability.
- Ride Creation: Easily post upcoming trips with start/end points, date, time, and available seats.
- Route Optimization: (If applicable) Integration with mapping services to visualize the travel path.
- Passenger Management: View and manage booking requests from interested travelers.
- Smart Search: Filter rides by destination, date, and price to find the perfect match.
- Instant Booking: Secure a seat in just a few clicks with real-time availability updates.
- Ride History: Track past and upcoming journeys in a centralized dashboard.
- User Authentication: Secure login and profile management for verified community members.
- Real-time Updates: Stay informed with instant notifications on ride status changes.
- Responsive Design: Fully optimized for both desktop and mobile browsers.
| Feature | Module(s) | Location (example files/paths) | Notes |
|---|---|---|---|
| Ride matching / dispatch | service | service/src/com/webapi/common/ApiGlobal.java, service/src/com/webapi/structure/ |
Push-based notification → temporary-grab → server-side locking (in-memory lists). Consider migrating to a scoring model & distributed locks. |
| Booking flow (order creation → acceptance → payment) | android / ios / service / database | Mobile clients in android/*, ios/*; backend service/src/* (SVCOrder*); schema database/pinche.sql |
Typical lifecycle: create order (mobile) → persist DB → notify drivers → grab/accept → payment & evaluation. |
| Push notifications | service / mobile | service/src/com/webapi/common/ApiGlobal.java (Baidu Push), mobile push handlers in Android/iOS projects |
Uses Baidu ChannelClient for push. Keys and endpoints are in ApiGlobal and mobile configs. |
| Authentication (admin & API) | manager / service / mobile | manager/WebContent/WEB-INF/web.xml (AuthFilter), manager/src/* and service/src/* (SVCUser, login actions) |
Manager uses session-based auth; mobile uses API login actions. Consider token-based auth for mobile. |
| Admin / manager UI | manager | manager/ (JSPs, manager/src/struts.xml, manager/WebContent/WEB-INF/web.xml) |
Struts-based, session-filtered admin UI for data and operations. |
| Payments | android / service | android/* manifests reference WapPayActivity; server-side payment hooks in service/src |
WAP/web-based payment activity referenced; extend with modern gateways and secure callbacks. |
| Geolocation / Maps | android / ios / service | Android manifests android/*/AndroidManifest.xml, iOS Info.plist, Baidu Map integrations in mobile projects |
Uses Baidu Maps APIs; GPS permissions present in Android manifests. |
| Social login / sharing | android / ios | UMeng configs in AndroidManifest and iOS libs; android/MainApp manifests |
UMeng & Tencent/WeChat SSO configured; update app keys for your accounts. |
| Driver & user profiles | manager / service / mobile | service/src/com/.../SVCUser*, manager/src/, android/* |
CRUD, verification, and profile images handled by respective modules. |
| Evaluation & settlement | service / manager | service/src/com/webapi/structure/SVCEvaluationCS, settlement-related classes |
End-of-ride evaluation and settlement logic exist server-side; see structures in service. |
| Export / Reporting | manager | manager/src/com/pinche/common/Common.java (CSV export helpers), manager JSPs |
Utility helpers for generating CSV exports and reports. |
| Logging & diagnostics | service / manager / Tomcat | manager/src/log4j.properties, Tomcat logs, log4j usages in service/src |
Check Tomcat and log4j config files for runtime troubleshooting. |
| Schema & seed data | database | database/pinche.sql |
Full schema and seed data for local DB initialisation. |
This section analyzes three core areas of the project based on the repository contents and highlights where the relevant code lives.
What the code reveals
- The backend contains matching/dispatch logic and concurrency controls:
service/src/com/webapi/common/ApiGlobal.javaincludes arrays such asarrOnceOrderIDsandarrLongOrderIDsand synchronized lock methods (e.g.,lockOnceOrderAcceptance) used to prevent double-acceptance of the same order.- There are domain classes and action handlers for different order types:
SVCOrderTempGrab,SVCOrderTempDetails,SVCOrderOnOffDutyGrab,SVCOrderLongDistanceDetails, etc., indicating the system differentiates between short (one-time), long-distance, and on/off-duty orders. ApiGlobalalso contains code that integrates with Baidu Push (imports and usage ofBaiduChannelClientand related classes), which is used to notify drivers of available orders.
How matching appears to work (inferred)
- Orders are created by users (mobile apps → backend DB). The service notifies candidate drivers via push notifications (Baidu Push).
- Driver-side "grab" operations are handled by temporary-grab endpoints. The backend uses synchronized locks / in-memory lists to avoid multiple drivers accepting the same order simultaneously.
- Matching is likely driven by a combination of order type (once, long-distance, on/off duty), city/region (see
SVCCity), timing, and basic proximity heuristics (proximity logic is implied by presence of location/route fields in order structures and the mobile clients’ location permissions). - The current approach looks like a pragmatic first-step dispatch: notify many candidates, first valid grab wins, with server-side locking to guarantee single acceptance.
Suggested improvements
- Introduce a more formal proximity / scoring function (distance, ETA, driver rating, current load).
- Consider persistent distributed locks (DB row lock or Redis lock) to make locking robust across multiple backend instances.
- Add metrics and tracing for matching latency and fairness.
Files referenced
service/src/com/webapi/common/ApiGlobal.javaservice/src/com/webapi/structure/*(SVCOrder*, SVCCity)- Backend push integration references (Baidu push classes imported in ApiGlobal)
What the code reveals
- Manager / admin UI:
manager/WebContent/WEB-INF/web.xmlregisters anAuthFilterwith asessionKeyofuserand redirects to/bkon unauthorized access — indicating session-based authentication for the web UI.- Login handling and actions are defined (e.g.,
com.pinche.authority.manager.action.LoginActionand related Struts2 actions inmanager/src/struts.xml).
- Mobile and API:
- Service side contains
SVCUser,SVCUserLoginstructures and login actions underservice/src(search for login-related actions). Mobile apps call backend endpoints to authenticate users. - Android and iOS apps include social SDKs (UMeng), so social login options are integrated or supported in the clients.
- Service side contains
- Configuration:
- Database connection and credential information are in
manager/src/jdbc.propertiesandservice/src/jdbc.properties.
- Database connection and credential information are in
Security posture (inferred)
- Web UI uses server-side session (AuthFilter) — suitable for browser-based admin UI.
- API-based mobile authentication is present but implementation details (tokens, session cookies, expiry) should be verified in
service/srclogin actions. - Social SDKs (UMeng) are included in client projects, indicating possible OAuth-style flows on the mobile side.
Suggested improvements
- If not already used, employ token-based authentication (short-lived tokens / refresh tokens) for mobile APIs to avoid sharing session cookies.
- Use HTTPS for all API endpoints and ensure API keys/credentials are never checked into source (use environment config).
- Add password-strength rules, rate-limiting, and login attempt monitoring.
Files referenced
manager/WebContent/WEB-INF/web.xml(AuthFilter)manager/src/struts.xml(LoginAction mappings)service/src/*(SVCUser, SVCUserLogin, login-related actions)- Android/iOS client projects (UMeng integration, manifests)
Overview (from code & manifests)
- Mobile user creates a ride request via Android/iOS apps; forms and order submission logic live in mobile project source.
- Backend persists orders to MySQL (
database/pinche.sqlcontains schema) and triggers notifications to potential drivers. - Drivers receive push via Baidu Push and can "grab" the order; the backend has temporary-grab handlers and concurrency controls (see
SVCOrderTempGrabandApiGloballocking). - After a driver accepts, order status is updated and post-acceptance flows occur (ride execution, evaluation, payment). Android includes a
WapPayActivityreferenced inandroid/MainApp/AndroidManifest.xml, indicating WAP-based or web-based payment flows are supported.
Concrete steps (typical booking flow inferred)
- Rider submits order from mobile client (specifying pickup, destination, time, seat count).
- Backend creates order record in DB and determines candidate drivers.
- Backend notifies candidate drivers (Baidu Push via
ApiGlobal). - Drivers request to grab the order (temporary grab endpoint(s)).
- Backend uses synchronized locking (e.g.,
lockOnceOrderAcceptance) to prevent race conditions; first successful grab sets order to "accepted". - Once accepted, the order status is updated and payment flow is initiated (client-side
WapPayActivityor other payment methods). - After trip completion, evaluation and settlement flows are executed (see
SVCEvaluationCS, settlement-related classes).
Suggested improvements
- Expose clearer API documentation / sample curl requests for order creation and acceptance endpoints.
- Add server-side timeouts and stale-grab cleanup for abandoned temporary grabs.
- Add end-to-end testing for the full booking lifecycle.
Files referenced
service/src/com/webapi/common/ApiGlobal.java(locking, push)service/src/com/webapi/structure/*(SVCOrder*, SVCUser, evaluation/settlement structures)android/*manifests (WapPayActivity), iOS projects (payment & libraries)database/pinche.sql(schema)
Below are the main technologies used in the project. Icons are rendered with shields.io badges.
Short notes:
- Java + Struts2 power the backend APIs and manager UI (deploy to Tomcat).
- MySQL stores schema/data (see
database/pinche.sql). - Android and iOS clients are native. Android manifests include many necessary permissions (location, network, storage).
- Baidu Push/Maps and UMeng social integrations are present in the codebase and client libraries.
- android/ — Android applications (CarPoolingApp, MainApp)
- ios/ — iOS apps (BJPinChe, BJMainApp)
- service/ — Backend web API (Struts2)
- manager/ — Admin/manager web UI (JSP)
- database/ — SQL schema:
pinche.sql - README.md — this file
- LICENSE — MIT
These are high‑level steps to get a working local environment. Because this repository contains legacy project layouts, the easiest approach is to import and run in IDEs (Eclipse / Android Studio / Xcode) and a local Tomcat for Java webapps.
- Java JDK 8 (or JDK compatible with project)
- Apache Tomcat 7/8 (or any compatible servlet container)
- MySQL 5.6+ (or compatible)
- Eclipse (for webapp import) OR IntelliJ IDEA / STS
- Android Studio (recommended) and Android SDK (match target/min SDK from manifests)
- Xcode (for iOS projects)
- Git client
- Create a MySQL database, e.g.
pinche. - Import schema/data:
- From repo root:
- mysql -u root -p pinche < database/pinche.sql
- From repo root:
- Update DB connection properties:
manager/src/jdbc.properties(manager webapp)service/src/jdbc.properties(service/webapi)- If you use a different file or environment, search for
jdbc.propertiesin the repo and update accordingly.
- Open
service/in your Java IDE as a Dynamic Web Project (or import as existing Java web project). - Ensure
WEB-INF/web.xmlandsrcconfiguration are present (they are). - Edit database and environment configuration files if necessary (
service/src/jdbc.properties,service/src/com/webapi/common/ApiGlobal.java).ApiGlobal.javacontains global API constants and some endpoint configuration; update host or base URLs as needed.
- Build and deploy to Tomcat (export WAR or run from IDE).
- By default, the service will be available at:
- http://localhost:8080/service/ (or the context path you deployed)
- Test a simple endpoint (depends on deployed mappings). Check
service/src/struts.xmlandservice/src/com/webapipackages for action names and routes.
- Open
manager/in your Java IDE as a Dynamic Web Project. - Configure DB connection in
manager/src/jdbc.properties. - Deploy
managerapp to Tomcat (context path/manageris common). - Visit manager home (example): http://localhost:8080/manager/ (adjust context path as set)
- The project uses Struts and maps many actions in
manager/src/struts.xml.
- In Android Studio:
- File → New → Import Project...
- Select
android/CarPoolingApp(orandroid/MainApp) and import. - If the project is an older ADT/Eclipse project, Android Studio will attempt to convert; you may need to create a new Gradle project and add sources if conversion fails.
- Check and update:
AndroidManifest.xml(package name, permissions; seeandroid/CarPoolingApp/AndroidManifest.xmlandandroid/MainApp/AndroidManifest.xml).- API base URL in code/config (search for
SERVER_URL,ApiGlobal, or references to your service host).
- Build & Run on an emulator / physical device. Make sure to enable required SDK packages (Google Play services if needed).
- Open the Xcode project/workspace:
ios/CarPoolingApp/BJPinChe.xcodeprojor workspace.
- Check Info.plist and code for API host values. The iOS apps include many frameworks (AFNetworking, SDWebImage, UMeng, BaiduMap). You may need to install CocoaPods or add frameworks to the workspace if some frameworks are external — however many are checked in under
Library/. - Select a target device or simulator and Run (⌘R).
- Database:
manager/src/jdbc.propertiesservice/src/jdbc.properties
- Backend API/global:
service/src/com/webapi/common/ApiGlobal.java— update base URLs, keys, push settings.
- Android manifests:
android/CarPoolingApp/AndroidManifest.xmlandroid/MainApp/AndroidManifest.xml
- iOS:
- Info.plist files under each Xcode project (
BJPinChe-Info.plist,BJMainApp-Info.plist) andLibrary/for embedded SDKs.
- Info.plist files under each Xcode project (
- Struts/web mappings:
manager/src/struts.xmlservice/src/struts.xml
- Web app descriptor:
manager/WebContent/WEB-INF/web.xml— contains filters (AuthFilter, Struts filter) and welcome page.
- Legacy Android project: if Android Studio can't import cleanly, consider:
- Create a new Android Studio project and copy source files (src, res, AndroidManifest).
- Or use an older ADT workspace / Eclipse with Android SDK tools if conversion is difficult.
- Missing native libs or frameworks on iOS:
- Many frameworks are vendor-supplied in
Library/. Check Build Settings for library/linker flags.
- Many frameworks are vendor-supplied in
- Logging & errors:
- Backend logs configured via log4j (see
manager/src/log4j.propertiesorserviceequivalents). Check Tomcat logs if actions fail.
- Backend logs configured via log4j (see
- When you change DB credentials, restart the webapps to pick up changes.
- If push or social SDKs fail, you may need to register your own API keys and update configuration constants in code (ApiGlobal and related partner-config files under Android/iOS modules).
Planned improvements and features (prioritized):
- GPS Integration & Real-time Tracking (High)
- Add a persistent GPS/telemetry pipeline so drivers and riders can share real-time location.
- Use WebSocket (or MQTT) for live location updates and improve order matching by ETA rather than static proximity.
- Update mobile apps to stream location with configurable frequency and server-side storage for trip replay.
- Enhanced Matching Engine (High)
- Move from first-come-first-served to a scoring model combining ETA, driver rating, acceptance rate, and current passenger capacity.
- Consider multi-criteria optimization for batching nearby ride requests.
- Robust Distributed Locking (Medium)
- Replace in-memory arrays used for locking with DB row locks or Redis-based distributed locks for multi-instance backend reliability.
- Stronger Authentication & Authorization (Medium)
- Migrate mobile APIs to token-based auth (JWT or similar), add refresh tokens and enforce proper expiry.
- Add 2FA for manager accounts.
- Payment Modernization (Medium)
- Expand payment methods and integrate server-side payment gateways with secure callbacks and reconciliation.
- CI/CD, Automated Tests & Monitoring (Low → High overtime)
- Add unit/integration tests for booking and matching flows.
- Add CI pipelines and runtime monitoring (metrics for matching latency, acceptance rates).
- Documentation & API Spec (Low)
- Publish an OpenAPI/Swagger spec for backend APIs to make integration and testing easier.
- Fork the repository and create a feature branch.
- Make small, focused commits.
- Open a pull request with a clear description of the change and instructions to test (if needed).
Please include: which module, steps to reproduce, and expected vs actual behavior.
This project is licensed under the MIT License — see LICENSE.