# 工单评分管理时序图

## 1. 工单列表查询时序图

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtOrderScoreController
    participant Service as GxtOrderScoreServiceImpl
    participant Mapper as GxtOrderScoreMapper
    
    User->>Controller: 发送查询请求 /list
    Controller->>Service: 调用selectUnionOrderList()
    Service->>Mapper: 查询合并工单列表
    Mapper-->>Service: 返回工单列表数据
    Service->>Service: 填充人员评分列表
    Service-->>Controller: 返回处理后的工单列表
    Controller-->>User: 返回响应数据
```

## 2. 工单自评时序图

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtOrderScoreController
    participant Service as GxtOrderScoreServiceImpl
    participant RepairService as GxtRepairOrderService
    participant WorkService as GxtWorkOrderService
    participant FlowService as GxtRepairOrderFlowService
    participant Mapper as GxtRepairOrderMapper
    
    User->>Controller: 发送自评请求 /selfEvaluation
    Controller->>Service: 调用selfEvaluation()
    Service->>RepairService: 查询维修工单详情
    RepairService->>Mapper: selectGxtRepairOrderById()
    Mapper-->>RepairService: 返回工单信息
    RepairService-->>Service: 返回工单信息
    Service->>RepairService: 更新工单信息
    Service->>RepairService: 更新人员评分信息
    Service->>FlowService: 添加工单流转记录
    FlowService-->>Service: 返回操作结果
    Service-->>Controller: 返回操作结果
    Controller-->>User: 返回响应数据
```

## 3. 工单复评时序图

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtOrderScoreController
    participant Service as GxtOrderScoreServiceImpl
    participant RepairService as GxtRepairOrderService
    participant FlowService as GxtRepairOrderFlowService
    participant MonthScoreService as GxtMonthScoreService
    participant UserScoreService as GxtUserScoreService
    
    User->>Controller: 发送复评请求 /review
    Controller->>Service: 调用review()
    Service->>RepairService: 查询维修工单详情
    RepairService-->>Service: 返回工单信息
    Service->>RepairService: 更新工单信息
    Service->>RepairService: 更新人员评分信息
    Service->>FlowService: 添加工单流转记录
    FlowService-->>Service: 返回操作结果
    Service->>MonthScoreService: 更新月度统计数据
    MonthScoreService-->>Service: 返回操作结果
    Service->>UserScoreService: 更新用户评分统计
    UserScoreService-->>Service: 返回操作结果
    Service-->>Controller: 返回操作结果
    Controller-->>User: 返回响应数据
```

## 4. 工单终评时序图

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtOrderScoreController
    participant Service as GxtOrderScoreServiceImpl
    participant RepairService as GxtRepairOrderService
    participant FlowService as GxtRepairOrderFlowService
    participant UserScoreService as GxtUserScoreService
    
    User->>Controller: 发送终评请求 /finalEvaluation
    Controller->>Service: 调用finalEvaluation()
    Service->>RepairService: 查询维修工单详情
    RepairService-->>Service: 返回工单信息
    Service->>RepairService: 更新人员评分信息
    Service->>RepairService: 更新工单状态
    Service->>FlowService: 添加工单流转记录
    FlowService-->>Service: 返回操作结果
    Service->>UserScoreService: 更新用户评分统计(终评专用)
    UserScoreService-->>Service: 返回操作结果
    Service-->>Controller: 返回操作结果
    Controller-->>User: 返回响应数据
```

## 5. 工单确认时序图

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtOrderScoreController
    participant Service as GxtOrderScoreServiceImpl
    participant RepairService as GxtRepairOrderService
    participant FlowService as GxtRepairOrderFlowService
    
    User->>Controller: 发送确认请求 /confirm
    Controller->>Service: 调用confirm()
    Service->>RepairService: 查询维修工单详情
    RepairService-->>Service: 返回工单信息
    Service->>RepairService: 更新工单信息
    Service->>RepairService: 更新工单状态
    Service->>FlowService: 添加工单流转记录
    FlowService-->>Service: 返回操作结果
    Service-->>Controller: 返回操作结果
    Controller-->>User: 返回响应数据
```

## 6. 工单申诉时序图

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtOrderScoreController
    participant Service as GxtOrderScoreServiceImpl
    participant RepairService as GxtRepairOrderService
    participant FlowService as GxtRepairOrderFlowService
    participant RedisCache as RedisCache
    
    User->>Controller: 发送申诉请求 /appeal
    Controller->>Service: 调用appeal()
    Service->>RepairService: 查询维修工单详情
    RepairService-->>Service: 返回工单信息
    Service->>RepairService: 更新工单状态为申诉中
    Service->>FlowService: 添加工单流转记录
    FlowService-->>Service: 返回操作结果
    Service->>RedisCache: 更新Redis申诉数量
    RedisCache-->>Service: 返回操作结果
    Service-->>Controller: 返回操作结果
    Controller-->>User: 返回响应数据
```

## 7. 移动端工单列表查询时序图

```mermaid
sequenceDiagram
    participant MobileUser as 移动端用户
    participant Controller as GxtOrderScoreController
    participant Service as GxtOrderScoreServiceImpl
    participant Mapper as GxtOrderScoreMapper
    
    MobileUser->>Controller: 发送查询请求 /mobile/list
    Controller->>Service: 调用selectMobileUnionOrderList()
    Service->>Mapper: 查询移动端合并工单列表
    Mapper-->>Service: 返回工单列表数据
    Service->>Service: 填充人员评分列表
    Service-->>Controller: 返回处理后的工单列表
    Controller-->>MobileUser: 返回响应数据
```

## 8. 工单统计信息查询时序图

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtOrderScoreController
    participant Service as GxtOrderScoreServiceImpl
    participant Mapper as GxtOrderScoreMapper
    
    User->>Controller: 发送统计请求 /statistics
    Controller->>Service: 调用getOrderScoreStatistics()
    Service->>Mapper: 查询工单评分统计信息
    Mapper-->>Service: 返回统计信息
    Service-->>Controller: 返回统计信息
    Controller-->>User: 返回响应数据
```

## 9. 工单详情查询时序图

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtOrderScoreController
    participant RepairService as GxtRepairOrderService
    participant WorkService as GxtWorkOrderService
    
    User->>Controller: 发送详情请求 /{orderType}/{orderId}
    Controller->>Controller: 判断工单类型
    alt 维修工单
        Controller->>RepairService: 查询维修工单详情
        RepairService-->>Controller: 返回工单信息
    else 维保工单
        Controller->>WorkService: 查询维保工单详情
        WorkService-->>Controller: 返回工单信息
    end
    Controller-->>User: 返回响应数据
```
