GithubHelp home page GithubHelp logo

hhy5277 / qbike Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joecao/qbike

0.0 1.0 0.0 384 KB

A demo of share bike using DDD, MicroService and Spring Cloud

Java 34.25% Dockerfile 0.24% TSQL 63.92% Shell 1.59%

qbike's Introduction

滴滴电动车

本项目纯属虚构,如有雷同实属巧合

项目背景

在嘀嘀打车的创业成功经验引领下你的创业团队发现了一个拥挤的大城市的电动车机会。 你们发现电动车由于其灵活性能够在拥挤的路面上穿行,从而能够帮助很多上班族避免早晚高峰,按时到达目的地,比滴滴打车更方便。 你们决定设计一个电动车的打车平台,能够在早晚高峰时匹配电动车司机和有需要的乘客。

Quick Start

启动docker daemon进程
mvn clean install -DskipTests=true
docker-compose up mysql
ctrl-c退出
docker-compose up

http://localhost:8050

测试接口

安装postman,导入qbkie.postman_collection.json
调用fetchUser接口,注意,spring cloud第一次调用可能会失败,需要预热一段时间。
出现结果后,调用updateDriverPostion接口,将司机的坐标导入到redis中
然后就可以使用placeIntention接口发起一个请求 然后再用confirmIntention接口,返回true就是成功匹配了,Order就会生成
注意:confirm的接口中需要输入intentionId,如果是第一次,就是1,不清楚,可以到docker的MySQL的表t_intention中找

http://127.0.0.1:9411上可以找到zipkin对这几次调用的结果的追踪
zipkin

Dev

请安装Lombok插件,Java8 Stream + Lombok + Spring boot, 你会拥有一个全新的Java开发体验。

TODO

  • 完全基于领域驱动设计
  • 聚合根、领域对象、API的提炼按照Event Storming过程分析
  • 升级到Spring Boot 2.0Spring Cloud Finchley
  • Eureka服务注册与发现
  • Swagger2管理REST API
  • Hystrix服务的保护与容错
  • Zuul网关应用
  • Zipkin分布式追踪

业务场景

初步设计的场景比较简单,主要是匹配有需求的乘客附近的电动车司机。经过前期的需求梳理,产出了下列的基本功能

  • 司机发布自己的位置和状态(默认一辆电动车只能搭载一位乘客)
  • 乘客提交行程需求(行程需要包含起点和终点,只支持实时提交,不支持预约)
  • 系统自动为乘客匹配合适的司机,将需求发送至司机手中
  • 司机确认是否接受行程
  • 司机和乘客按订单完成行程
  • 乘客行程途中要求改变行程
  • 系统计费及完成订单
  • 乘客对司机的评价

主要场景.005

业务流程

业务流程.006

事件

事件.008

命令

滴滴电动车需求.009

聚合识别

滴滴电动车需求.010

滴滴电动车需求.011

系统架构

image

qbike's People

Contributors

joecao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.