|
@@ -1,62 +1,81 @@
|
|
|
-# //陪聊部分
|
|
|
-# 类图
|
|
|
+# 简单版类图
|
|
|
```plantuml
|
|
|
-' 聊天项目类图英文版
|
|
|
@startuml
|
|
|
-
|
|
|
class _User {
|
|
|
- + objectId: String //用户唯一标识符
|
|
|
- + username: String //用户名
|
|
|
- + realname: String //真实姓名
|
|
|
- + password: String //用户密码
|
|
|
- + gender: String //性别
|
|
|
- + age: Number //年龄
|
|
|
- + email: String //用户邮箱
|
|
|
- + avatar: String //用户头像
|
|
|
- + startChat(): void
|
|
|
- + chooseChatPartner(): String
|
|
|
- + summarizeChatHistory(): void
|
|
|
+ + objectId: String
|
|
|
+ + username: String
|
|
|
+ + realname: String
|
|
|
+ + password: String
|
|
|
+ + gender: String
|
|
|
+ + age: Number
|
|
|
+ + email: String
|
|
|
+ + avatar: String
|
|
|
}
|
|
|
-
|
|
|
class ChatPartner {
|
|
|
- + objectId: String //陪聊师唯一标识符
|
|
|
- + name: String //陪聊师姓名
|
|
|
- + expertise: String //陪聊师专业领域
|
|
|
- + avatar: String //陪聊师头像
|
|
|
- + bio: String //陪聊师个人简介
|
|
|
- + provideChat(): String
|
|
|
+ + objectId: String
|
|
|
+ + name: String
|
|
|
+ + expertise: String
|
|
|
+ + avatar: String
|
|
|
+ + bio: String
|
|
|
}
|
|
|
-
|
|
|
class ChatCompanion {
|
|
|
- + objectId: String //聊天伙伴唯一标识符
|
|
|
- + name: String //聊天伙伴姓名
|
|
|
- + avatar: String //聊天伙伴头像
|
|
|
- + bio: String //聊天伙伴个人简介
|
|
|
- + provideChat(): String
|
|
|
+ + objectId: String
|
|
|
+ + name: String
|
|
|
+ + avatar: String
|
|
|
+ + bio: String
|
|
|
}
|
|
|
-
|
|
|
class ChatRecord {
|
|
|
- + objectId: String //聊天记录唯一标识符
|
|
|
- + title:String //聊天标题
|
|
|
- + content:Array //聊天内容
|
|
|
- + user: Pointer<User> //关联的用户对象
|
|
|
- + chatpartner: Pointer<ChatPartner> //关联的聊天机器人对象
|
|
|
- + getChatHistory(): List
|
|
|
+ + objectId: String
|
|
|
+ + title:String
|
|
|
+ + content:Array
|
|
|
+ + user: Pointer<User>
|
|
|
+ + chatpartner: Pointer<ChatPartner>
|
|
|
}
|
|
|
-
|
|
|
class ChatReport {
|
|
|
- + objectId: String //报告唯一标识符
|
|
|
- - report: String //分析结果
|
|
|
- + generateReport(): String //生成报告的方法
|
|
|
+ + objectId: String
|
|
|
+ - report: String
|
|
|
}
|
|
|
class ChatEvaluate{
|
|
|
- + objectId:String//评论唯一标识符
|
|
|
- + avater:String//用户头像
|
|
|
- + content:String//评论内容
|
|
|
- + rating:Number//评论星星数
|
|
|
- + user: Pointer<User> //关联的用户对象
|
|
|
+ + objectId:String
|
|
|
+ + avater:String
|
|
|
+ + content:String
|
|
|
+ + rating:Number
|
|
|
+ + user: Pointer<User>
|
|
|
}
|
|
|
-
|
|
|
+class PsychologicalCommunity {
|
|
|
+ + communityID: String
|
|
|
+ + topic: String
|
|
|
+}
|
|
|
+class PsychologicalActivity {
|
|
|
+ + activityID: String
|
|
|
+ + title: String
|
|
|
+ + description: String
|
|
|
+ + date: Date
|
|
|
+ + location: String
|
|
|
+}
|
|
|
+class PsychologicalSurvey {
|
|
|
+ + surveyID: String
|
|
|
+ + content: String
|
|
|
+ + publisher: SchoolAdmin
|
|
|
+ + responses: List
|
|
|
+}
|
|
|
+class SchoolAdmin {
|
|
|
+ + adminID: String
|
|
|
+ + name: String
|
|
|
+ + email: String
|
|
|
+}
|
|
|
+class Bottle {
|
|
|
+ + bottleID: String
|
|
|
+ + content: String
|
|
|
+ + author: User
|
|
|
+ + timestamp: Date
|
|
|
+}
|
|
|
+_User "1" -- "0..*" PsychologicalCommunity
|
|
|
+PsychologicalActivity "1" -- "0..*" _User
|
|
|
+SchoolAdmin "1" -- "0..*" PsychologicalActivity
|
|
|
+SchoolAdmin "1" -- "0..*" PsychologicalSurvey
|
|
|
+PsychologicalSurvey "1" -- "0..*" _User
|
|
|
+_User "1" -- "0..*" Bottle
|
|
|
_User "*" --> "*" ChatEvaluate
|
|
|
_User "1" --> "*" ChatRecord
|
|
|
ChatPartner "1" --> "*" ChatRecord
|
|
@@ -64,6 +83,8 @@ ChatCompanion "1" --> "*" ChatRecord
|
|
|
ChatRecord "1" --> "1" ChatReport
|
|
|
@enduml
|
|
|
```
|
|
|
+
|
|
|
+
|
|
|
# 时序图
|
|
|
```plantuml
|
|
|
@startuml
|
|
@@ -150,78 +171,6 @@ rectangle "心理社区" {
|
|
|
学校管理员 -- (设置星标用户)
|
|
|
}
|
|
|
|
|
|
-@enduml
|
|
|
-```
|
|
|
-# 类图
|
|
|
-
|
|
|
-```plantuml
|
|
|
-@startuml
|
|
|
-class User {
|
|
|
- +objectId: String
|
|
|
- +username: String
|
|
|
- +realname: String
|
|
|
- +password: String
|
|
|
- +gender: String
|
|
|
- +age: Number
|
|
|
- +email: String
|
|
|
- +avatar: String
|
|
|
- +startChat():void
|
|
|
- +chooseChatPartner():String
|
|
|
- +summarizeCharHistory():void
|
|
|
- +registerAccount():void
|
|
|
- +login(): void
|
|
|
- +fillPsychologicalTest(): void
|
|
|
- +publishBottle(): void
|
|
|
- +retrieveBottle(): Bottle
|
|
|
-}
|
|
|
-
|
|
|
-class PsychologicalCommunity {
|
|
|
- +communityID: String
|
|
|
- +topic: String
|
|
|
- +joinCommunity(): void
|
|
|
-}
|
|
|
-
|
|
|
-class PsychologicalActivity {
|
|
|
- +activityID: String
|
|
|
- +title: String
|
|
|
- +description: String
|
|
|
- +date: Date
|
|
|
- +location: String
|
|
|
- +publishActivity(): void
|
|
|
-}
|
|
|
-
|
|
|
-class PsychologicalSurvey {
|
|
|
- +surveyID: String
|
|
|
- +content: String
|
|
|
- +publisher: SchoolAdmin
|
|
|
- +responses: List
|
|
|
- +publishSurvey(): void
|
|
|
- +analyzeResults(): void
|
|
|
-}
|
|
|
-
|
|
|
-class SchoolAdmin {
|
|
|
- +adminID: String
|
|
|
- +name: String
|
|
|
- +email: String
|
|
|
- +publishPsychologicalActivity(): void
|
|
|
- +publishPsychologicalSurvey(): void
|
|
|
- +analyzeSurveyResults(): void
|
|
|
- +setFeaturedUser(): void
|
|
|
-}
|
|
|
-
|
|
|
-class Bottle {
|
|
|
- +bottleID: String
|
|
|
- +content: String
|
|
|
- +author: User
|
|
|
- +timestamp: Date
|
|
|
-}
|
|
|
-
|
|
|
-User "1" -- "0..*" PsychologicalCommunity
|
|
|
-PsychologicalActivity "1" -- "0..*" User
|
|
|
-SchoolAdmin "1" -- "0..*" PsychologicalActivity
|
|
|
-SchoolAdmin "1" -- "0..*" PsychologicalSurvey
|
|
|
-PsychologicalSurvey "1" -- "0..*" User
|
|
|
-User "1" -- "0..*" Bottle
|
|
|
@enduml
|
|
|
```
|
|
|
|
|
@@ -280,3 +229,127 @@ stateDiagram-v2
|
|
|
|
|
|
```
|
|
|
|
|
|
+
|
|
|
+# 登录业务
|
|
|
+```plantuml
|
|
|
+@startuml
|
|
|
+left to right direction
|
|
|
+[*] --> 输入用户名和密码
|
|
|
+
|
|
|
+输入用户名和密码 --> 检查是否为空
|
|
|
+检查是否为空 --> 执行登录 : 不为空
|
|
|
+检查是否为空 --> 输入用户名和密码 : 为空
|
|
|
+执行登录 --> 返回当前页面: 登录成功
|
|
|
+执行登录 --> 输入用户名和密码 :登录失败
|
|
|
+
|
|
|
+返回当前页面 --> [*]
|
|
|
+@enduml
|
|
|
+```
|
|
|
+# 注册业务
|
|
|
+```plantuml
|
|
|
+@startuml
|
|
|
+left to right direction
|
|
|
+
|
|
|
+[*] --> 输入基本信息
|
|
|
+
|
|
|
+输入基本信息 --> 检查是否为空
|
|
|
+检查是否为空 --> 输入基本信息 : 为空
|
|
|
+检查是否为空 --> 检查两次密码一致性 : 不为空
|
|
|
+
|
|
|
+检查两次密码一致性 --> 执行注册 : 一致
|
|
|
+检查两次密码一致性 --> 输入基本信息 : 不一致
|
|
|
+
|
|
|
+执行注册 --> 返回登录页面 : 注册成功
|
|
|
+执行注册 --> 输入基本信息 : 注册失败
|
|
|
+
|
|
|
+返回登录页面 --> [*]
|
|
|
+@enduml
|
|
|
+
|
|
|
+```
|
|
|
+# 用户编辑信息业务
|
|
|
+```plantuml
|
|
|
+@startuml
|
|
|
+left to right direction
|
|
|
+
|
|
|
+[*] --> 获取用户信息
|
|
|
+
|
|
|
+获取用户信息 --> 弹出表单
|
|
|
+
|
|
|
+弹出表单 --> 检查用户输入
|
|
|
+
|
|
|
+检查用户输入 --> 执行修改
|
|
|
+
|
|
|
+执行修改 --> 返回当前页面: 修改成功
|
|
|
+执行修改 --> 弹出表单 : 修改失败
|
|
|
+返回当前页面 --> [*]
|
|
|
+@enduml
|
|
|
+```
|
|
|
+# 智能陪聊业务
|
|
|
+```plantuml
|
|
|
+@startuml
|
|
|
+left to right direction
|
|
|
+
|
|
|
+[*] --> 检查用户是否登录注册
|
|
|
+
|
|
|
+检查用户是否登录注册 --> 登录注册 : 未登录
|
|
|
+检查用户是否登录注册 --> 选择陪聊师 : 已登录
|
|
|
+
|
|
|
+登录注册 --> 选择陪聊师 : 登录/注册成功
|
|
|
+登录注册 --> [*] : 登录/注册失败
|
|
|
+
|
|
|
+选择陪聊师 --> 开始陪聊
|
|
|
+
|
|
|
+开始陪聊 --> [*] : 结束陪聊
|
|
|
+@enduml
|
|
|
+```
|
|
|
+# 普通聊天业务
|
|
|
+```plantuml
|
|
|
+@startuml
|
|
|
+left to right direction
|
|
|
+
|
|
|
+[*] --> 检查用户是否登录注册
|
|
|
+
|
|
|
+检查用户是否登录注册 --> 登录注册 : 未登录
|
|
|
+检查用户是否登录注册 --> 开始陪聊 : 已登录
|
|
|
+
|
|
|
+登录注册 --> 开始陪聊 : 登录/注册成功
|
|
|
+登录注册 --> [*] : 登录/注册失败
|
|
|
+
|
|
|
+开始陪聊 --> [*] : 结束陪聊
|
|
|
+@enduml
|
|
|
+```
|
|
|
+# 用户评价业务
|
|
|
+```plantuml
|
|
|
+@startuml
|
|
|
+left to right direction
|
|
|
+
|
|
|
+[*] --> 检查用户是否登录注册
|
|
|
+
|
|
|
+检查用户是否登录注册 --> 登录注册 : 未登录
|
|
|
+检查用户是否登录注册 --> 进入评价 : 已登录
|
|
|
+
|
|
|
+登录注册 --> 进入评价 : 登录/注册成功
|
|
|
+登录注册 --> [*] : 登录/注册失败
|
|
|
+
|
|
|
+进入评价 --> 输入评价内容
|
|
|
+
|
|
|
+输入评价内容 --> 保存退出
|
|
|
+
|
|
|
+保存退出 --> 返回当前页面 : 保存成功
|
|
|
+返回当前页面 --> [*]
|
|
|
+@enduml
|
|
|
+```
|
|
|
+# 查看报告业务
|
|
|
+```plantuml
|
|
|
+@startuml
|
|
|
+left to right direction
|
|
|
+
|
|
|
+[*] --> 获取用户信息
|
|
|
+
|
|
|
+获取用户信息 --> 点击我的报告
|
|
|
+
|
|
|
+点击我的报告 --> 展示用户相关报告
|
|
|
+
|
|
|
+展示用户相关报告 --> [*]
|
|
|
+@enduml
|
|
|
+```
|