Bladeren bron

fix(backend): 恢复 /scores/subordinates 路由 + 集成测试守卫

wangkangyjy 1 week geleden
bovenliggende
commit
94b9e046e4

+ 1 - 0
backend/src/main/java/com/yimeng/okr/controller/PerformanceController.java

@@ -85,6 +85,7 @@ public class PerformanceController {
                 performanceService.publishFinalScore(periodId, targetUserId, SecurityUtils.getCurrentUserId()));
     }
 
+    @GetMapping("/subordinates")
     @OperationLogAnnotation(action = "VIEW_SUBORDINATE_SCORES", entityType = "performance_score", sensitive = true)
     public ApiResult<List<ScoringDto>> getSubordinates(@RequestParam Long periodId) {
         return ApiResult.success(

+ 6 - 0
backend/src/test/java/com/yimeng/okr/integration/PerformanceLifecycleApiIntegrationTest.java

@@ -37,6 +37,7 @@ import java.util.Map;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
@@ -138,6 +139,11 @@ class PerformanceLifecycleApiIntegrationTest {
         assertEquals("REJECTED", appealMapper.selectById(appealId).getStatus());
         assertNotNull(objectiveMapper.selectById(employeeOkrId).getSnapshotJson());
         assertNotNull(kpiConfigMapper.selectById(employeeKpiId).getSnapshotJson());
+
+        // Verify /api/scores/subordinates route exists (P0 regression guard)
+        JsonNode subordinates = getForData(managerToken, "/api/scores/subordinates?periodId=" + periodId);
+        assertNotNull(subordinates, "/scores/subordinates should return data");
+        assertTrue(subordinates.isArray(), "/scores/subordinates should return array");
     }
 
     private JsonNode postForData(String token, String path, Object body) throws Exception {