|
@@ -61,6 +61,19 @@ public class StudentSelectSupervisorRecordController {
|
|
|
@Resource
|
|
|
private studentSelectionProjectService studentSelectionProjectService;
|
|
|
|
|
|
+ private Integer getOccupiedSlots(String studentGrade ,Long userId,Integer masterType){
|
|
|
+ Integer occupiedSlots = 0;
|
|
|
+ if (userId!=null){
|
|
|
+ AdminUserDO user =adminUserService.getUser(userId);
|
|
|
+ if (user.getUserType().equals("3")){
|
|
|
+ occupiedSlots = adminUserService.countStudentListBySupervisorId(studentGrade,userId, masterType);//
|
|
|
+ }else if (user.getUserType().equals("5")){
|
|
|
+ occupiedSlots = adminUserService.countStudentListByExternalSupervisorId(studentGrade,userId, masterType);//
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return occupiedSlots;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建师生互选记录")
|
|
@@ -74,8 +87,8 @@ public class StudentSelectSupervisorRecordController {
|
|
|
if ((roleIds.contains(112L) || roleIds.contains(113L)) && project.getSupervisorConfirmDeadline().isBefore(dateTime)) {
|
|
|
return error(1, "该项目已过截至日期");
|
|
|
}else {
|
|
|
- Integer occupiedAcademicSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),createReqVO.getSupervisorId(), 1);//占用学硕
|
|
|
- Integer occupiedProfessionalSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),createReqVO.getSupervisorId(), 2);//占用专硕
|
|
|
+ Integer occupiedAcademicSlots = getOccupiedSlots(project.getStudentGrade(),createReqVO.getSupervisorId(), 1);//占用学硕
|
|
|
+ Integer occupiedProfessionalSlots = getOccupiedSlots(project.getStudentGrade(),createReqVO.getSupervisorId(), 2);//占用专硕
|
|
|
supervisorSelectionSettingDO supervisorSelectionSetting = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(createReqVO.getSupervisorId(), createReqVO.getProjectId());
|
|
|
|
|
|
if (supervisorSelectionSetting == null || (supervisorSelectionSetting.getAcademicSlots() == null && supervisorSelectionSetting.getProfessionalSlots() == null)) {
|
|
@@ -134,8 +147,8 @@ public class StudentSelectSupervisorRecordController {
|
|
|
}
|
|
|
Integer selectStatus =adminUserService.getUserSelectStatus(createReqVO.getStudentId(),project.getId());
|
|
|
if (selectStatus==0) {//未提交的
|
|
|
- Integer occupiedAcademicSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(), createReqVO.getSupervisorId(), 1);//占用学硕
|
|
|
- Integer occupiedProfessionalSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(), createReqVO.getSupervisorId(), 2);//占用专硕
|
|
|
+ Integer occupiedAcademicSlots = getOccupiedSlots(project.getStudentGrade(), createReqVO.getSupervisorId(), 1);//占用学硕
|
|
|
+ Integer occupiedProfessionalSlots = getOccupiedSlots(project.getStudentGrade(), createReqVO.getSupervisorId(), 2);//占用专硕
|
|
|
supervisorSelectionSettingDO supervisorSelectionSetting = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(createReqVO.getSupervisorId(), project.getId());
|
|
|
|
|
|
if (supervisorSelectionSetting == null || (supervisorSelectionSetting.getAcademicSlots() == null && supervisorSelectionSetting.getProfessionalSlots() == null)) {
|
|
@@ -207,8 +220,8 @@ public class StudentSelectSupervisorRecordController {
|
|
|
studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProject(record.getProjectId()), studentSelectionProjectSaveReqVO.class);
|
|
|
|
|
|
AdminUserDO user =adminUserService.getUser(record.getStudentId());
|
|
|
- Integer occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),updateReqVO.getSupervisorId(),1);//占用学硕
|
|
|
- Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),updateReqVO.getSupervisorId(),2);//占用专硕
|
|
|
+ Integer occupiedAcademicSlots =getOccupiedSlots(project.getStudentGrade(),updateReqVO.getSupervisorId(),1);//占用学硕
|
|
|
+ Integer occupiedProfessionalSlots =getOccupiedSlots(project.getStudentGrade(),updateReqVO.getSupervisorId(),2);//占用专硕
|
|
|
supervisorSelectionSettingDO supervisorSelectionSetting = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(updateReqVO.getSupervisorId(), record.getProjectId());
|
|
|
// 检查导师是否有名额设置
|
|
|
if (supervisorSelectionSetting == null || (supervisorSelectionSetting.getAcademicSlots() == null && supervisorSelectionSetting.getProfessionalSlots() == null)) {
|
|
@@ -330,8 +343,8 @@ public class StudentSelectSupervisorRecordController {
|
|
|
Long loginId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
Set<Long> roleIds = permissionService.getUserRoleIdListByUserId(loginId);
|
|
|
|
|
|
- Integer occupiedAcademicSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(), loginId, 1);//占用学硕名额
|
|
|
- Integer occupiedProfessionalSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(), loginId, 2);//占用专硕名额
|
|
|
+ Integer occupiedAcademicSlots = getOccupiedSlots(project.getStudentGrade(), loginId, 1);//占用学硕名额
|
|
|
+ Integer occupiedProfessionalSlots = getOccupiedSlots(project.getStudentGrade(), loginId, 2);//占用专硕名额
|
|
|
|
|
|
supervisorSelectionSettingDO supervisorSelectionSetting = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(loginId, project.getId());
|
|
|
// 检查导师是否有名额设置
|