架构师训练营 - 命题作业 1
食堂就餐卡系统设计:
1、系统用例图:
2、组件图
3、组件时序图
4、部署图
注:基于PlantUML,代码如下:
1、用例图:
@startuml
left to right direction
actor "消费者" as xfz
actor "服务员" as fwy
actor "管理员" as gly
rectangle 食堂就餐卡系统 {
usecase "餐卡注册" as ckzc
usecase "餐卡信息获取" as xxhq
usecase "餐卡消费" as ckxf
usecase "统计报表" as sjtj
usecase "金额扣减" as jekj
}
xfz --> ckzc
xfz --> ckxf
fwy --> ckxf
ckxf --> xxhq : extend
ckxf --> jekj : extend
gly --> sjtj
@enduml
2、组件图:
@startuml
interface "餐卡注册" as ckzc
interface "餐卡消费" as ckxf
interface "统计报表" as tjbb
component "管理中心" as glzx
component "收款机" as skj
database "MySql" as db
ckzc --> glzx
ckxf --> skj
skj --> glzx
glzx --> db
tjbb --> glzx
@enduml
3、组件时序图
@startuml
actor "消费者" as xfz
actor "服务员" as fwy
actor "管理员" as gly
participant "收款机" as skj
participant "管理中心" as glzx
xfz -> gly: 1.餐卡注册
activate gly
gly -> glzx: 注册信息/金额输入
activate glzx
glzx --> gly
deactivate glzx
gly --> xfz : 餐卡交付
deactivate gly
deactivate glzx
xfz -> skj: 2.插卡消费
activate skj
skj -> glzx: 获取数据
activate glzx
glzx --> skj : 启动事务,返回数据
skj --> xfz: 展示余额
fwy -> skj: 消费金额输入
skj -> skj : 扣减
skj -> glzx: 同步数据
glzx --> skj: 完成扣减,结束事务
deactivate glzx
skj --> xfz : 展示余额
deactivate skj
deactivate glzx
gly -> glzx : 3.查看报表
glzx --> gly
@enduml
4、部署图
@startuml
actor "服务员1" as fwy1
actor "服务员2" as fwy2
actor "管理员" as gly
node "收款机1" as skj1
node "收款机2" as skj2
node "管理中心" as glzx
cloud "TCP/IP网络" as wl
database "MySQL" as db
fwy1 -> skj1
skj1 -> wl
fwy2 -> skj2
skj2 -> wl
glzx -> db
glzx <- gly
wl -> glzx
@enduml
版权声明: 本文为 InfoQ 作者【水边】的原创文章。
原文链接:【http://xie.infoq.cn/article/31e360aaed7e5c5a3279a61c4】。文章转载请联系作者。
评论