https://plantuml.com/zh/guide
https://plantuml.com/zh/activity-diagram-beta
@startuml
|#lightYellow|用户|
start
:输入手机号;
:选择话费套餐;
|#lightBlue|充值APP|
:生成,提交订单;
|#lightgray|服务商|
:生成订单;
|充值APP|
:展示支付方式;
|用户|
:选择支付方式;
:支付套餐金额;
|服务商|
:支付结果通知;
split
:更新订单状态;
|充值APP|
:展示支付结果;
|用户|
:获取支付结果;
kill
split again
|服务商|
-[dashed]->
if(支付成功) then(成功)
:向运营商发起充值请求;
|#pink|运营商|
:接收到充值请求;
:执行充值;
:通知充值结果;
|服务商|
:更新订单状态;
|充值APP|
:展示充值结果;
|用户|
:获取充值结果;
floating note left #red:充值流程结束
end
else(失败)
|服务商|
:失败处理流程;
kill
@enduml
@startuml
'https://plantuml.com/sequence-diagram
title 时序图示例
header @author chenxiu
footer page @author chenxiu
skinparam roundcorner 20
skinparam sequenceParticipant underline
skinparam LifeLineBackgroundColor #lightYellow
hide footbox
actor User as user #green
box ATM
control 屏幕 as app #lightBlue
participant 读卡器 as reader #yellow
end box
box BANK #lightBlue
participant service
entity 短信
queue MessageQueue
database Mysql
activate user
user->reader #lightBlue:插如银行卡
activate reader
reader-> reader:读卡
activate reader
deactivate reader
reader->app:显示屏幕
deactivate reader
activate app
app ->user:提示输入密码
deactivate app
user->app:输入密码
activate app
app-> service:查询用户
activate service
service->Mysql:查询用户
activate Mysql
Mysql ->service:resultSet
deactivate Mysql
alt 用户存在
service ->> MessageQueue:发送登陆ATM消息
activate MessageQueue
note over MessageQueue #red:通过消息队列消峰
...30秒...
MessageQueue ->短信:发送短信
activate 短信
短信 -->user
deactivate 短信
deactivate MessageQueue
service ->app:服务选项
app -> user :提示选择服务
else 用户不存在
|||
service->app:登陆失败
deactivate service
app-> user:重新输入密码
deactivate app
end
@enduml