|
@@ -148,7 +148,14 @@ public class studentSelectionProjectController {
|
|
|
|
|
|
// 根据 request 中的名额信息设置名额
|
|
|
Map<String, String> supervisorQuota = findSupervisorQuotaById(updateReqVO.getSupervisorsWithQuota(), supervisorId);
|
|
|
+
|
|
|
if (supervisorQuota != null) {
|
|
|
+ Integer occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorId,1);//占用学硕
|
|
|
+ Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorId,2);//占用专硕
|
|
|
+
|
|
|
+ if (Long.parseLong(supervisorQuota.get("academicSlots"))<occupiedAcademicSlots ||Long.parseLong(supervisorQuota.get("professionalSlots"))<occupiedProfessionalSlots){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
settingSaveReqVO.setAcademicSlots(Integer.valueOf(supervisorQuota.get("academicSlots")));
|
|
|
settingSaveReqVO.setProfessionalSlots(Integer.valueOf(supervisorQuota.get("professionalSlots")));
|
|
|
|
|
@@ -173,24 +180,23 @@ public class studentSelectionProjectController {
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
// 更新已有的导师(名额发生变化的导师)
|
|
|
- for (supervisorSelectionSettingDO supervisor : originSupervisors) {
|
|
|
-
|
|
|
- Integer occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisor.getSupervisorId(),1);//占用学硕
|
|
|
- Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisor.getSupervisorId(),2);//占用专硕
|
|
|
+ List<String> errorSupervisor =new ArrayList<>();
|
|
|
+ for (supervisorSelectionSettingDO supervisorSetting : originSupervisors) {
|
|
|
|
|
|
supervisorSelectionSettingSaveReqVO settingSaveReqVO = new supervisorSelectionSettingSaveReqVO();
|
|
|
- settingSaveReqVO.setId(supervisor.getId());
|
|
|
- settingSaveReqVO.setSupervisorId(supervisor.getSupervisorId());
|
|
|
+ settingSaveReqVO.setId(supervisorSetting.getId());
|
|
|
+ settingSaveReqVO.setSupervisorId(supervisorSetting.getSupervisorId());
|
|
|
settingSaveReqVO.setProjectId(updateReqVO.getId());
|
|
|
|
|
|
// 根据 request 中的名额信息设置名额
|
|
|
- Map<String, String> supervisorQuota = findSupervisorQuotaById(updateReqVO.getSupervisorsWithQuota(), supervisor.getSupervisorId());
|
|
|
-
|
|
|
+ Map<String, String> supervisorQuota = findSupervisorQuotaById(updateReqVO.getSupervisorsWithQuota(), supervisorSetting.getSupervisorId());
|
|
|
+ AdminUserDO supervisor =adminUserService.getUser(supervisorSetting.getSupervisorId());
|
|
|
if (supervisorQuota != null) {
|
|
|
- if (Integer.parseInt(supervisorQuota.get("academicSlots"))<occupiedAcademicSlots){
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (Integer.parseInt(supervisorQuota.get("professionalSlots"))<occupiedProfessionalSlots){
|
|
|
+ Integer occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorSetting.getSupervisorId(),1);//占用学硕
|
|
|
+ Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorSetting.getSupervisorId(),2);//占用专硕
|
|
|
+
|
|
|
+ if (Long.parseLong(supervisorQuota.get("academicSlots"))<occupiedAcademicSlots ||Long.parseLong(supervisorQuota.get("professionalSlots"))<occupiedProfessionalSlots){
|
|
|
+ errorSupervisor.add(supervisor.getNickname());
|
|
|
continue;
|
|
|
}
|
|
|
settingSaveReqVO.setAcademicSlots(Integer.valueOf(supervisorQuota.get("academicSlots")));
|
|
@@ -201,7 +207,9 @@ public class studentSelectionProjectController {
|
|
|
|
|
|
// 更新项目
|
|
|
studentSelectionProjectService.updateStudentSelectionProject(updateReqVO);
|
|
|
-
|
|
|
+ if (!errorSupervisor.isEmpty()){
|
|
|
+ return error(1,errorSupervisor+"名额设置错误");
|
|
|
+ }
|
|
|
return success(true);
|
|
|
}
|
|
|
|