|
@@ -149,17 +149,68 @@ public class StudentSelectSupervisorRecordController {
|
|
return success("请求提交成功");
|
|
return success("请求提交成功");
|
|
}
|
|
}
|
|
|
|
|
|
- // 学院志愿编辑,
|
|
|
|
|
|
+ //
|
|
|
|
+ @PostMapping("/collegeCreate")
|
|
|
|
+ @Operation(summary = "学院创建师生互选记录")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:collegeCreate')")
|
|
|
|
+ public CommonResult<String> collegeCreateRecord(@Valid @RequestBody StudentSelectSupervisorRecordSaveReqVO createReqVO) {
|
|
|
|
+
|
|
|
|
+ AdminUserDO student =adminUserService.getUser(createReqVO.getStudentId());
|
|
|
|
+
|
|
|
|
+ LocalDateTime dateTime =LocalDateTime.now();
|
|
|
|
+ Integer nextYear =dateTime.getYear()+1 ;
|
|
|
|
+ studentSelectionProjectSaveReqVO project =new studentSelectionProjectSaveReqVO();
|
|
|
|
+ studentSelectionProjectSaveReqVO project1 = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProjectByYear(nextYear),studentSelectionProjectSaveReqVO.class);
|
|
|
|
+ studentSelectionProjectSaveReqVO project2 = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProjectByYear(dateTime.getYear()),studentSelectionProjectSaveReqVO.class);
|
|
|
|
+ project =project1==null?project2:project1;
|
|
|
|
+ if (project==null) {
|
|
|
|
+ return error(1,"今年还没有创建互选项目");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Integer occupiedAcademicSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),createReqVO.getSupervisorId(), 1);//占用学硕
|
|
|
|
+ Integer occupiedProfessionalSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),createReqVO.getSupervisorId(), 2);//占用专硕
|
|
|
|
+ supervisorSelectionSettingDO supervisorSelectionSetting = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(createReqVO.getSupervisorId(), createReqVO.getProjectId());
|
|
|
|
+
|
|
|
|
+ if (supervisorSelectionSetting == null || (supervisorSelectionSetting.getAcademicSlots() == null && supervisorSelectionSetting.getProfessionalSlots() == null)) {
|
|
|
|
+ return error(1, "该导师无名额");
|
|
|
|
+ }
|
|
|
|
+ if (student.getMasterType() == 1) {
|
|
|
|
+ if (supervisorSelectionSetting.getAcademicSlots() != null && supervisorSelectionSetting.getAcademicSlots().equals(occupiedAcademicSlots)) {
|
|
|
|
+ return error(1, "学硕名额已经满了");
|
|
|
|
+ }
|
|
|
|
+ } else if (student.getMasterType() == 2) {
|
|
|
|
+ if (supervisorSelectionSetting.getProfessionalSlots() != null && supervisorSelectionSetting.getProfessionalSlots().equals(occupiedProfessionalSlots)) {
|
|
|
|
+ return error(1, "专硕名额已经满了");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ studentSelectSupervisorRecordDO record1 = studentSelectSupervisorRecordService.getRecordByStudentIdAndSupervisorId(project.getId(),student.getId(), null, 2);//同意
|
|
|
|
+ studentSelectSupervisorRecordDO record2 = studentSelectSupervisorRecordService.getRecordByStudentIdAndSupervisorId(project.getId(),student.getId(), null, 1);//待处理
|
|
|
|
+ if (record1 != null) {
|
|
|
|
+ return error(1, "请求已通过了");
|
|
|
|
+ } else if (record2 != null) {
|
|
|
|
+ return error(1, "还有请求在待处理中");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ createReqVO.setSelectType(2);//同意
|
|
|
|
+
|
|
|
|
+ studentSelectSupervisorRecordService.createStudentSelectSupervisorRecord(createReqVO);
|
|
|
|
+ return success("请求提交成功");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 学院志愿编辑,
|
|
@PutMapping("/update")
|
|
@PutMapping("/update")
|
|
@Operation(summary = "更新师生互选记录")
|
|
@Operation(summary = "更新师生互选记录")
|
|
@PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:update')")
|
|
@PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:update')")
|
|
public CommonResult<String> updateStudentSelectSupervisorRecord(@Valid @RequestBody StudentSelectSupervisorRecordSaveReqVO updateReqVO) {
|
|
public CommonResult<String> updateStudentSelectSupervisorRecord(@Valid @RequestBody StudentSelectSupervisorRecordSaveReqVO updateReqVO) {
|
|
-
|
|
|
|
|
|
+ if (updateReqVO.getId()==null){
|
|
|
|
+ return error(1,"没有传互选记录id");
|
|
|
|
+ }
|
|
studentSelectSupervisorRecordDO record =studentSelectSupervisorRecordService.getStudentSelectSupervisorRecord(updateReqVO.getId());
|
|
studentSelectSupervisorRecordDO record =studentSelectSupervisorRecordService.getStudentSelectSupervisorRecord(updateReqVO.getId());
|
|
//
|
|
//
|
|
studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProject(record.getProjectId()), studentSelectionProjectSaveReqVO.class);
|
|
studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProject(record.getProjectId()), studentSelectionProjectSaveReqVO.class);
|
|
- AdminUserDO student =adminUserService.getUser(updateReqVO.getStudentId());
|
|
|
|
- Integer selectStatus =adminUserService.getUserSelectStatus(updateReqVO.getStudentId(),project.getId());
|
|
|
|
|
|
+
|
|
AdminUserDO user =adminUserService.getUser(record.getStudentId());
|
|
AdminUserDO user =adminUserService.getUser(record.getStudentId());
|
|
Integer occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),updateReqVO.getSupervisorId(),1);//占用学硕
|
|
Integer occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),updateReqVO.getSupervisorId(),1);//占用学硕
|
|
Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),updateReqVO.getSupervisorId(),2);//占用专硕
|
|
Integer occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),updateReqVO.getSupervisorId(),2);//占用专硕
|
|
@@ -178,14 +229,6 @@ public class StudentSelectSupervisorRecordController {
|
|
return error(1, "该老师专硕名额已经满了");
|
|
return error(1, "该老师专硕名额已经满了");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (selectStatus==0){//未提交要新建直接同意
|
|
|
|
- StudentSelectSupervisorRecordSaveReqVO createReqVO =new StudentSelectSupervisorRecordSaveReqVO();
|
|
|
|
- createReqVO.setStudentId(student.getId());
|
|
|
|
- createReqVO.setSupervisorId(updateReqVO.getSupervisorId());
|
|
|
|
- createReqVO.setProjectId(project.getId());
|
|
|
|
- createReqVO.setSelectType(2);
|
|
|
|
- studentSelectSupervisorRecordService.createStudentSelectSupervisorRecord(createReqVO);
|
|
|
|
- }else {
|
|
|
|
//更新志愿
|
|
//更新志愿
|
|
UserSaveReqVO saveReqVO = new UserSaveReqVO();
|
|
UserSaveReqVO saveReqVO = new UserSaveReqVO();
|
|
saveReqVO.setId(record.getStudentId());
|
|
saveReqVO.setId(record.getStudentId());
|
|
@@ -218,7 +261,6 @@ public class StudentSelectSupervisorRecordController {
|
|
}
|
|
}
|
|
adminUserService.updateUser(saveReqVO);
|
|
adminUserService.updateUser(saveReqVO);
|
|
studentSelectSupervisorRecordService.updateRecordNull(BeanUtils.toBean(record, StudentSelectSupervisorRecordSaveReqVO.class));
|
|
studentSelectSupervisorRecordService.updateRecordNull(BeanUtils.toBean(record, StudentSelectSupervisorRecordSaveReqVO.class));
|
|
- }
|
|
|
|
return success("志愿修改成功");
|
|
return success("志愿修改成功");
|
|
}
|
|
}
|
|
|
|
|