# GxtUserScoreController 时序图

## 1. 获取人员评分页面数据时序图

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtUserScoreController
    participant UserService as IGxtUserScoreService
    participant FanInspectionService as IGxtUserFanInspectionScoreService
    participant RepairProjectService as IGxtUserRepairProjectScoreService
    participant RuntimeScoreService as IGxtUserRuntimeScoreService
    participant CoefficientService as IGxtCoefficientScoreService
    participant ConfigService as ISysConfigService

    User->>Controller: GET /getUserScoreInfo?rtType=&monthPeriod=
    Controller->>ConfigService: selectConfigByKey("gxt.user.scorePage")
    ConfigService-->>Controller: 返回配置信息
    Controller->>UserService: selectGxtUserScoreListByCondition(rtType, monthPeriod, userId, deptId, permission)
    UserService-->>Controller: 返回GxtUserScore列表
    Controller->>FanInspectionService: selectFanInspectionScoreByCondition(rtType, monthPeriod, userId, deptId, permission)
    FanInspectionService-->>Controller: 返回GxtUserFanInspectionScore列表
    Controller->>RepairProjectService: selectUserRepairProjectScoreByCondition(rtType, monthPeriod, userId, deptId, permission)
    RepairProjectService-->>Controller: 返回GxtUserRepairProjectScore列表
    Controller->>RuntimeScoreService: selectGxtUserRuntimeScoreListByRtTypeAndMonth(rtType, monthPeriod, userId, deptId, permission)
    RuntimeScoreService-->>Controller: 返回GxtUserRuntimeScore列表
    Controller->>CoefficientService: selectGxtCoefficientScoreList(coefficientScore)
    CoefficientService-->>Controller: 返回GxtCoefficientScore列表
    Controller->>User: 返回整合后的数据(AjaxResult)
```

## 2. 提交所有评分数据时序图（第一部分）

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtUserScoreController
    participant CoefficientService as IGxtCoefficientScoreService
    participant UserService as IGxtUserScoreService
    participant FanInspectionService as IGxtUserFanInspectionScoreService

    User->>Controller: POST /submitAllScores
    Note over User,Controller: 请求体包含GxtUserScoreSubmissionDTO
    
    loop 处理系数与定检台数统计数据
        Controller->>CoefficientService: 根据monthPeriod查询是否存在记录
        CoefficientService-->>Controller: 返回查询结果
        alt 记录存在
            Controller->>CoefficientService: updateGxtCoefficientScore(score)
        else 记录不存在
            Controller->>CoefficientService: insertGxtCoefficientScore(score)
        end
    end
    
    loop 处理安全运行工单列表数据
        Controller->>UserService: 根据monthPeriod和userName查询是否存在记录
        UserService-->>Controller: 返回查询结果
        alt 记录存在
            Controller->>UserService: updateGxtUserScore(score)
        else 记录不存在
            Controller->>UserService: insertGxtUserScore(score)
        end
    end
    
    loop 处理维保机组类型评分数据
        Controller->>FanInspectionService: 根据monthPeriod和userName查询是否存在记录
        FanInspectionService-->>Controller: 返回查询结果
        alt 记录存在
            Controller->>FanInspectionService: updateGxtUserFanInspectionScore(score)
        else 记录不存在
            Controller->>FanInspectionService: insertGxtUserFanInspectionScore(score)
        end
    end
```

## 3. 提交所有评分数据时序图（第二部分）

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtUserScoreController
    participant UserService as IGxtUserScoreService
    participant RepairProjectService as IGxtUserRepairProjectScoreService

    loop 处理检修员得分列表数据
        Controller->>UserService: 根据monthPeriod和userName查询是否存在记录
        UserService-->>Controller: 返回查询结果
        alt 记录存在
            Controller->>UserService: updateGxtUserScore(score)
        else 记录不存在
            Controller->>UserService: insertGxtUserScore(score)
        end
    end
    
    loop 处理维修员最终得分列表数据
        Controller->>UserService: 根据monthPeriod和userName查询是否存在记录
        UserService-->>Controller: 返回查询结果
        alt 记录存在
            Controller->>UserService: updateGxtUserScore(score)
        else 记录不存在
            Controller->>UserService: insertGxtUserScore(score)
        end
    end
    
    loop 处理场站负责人评分列表数据
        Controller->>RepairProjectService: 根据monthPeriod和userName查询是否存在记录
        RepairProjectService-->>Controller: 返回查询结果
        alt 记录存在
            Controller->>RepairProjectService: updateGxtUserRepairProjectScore(score)
        else 记录不存在
            Controller->>RepairProjectService: insertGxtUserRepairProjectScore(score)
        end
    end
    
    Controller->>User: 返回提交成功信息(AjaxResult)
```

## 4. 获取月度工分汇总页面数据时序图

```mermaid
sequenceDiagram
    participant User as 用户
    participant Controller as GxtUserScoreController
    participant MonthScoreService as IGxtMonthScoreService
    participant ConfigService as ISysConfigService

    User->>Controller: GET /getScoreSummary?rtType=&monthPeriod=&deptId=
    Controller->>ConfigService: selectConfigByKey("gxt.user.scorePage")
    ConfigService-->>Controller: 返回配置信息
    Controller->>MonthScoreService: getGxtMonthScoreByParams(rtType, monthPeriod, permission, deptId)
    MonthScoreService-->>Controller: 返回GxtMonthScore对象
    Controller->>User: 返回月度工分汇总数据(AjaxResult)
```
