Files
Environment-Monitoring-System/Report/temp.md
ChuXun 02a830145e 1
2025-10-25 19:18:43 +08:00

6.6 KiB


@startuml
title 任务核心模型 (Task Core Models)

skinparam classAttributeIconSize 0

class Task {
  - Long id
  - String title
  - String description
  - PollutionType pollutionType
  - SeverityLevel severityLevel
  - TaskStatus status
  - String textAddress
  - Integer gridX
  - Integer gridY
  - LocalDateTime assignedAt
  - LocalDateTime completedAt
}

class Assignment {
  - Long id
  - LocalDateTime assignmentTime
  - LocalDateTime deadline
  - AssignmentStatus status
  - String remarks
}

class TaskHistory {
  - Long id
  - TaskStatus oldStatus
  - TaskStatus newStatus
  - String comments
  - LocalDateTime changedAt
}

class TaskSubmission {
  - Long id
  - String notes
  - LocalDateTime submittedAt
}

' --- Relationships ---
' Task is the central entity
Task "1" *-- "1" Assignment : (has one)
Task "1" *-- "0..*" TaskHistory : (logs)
Task "1" *-- "0..*" TaskSubmission : (has)

' --- External Relationships for Context ---
Task ..> Feedback : (created from)
Task ..> UserAccount : (assignee)
Task ..> UserAccount : (createdBy)

Assignment ..> UserAccount : (assigner)
TaskHistory ..> UserAccount : (changedBy)
TaskSubmission ..> "*" Attachment : (has)

@enduml



@startuml
title 网格与地图模型 (Grid & Map Models)

skinparam classAttributeIconSize 0

class Grid {
  - Long id
  - Integer gridX
  - Integer gridY
  - String cityName
  - String districtName
  - String description
  - Boolean isObstacle
}

class MapGrid {
  - Long id
  - int x
  - int y
  - String cityName
  - boolean isObstacle
  - String terrainType
}
@enduml


@startuml
title 数据与日志模型 (Data & Logging Models)

skinparam classAttributeIconSize 0

class AqiData {
  - Long id
  - Integer aqiValue
  - Double pm25
  - Double pm10
  - String primaryPollutant
  - LocalDateTime recordTime
}

class AqiRecord {
  - Long id
  - String cityName
  - Integer aqiValue
  - Double pm25
  - Double pm10
  - LocalDateTime recordTime
}

class OperationLog {
  - Long id
  - OperationType operationType
  - String description
  - String targetId
  - String targetType
  - String ipAddress
  - LocalDateTime createdAt
}

class AssignmentRecord {
    - Long id
    - AssignmentMethod assignmentMethod
    - String algorithmDetails
    - AssignmentStatus status
    - LocalDateTime createdAt
}

' --- Relationships ---
AqiData ..> Grid : (recorded at)
AqiData ..> UserAccount : (reported by)

AqiRecord ..> Grid : (related to)

OperationLog ..> UserAccount : (performed by)

AssignmentRecord ..> Feedback : (for)
AssignmentRecord ..> UserAccount : (assigned to worker)
AssignmentRecord ..> UserAccount : (assigned by admin)
@enduml


@startuml
title 辅助与配置模型 (Utility & Configuration Models)

skinparam classAttributeIconSize 0

class PollutantThreshold {
  - Long id
  - PollutionType pollutionType
  - String pollutantName
  - Double threshold
  - String unit
}

class PasswordResetToken {
  - Long id
  - String token
  - LocalDateTime expiryDate
  ..
  + isExpired(): boolean
}

class Attachment {
  - Long id
  - String fileName
  - String fileType
  - String storedFileName
  - Long fileSize
  - LocalDateTime uploadDate
}

' --- Relationships ---
PasswordResetToken ..> UserAccount : (for)

Attachment ..> Feedback : (belongs to)
Attachment ..> TaskSubmission : (belongs to)
@enduml
@startuml
title 系统核心业务模型 (Core Business Models)
skinparam classAttributeIconSize 0

enum Gender{
    -Male
    -Female
    -OTHER
}
enum Role{

}
enum UserStatus
enum PollutionType
enum SeverityLevel
enum FeedbackStatus
enum TaskStatus
enum AssignmentStatus

class UserAccount {
  - Long id
  - String name
  - String phone
  - String email
  - String password
  - Gender gender
  - Role role
  - UserStatus status
  - Integer gridX
  - Integer gridY
  + isValid()
}

class Feedback {
  - Long id
  - String eventId
  - String title
  - PollutionType pollutionType
  - SeverityLevel severityLevel
  - FeedbackStatus status
  - Long submitterId
  + process()
  + approve()
}

class Task {
  - Long id
  - Long feedbackId
  - Long assigneeId
  - Long createdBy
  - TaskStatus status
  - String title
  + assignTo(workerId)
  + complete()
  + approve()
}

class Assignment {
  - Long id
  - Long taskId
  - Long assignerId
  - AssignmentStatus status
  - String remarks
  - LocalDateTime assignmentTime
}

class Grid {
  - Long id
  - Integer gridX
  - Integer gridY
  - String cityName
  - boolean isObstacle
}

UserAccount "1" *-- "1" Gender
UserAccount "1" *-- "1" Role
UserAccount "1" *-- "1" UserStatus
Feedback "1" *-- "1" PollutionType
Feedback "1" *-- "1" SeverityLevel
Feedback "1" *-- "1" FeedbackStatus
Task "1" *-- "1" TaskStatus
Assignment "1" *-- "1" AssignmentStatus

Task "1" --> "1" Feedback : "generated from"
Task "1" o-- "1" Assignment : "has"
UserAccount "1" --> "0..*" Feedback : "submits"
UserAccount "1" --> "0..*" Task : "creates"
Task "0..*" --o "1" UserAccount : "assigned to"
UserAccount "1" --> "0..*" Assignment : "assigns"
Task "1" ..> "1" Grid : "located in"
UserAccount "1" ..> "1" Grid : "operates in"
@enduml
@startuml
title EMS核心业务模型全景图

skinparam classAttributeIconSize 0


' --- Enumeration classes (using stereotype for max compatibility) ---
class Gender <<enumeration>> {
  MALE, FEMALE, OTHER
}
class Role <<enumeration>> {
  ADMIN, SUPERVISOR, GRID_WORKER
}
class UserStatus <<enumeration>> {
  ACTIVE, INACTIVE
}
class PollutionType <<enumeration>> {
  AIR, WATER, SOIL, NOISE
}
class SeverityLevel <<enumerationa>> {
  LOW, MEDIUM, HIGH, CRITICAL
}
class FeedbackStatus <<enumeration>> {
  PENDING_REVIEW, AI_REJECTED, PROCESSED
}
class TaskStatus <<enumeration>> {
  CREATED, ASSIGNED, IN_PROGRESS, SUBMITTED, APPROVED, REJECTED
}
class AssignmentStatus <<enumeration>> {
  PENDING, ACCEPTED, REJECTED
}

' --- Entity classes ---
class UserAccount
class Feedback
class Task
class Assignment
class Grid
class PasswordResetToken
class Attachment

' --- Relationships ---
UserAccount "1" --> "1" Gender
UserAccount "1" --> "1" Role
UserAccount "1" --> "1" UserStatus

Feedback "1" --> "1" PollutionType
Feedback "1" --> "1" SeverityLevel
Feedback "1" --> "1" FeedbackStatus

Task "1" --> "1" TaskStatus
Assignment "1" --> "1" AssignmentStatus

Task "1" --> "1" Feedback : "generated from"
Task "1" o-- "1" Assignment : "has"
UserAccount "1" --> "0..*" Feedback : "submits"
UserAccount "1" --> "0..*" Task : "creates"
Task "0..*" --o "1" UserAccount : "assigned to"
UserAccount "1" --> "0..*" Assignment : "assigns"
PasswordResetToken "1" --> "1" UserAccount : "for user"
Feedback "1" --> "0..*" Attachment : "has"

Task "1" ..> "1" Grid : "located in"
UserAccount "1" ..> "1" Grid : "operates in"

@enduml