|
@@ -137,6 +137,8 @@ public class studentSelectionProjectController {
|
|
|
|
|
|
List<Long> newSupervisorIds = new ArrayList<>(updateReqVO.getSupervisorIds()); // 新的导师ID列表
|
|
List<Long> newSupervisorIds = new ArrayList<>(updateReqVO.getSupervisorIds()); // 新的导师ID列表
|
|
|
|
|
|
|
|
+ List<String> updateErrorSupervisor =new ArrayList<>();//更新失败的导师
|
|
|
|
+
|
|
// 处理新增的导师(在新列表中存在但在原列表中不存在)
|
|
// 处理新增的导师(在新列表中存在但在原列表中不存在)
|
|
newSupervisorIds.removeAll(originSupervisorIds); // 移除已存在的导师
|
|
newSupervisorIds.removeAll(originSupervisorIds); // 移除已存在的导师
|
|
if (!newSupervisorIds.isEmpty()) {
|
|
if (!newSupervisorIds.isEmpty()) {
|
|
@@ -148,12 +150,13 @@ public class studentSelectionProjectController {
|
|
|
|
|
|
// 根据 request 中的名额信息设置名额
|
|
// 根据 request 中的名额信息设置名额
|
|
Map<String, String> supervisorQuota = findSupervisorQuotaById(updateReqVO.getSupervisorsWithQuota(), supervisorId);
|
|
Map<String, String> supervisorQuota = findSupervisorQuotaById(updateReqVO.getSupervisorsWithQuota(), supervisorId);
|
|
-
|
|
|
|
|
|
+ AdminUserDO supervisor =adminUserService.getUser(supervisorId);
|
|
if (supervisorQuota != null) {
|
|
if (supervisorQuota != null) {
|
|
Integer occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorId,1);//占用学硕
|
|
Integer occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorId,1);//占用学硕
|
|
Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorId,2);//占用专硕
|
|
Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorId,2);//占用专硕
|
|
|
|
|
|
if (Long.parseLong(supervisorQuota.get("academicSlots"))<occupiedAcademicSlots ||Long.parseLong(supervisorQuota.get("professionalSlots"))<occupiedProfessionalSlots){
|
|
if (Long.parseLong(supervisorQuota.get("academicSlots"))<occupiedAcademicSlots ||Long.parseLong(supervisorQuota.get("professionalSlots"))<occupiedProfessionalSlots){
|
|
|
|
+ updateErrorSupervisor.add(supervisor.getNickname());
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
settingSaveReqVO.setAcademicSlots(Integer.valueOf(supervisorQuota.get("academicSlots")));
|
|
settingSaveReqVO.setAcademicSlots(Integer.valueOf(supervisorQuota.get("academicSlots")));
|
|
@@ -169,7 +172,15 @@ public class studentSelectionProjectController {
|
|
removedSupervisorIds.removeAll(updateReqVO.getSupervisorIds()); // 找出被移除的导师ID
|
|
removedSupervisorIds.removeAll(updateReqVO.getSupervisorIds()); // 找出被移除的导师ID
|
|
if (!removedSupervisorIds.isEmpty()) {
|
|
if (!removedSupervisorIds.isEmpty()) {
|
|
for (Long supervisorId : removedSupervisorIds) {
|
|
for (Long supervisorId : removedSupervisorIds) {
|
|
|
|
+ AdminUserDO supervisor =adminUserService.getUser(supervisorId);
|
|
supervisorSelectionSettingDO settingDO = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(supervisorId, updateReqVO.getId());
|
|
supervisorSelectionSettingDO settingDO = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(supervisorId, updateReqVO.getId());
|
|
|
|
+ Integer occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorId,1);//占用学硕
|
|
|
|
+ Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorId,2);//占用专硕
|
|
|
|
+ if (occupiedAcademicSlots!=0||occupiedProfessionalSlots!=0){//删除失败
|
|
|
|
+ updateReqVO.getSupervisorIds().add(supervisorId);
|
|
|
|
+ updateErrorSupervisor.add(supervisor.getNickname());
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
if (settingDO != null) {
|
|
if (settingDO != null) {
|
|
supervisorSelectionSettingService.deleteSupervisorSelectionSetting(settingDO.getId());
|
|
supervisorSelectionSettingService.deleteSupervisorSelectionSetting(settingDO.getId());
|
|
}
|
|
}
|
|
@@ -180,7 +191,6 @@ public class studentSelectionProjectController {
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
// 更新已有的导师(名额发生变化的导师)
|
|
// 更新已有的导师(名额发生变化的导师)
|
|
- List<String> errorSupervisor =new ArrayList<>();
|
|
|
|
for (supervisorSelectionSettingDO supervisorSetting : originSupervisors) {
|
|
for (supervisorSelectionSettingDO supervisorSetting : originSupervisors) {
|
|
|
|
|
|
supervisorSelectionSettingSaveReqVO settingSaveReqVO = new supervisorSelectionSettingSaveReqVO();
|
|
supervisorSelectionSettingSaveReqVO settingSaveReqVO = new supervisorSelectionSettingSaveReqVO();
|
|
@@ -196,7 +206,7 @@ public class studentSelectionProjectController {
|
|
Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorSetting.getSupervisorId(),2);//占用专硕
|
|
Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorSetting.getSupervisorId(),2);//占用专硕
|
|
|
|
|
|
if (Long.parseLong(supervisorQuota.get("academicSlots"))<occupiedAcademicSlots ||Long.parseLong(supervisorQuota.get("professionalSlots"))<occupiedProfessionalSlots){
|
|
if (Long.parseLong(supervisorQuota.get("academicSlots"))<occupiedAcademicSlots ||Long.parseLong(supervisorQuota.get("professionalSlots"))<occupiedProfessionalSlots){
|
|
- errorSupervisor.add(supervisor.getNickname());
|
|
|
|
|
|
+ updateErrorSupervisor.add(supervisor.getNickname());
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
settingSaveReqVO.setAcademicSlots(Integer.valueOf(supervisorQuota.get("academicSlots")));
|
|
settingSaveReqVO.setAcademicSlots(Integer.valueOf(supervisorQuota.get("academicSlots")));
|
|
@@ -207,8 +217,9 @@ public class studentSelectionProjectController {
|
|
|
|
|
|
// 更新项目
|
|
// 更新项目
|
|
studentSelectionProjectService.updateStudentSelectionProject(updateReqVO);
|
|
studentSelectionProjectService.updateStudentSelectionProject(updateReqVO);
|
|
- if (!errorSupervisor.isEmpty()){
|
|
|
|
- return error(1,errorSupervisor+"名额设置错误");
|
|
|
|
|
|
+ if (!updateErrorSupervisor.isEmpty()){
|
|
|
|
+ return error(1, updateErrorSupervisor + "导师设置错误" );
|
|
|
|
+
|
|
}
|
|
}
|
|
return success(true);
|
|
return success(true);
|
|
}
|
|
}
|