ソースを参照

1.9所有校内导师

Crazy 16 時間 前
コミット
a1aafdf3f5

+ 10 - 4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/studentSelectionProject/studentSelectionProjectController.java

@@ -288,12 +288,18 @@ public class studentSelectionProjectController {
 
     @GetMapping("/getProjectSupervisors")
     @Operation(summary = "获取当前项目的导师")
-    public CommonResult<List<AdminUserDO>> getProjectSupervisors(@RequestParam("projectId") Long projectId) {
+    public CommonResult<List<AdminUserDO>> getProjectSupervisors() {
         // 获取项目数据并转换成相应的 VO
-        studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProject(projectId), studentSelectionProjectSaveReqVO.class);
-        if (project==null){
-            return error(1,"不存在该项目");
+        LocalDate date =LocalDate.now();
+        Integer lastYear =date.getYear()-1 ;
+        studentSelectionProjectSaveReqVO project =new studentSelectionProjectSaveReqVO();
+        studentSelectionProjectSaveReqVO project1 = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProjectByYear(lastYear),studentSelectionProjectSaveReqVO.class);
+        studentSelectionProjectSaveReqVO project2 = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProjectByYear(date.getYear()),studentSelectionProjectSaveReqVO.class);
+        project =project1==null?project2:project1;
+        if (project==null) {
+            return error(1,"还没有创建互选项目");
         }
+
         List<Long> supervisorIds = project.getSupervisorIds();
         Set<Long> newSupervisorIds = new HashSet<>(supervisorIds);
         List<AdminUserDO> supervisors = adminUserService.getUserList(newSupervisorIds);