|
@@ -72,9 +72,9 @@ public class studentSelectSupervisorRecordController {
|
|
|
@Resource
|
|
|
private studentSelectionProjectService studentSelectionProjectService;
|
|
|
|
|
|
- @Scheduled(cron = "0 00 00 * * ?") // 每天0:00检测,更新未打卡
|
|
|
+ @Scheduled(cron = "0 00 00 * * ?") // 每天0:00检测
|
|
|
@Idempotent(timeout = 10)
|
|
|
- public void attendanceNormalFirst() {
|
|
|
+ public void checkIsSelection() {
|
|
|
LocalDateTime nowTime =LocalDateTime.now();
|
|
|
studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProjectByYear(nowTime.getYear()),studentSelectionProjectSaveReqVO.class);
|
|
|
LocalDateTime endTime = project.getSupervisorConfirmDeadline();
|
|
@@ -92,14 +92,13 @@ public class studentSelectSupervisorRecordController {
|
|
|
|
|
|
//没有选择成功导师的学生
|
|
|
List<AdminUserDO> studentList =adminUserService.getStudentAndSupervisorNull(project.getStudentGrade());
|
|
|
- //更新所有待处理的记录
|
|
|
+ //更新所有待处理的记录=>撤回
|
|
|
studentSelectSupervisorRecordService.updatePendingSelectType(project.getId());
|
|
|
//创建其他的记录
|
|
|
studentSelectSupervisorRecordSaveReqVO createReqVO =new studentSelectSupervisorRecordSaveReqVO();
|
|
|
for (AdminUserDO student :studentList){
|
|
|
createReqVO.setProjectId(project.getId());
|
|
|
createReqVO.setStudentId(student.getId());
|
|
|
-
|
|
|
createReqVO.setSelectType(4);//编辑状态
|
|
|
studentSelectSupervisorRecordService.createStudentSelectSupervisorRecord(createReqVO);
|
|
|
}
|
|
@@ -137,7 +136,6 @@ public class studentSelectSupervisorRecordController {
|
|
|
|
|
|
studentSelectSupervisorRecordDO record1 = studentSelectSupervisorRecordService.getRecordByStudentIdAndSupervisorId(loginId, null, 2);//同意
|
|
|
studentSelectSupervisorRecordDO record2 = studentSelectSupervisorRecordService.getRecordByStudentIdAndSupervisorId(loginId, null, 1);//待处理
|
|
|
- studentSelectSupervisorRecordDO record3 = studentSelectSupervisorRecordService.getRecordByStudentIdAndSupervisorId(loginId, null, 0);//撤回
|
|
|
|
|
|
if (record1 != null) {
|
|
|
return error(1, "请求已通过了");
|
|
@@ -253,27 +251,48 @@ public class studentSelectSupervisorRecordController {
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:agree')")
|
|
|
public CommonResult<Boolean> agreeStudentSelectSupervisorRecord(@Valid @RequestBody studentSelectSupervisorRecordSaveReqVO updateReqVO) {
|
|
|
LocalDateTime dateTime = LocalDateTime.now();
|
|
|
+
|
|
|
studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProjectByYear(dateTime.getYear()), studentSelectionProjectSaveReqVO.class);
|
|
|
- Long loginId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- Set<Long> roleIds = permissionService.getUserRoleIdListByUserId(loginId);
|
|
|
- if ((roleIds.contains(112L) || roleIds.contains(113L)) && project.getSupervisorConfirmDeadline().isBefore(dateTime)) {
|
|
|
- return error(1, "该项目已过截至日期");
|
|
|
- }else {
|
|
|
- //提交导师签名
|
|
|
- updateReqVO.setSelectType(2);
|
|
|
- updateReqVO.setSupervisorApproveTime(dateTime);
|
|
|
- updateReqVO.setSupervisorSignDate(dateTime.toLocalDate());//导师日期
|
|
|
- studentSelectSupervisorRecordService.updateStudentSelectSupervisorRecord(updateReqVO);
|
|
|
- //更新学生的supervisorId
|
|
|
- if (updateReqVO.getId() != null) {
|
|
|
- studentSelectSupervisorRecordDO record = studentSelectSupervisorRecordService.getStudentSelectSupervisorRecord(updateReqVO.getId());
|
|
|
+ if (updateReqVO.getId() != null) {
|
|
|
+ studentSelectSupervisorRecordDO record = studentSelectSupervisorRecordService.getStudentSelectSupervisorRecord(updateReqVO.getId());
|
|
|
+ AdminUserDO student = adminUserService.getUser(record.getStudentId());
|
|
|
+
|
|
|
+ Long loginId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ Set<Long> roleIds = permissionService.getUserRoleIdListByUserId(loginId);
|
|
|
+
|
|
|
+ Integer occupiedAcademicSlots = adminUserService.countStudentListBySupervisorId(Math.toIntExact(loginId), 1);//占用学硕名额
|
|
|
+ Integer occupiedProfessionalSlots = adminUserService.countStudentListBySupervisorId(Math.toIntExact(loginId), 2);//占用专硕名额
|
|
|
+
|
|
|
+ supervisorSelectionSettingDO supervisorSelectionSetting = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(loginId, project.getId());
|
|
|
+ // 检查导师是否有名额设置
|
|
|
+
|
|
|
+ if ((roleIds.contains(112L) || roleIds.contains(113L)) && project.getSupervisorConfirmDeadline().isBefore(dateTime)) {
|
|
|
+ return error(1, "该项目已过截至日期");
|
|
|
+ } else {
|
|
|
+ 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, "您的专硕名额已经满了");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //提交导师签名
|
|
|
+ updateReqVO.setSelectType(2);
|
|
|
+ updateReqVO.setSupervisorApproveTime(dateTime);
|
|
|
+ updateReqVO.setSupervisorSignDate(dateTime.toLocalDate());//导师日期
|
|
|
+ studentSelectSupervisorRecordService.updateStudentSelectSupervisorRecord(updateReqVO);
|
|
|
+
|
|
|
+ //更新学生的supervisorId
|
|
|
UserSaveReqVO saveReqVO = new UserSaveReqVO();
|
|
|
saveReqVO.setId(record.getStudentId());
|
|
|
saveReqVO.setSupervisorId(record.getSupervisorId());
|
|
|
adminUserService.updateUser(saveReqVO);
|
|
|
}
|
|
|
+ return success(true);
|
|
|
}
|
|
|
- return success(true);
|
|
|
+ return error(1,"更新失败");
|
|
|
}
|
|
|
|
|
|
// 退回,
|
|
@@ -364,7 +383,6 @@ public class studentSelectSupervisorRecordController {
|
|
|
return success(result);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//信息弹窗填写
|
|
|
@PutMapping("/updateSelectionBook")
|
|
|
@Operation(summary = "更新互选表数据")
|
|
@@ -388,7 +406,6 @@ public class studentSelectSupervisorRecordController {
|
|
|
if (updateVo.getStudentMobile()!=null&&!updateVo.getStudentMobile().isEmpty()){
|
|
|
userSaveReqVO.setMobile(updateVo.getStudentMobile());
|
|
|
}
|
|
|
- //学生提交签名//在创建的时候提交了
|
|
|
|
|
|
}else if (roleIds.contains(113L)){//导师
|
|
|
//导师提交签名,通过的时候提交
|
|
@@ -407,15 +424,12 @@ public class studentSelectSupervisorRecordController {
|
|
|
userSaveReqVO.setTitle(updateVo.getTitle());
|
|
|
}
|
|
|
//学生成果要求,和名额填写
|
|
|
- // TODO 项目id
|
|
|
+
|
|
|
supervisorSelectionSettingDO setting = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(loginId,project.getId());
|
|
|
if (updateVo.getStudentAchievementRequirement()!=null&&!updateVo.getStudentAchievementRequirement().isEmpty()){
|
|
|
setting.setStudentAchievementRequirement(updateVo.getStudentAchievementRequirement());
|
|
|
}
|
|
|
-// if (updateVo.getProfessionalSlots()!=null||updateVo.getAcademicSlots()!=null){
|
|
|
-// setting.setAcademicSlots(updateVo.getProfessionalSlots());
|
|
|
-// setting.setProfessionalSlots(updateVo.getProfessionalSlots());
|
|
|
-// }
|
|
|
+
|
|
|
supervisorSelectionSettingService.updateSupervisorSelectionSetting(BeanUtils.toBean(setting, supervisorSelectionSettingSaveReqVO.class));
|
|
|
}
|
|
|
userSaveReqVO.setIsSelectionInformation(1);//已经填写了信息
|