|
@@ -1,14 +1,22 @@
|
|
|
package cn.iocoder.yudao.module.system.controller.admin.studentSelectSupervisorRecord;
|
|
|
|
|
|
+import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.studentSelectionProject.vo.studentSelectionProjectSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.supervisorSelectionSetting.vo.supervisorSelectionSettingSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.studentSelectionProject.studentSelectionProjectDO;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.supervisorSelectionSetting.supervisorSelectionSettingDO;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
|
|
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
|
|
+import cn.iocoder.yudao.module.system.service.studentSelectionProject.studentSelectionProjectService;
|
|
|
import cn.iocoder.yudao.module.system.service.supervisorSelectionSetting.supervisorSelectionSettingService;
|
|
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
|
|
+import com.alibaba.druid.sql.visitor.functions.If;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import javax.annotation.Resource;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -20,8 +28,10 @@ import io.swagger.v3.oas.annotations.Operation;
|
|
|
import javax.validation.constraints.*;
|
|
|
import javax.validation.*;
|
|
|
import javax.servlet.http.*;
|
|
|
+import java.time.DayOfWeek;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
|
import java.io.IOException;
|
|
|
|
|
@@ -56,6 +66,43 @@ public class studentSelectSupervisorRecordController {
|
|
|
private supervisorSelectionSettingService supervisorSelectionSettingService;
|
|
|
@Resource
|
|
|
private PermissionService permissionService;
|
|
|
+ @Resource
|
|
|
+ private studentSelectionProjectService studentSelectionProjectService;
|
|
|
+
|
|
|
+// @Resource
|
|
|
+// private ThreadPoolTaskScheduler taskScheduler;
|
|
|
+// // 调度器
|
|
|
+// private void scheduleNextExecution(LocalDateTime endTime) {
|
|
|
+// taskScheduler.schedule(this::checkSelection, Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
+// }
|
|
|
+// //在项目结束的时候
|
|
|
+// @Idempotent(timeout = 10)
|
|
|
+// public void checkSelection() {
|
|
|
+// //获取今年的选择记录
|
|
|
+// LocalDate date =LocalDate.now();
|
|
|
+// studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProjectByYear(date.getYear()),studentSelectionProjectSaveReqVO.class);
|
|
|
+// LocalDateTime endTime = project.getSupervisorConfirmDeadline();
|
|
|
+//
|
|
|
+// scheduleNextExecution(endTime);
|
|
|
+// //导师未同意或者没有选择导师的学生
|
|
|
+// List<AdminUserDO> studentList =adminUserService.getStudentAndSupervisorNull(project.getStudentGrade());
|
|
|
+// //更新待处理的记录
|
|
|
+// for (AdminUserDO student :studentList){
|
|
|
+// //待处理的记录
|
|
|
+// studentSelectSupervisorRecordDO record =studentSelectSupervisorRecordService.getRecordByStudentIdAndSupervisorId(student.getId(),null,1);
|
|
|
+// record.setSelectType(0);//设置成编辑状态
|
|
|
+// studentSelectSupervisorRecordService.updateStudentSelectSupervisorRecord(BeanUtils.toBean(record,studentSelectSupervisorRecordSaveReqVO.class));
|
|
|
+// studentList.remove(student);
|
|
|
+// }
|
|
|
+// //创建其他的记录
|
|
|
+// studentSelectSupervisorRecordSaveReqVO createReqVO =new studentSelectSupervisorRecordSaveReqVO();
|
|
|
+// for (AdminUserDO student :studentList){
|
|
|
+// createReqVO.setStudentId(student.getId());
|
|
|
+// createReqVO.setSelectType(0);//编辑状态
|
|
|
+// studentSelectSupervisorRecordService.createStudentSelectSupervisorRecord(createReqVO);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
|
|
|
@PostMapping("/create")
|
|
@@ -65,11 +112,15 @@ public class studentSelectSupervisorRecordController {
|
|
|
Long loginId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
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,"请求已通过了");
|
|
|
}else if (record2!=null){
|
|
|
return error(1,"还有请求在待处理中");
|
|
|
+ }else if (record3!=null){
|
|
|
+ return error(1,"还有请求处于编辑状态");
|
|
|
}
|
|
|
createReqVO.setStudentId(loginId);
|
|
|
createReqVO.setSelectType(1);//待处理
|
|
@@ -79,15 +130,22 @@ public class studentSelectSupervisorRecordController {
|
|
|
return success("请求提交成功");
|
|
|
}
|
|
|
|
|
|
-// 撤回,同意,退回,
|
|
|
+// 学院志愿编辑,
|
|
|
@PutMapping("/update")
|
|
|
@Operation(summary = "更新师生互选记录")
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:update')")
|
|
|
- public CommonResult<Boolean> updateStudentSelectSupervisorRecord(@Valid @RequestBody studentSelectSupervisorRecordSaveReqVO updateReqVO) {
|
|
|
- studentSelectSupervisorRecordService.updateStudentSelectSupervisorRecord(updateReqVO);
|
|
|
- return success(true);
|
|
|
+ public CommonResult<String> updateStudentSelectSupervisorRecord(@Valid @RequestBody studentSelectSupervisorRecordSaveReqVO updateReqVO) {
|
|
|
+
|
|
|
+ studentSelectSupervisorRecordDO record =studentSelectSupervisorRecordService.getStudentSelectSupervisorRecord(updateReqVO.getId());
|
|
|
+ if(record.getSelectType()==0){
|
|
|
+ updateReqVO.setSelectType(2);//同意
|
|
|
+ studentSelectSupervisorRecordService.updateStudentSelectSupervisorRecord(updateReqVO);
|
|
|
+ return success("志愿修改成功");
|
|
|
+ }
|
|
|
+ return error(1,"该状态不可编辑");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@DeleteMapping("/delete")
|
|
|
@Operation(summary = "删除师生互选记录")
|
|
|
@Parameter(name = "id", description = "编号", required = true)
|
|
@@ -110,8 +168,14 @@ public class studentSelectSupervisorRecordController {
|
|
|
@Operation(summary = "获得师生互选记录分页")
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:query')")
|
|
|
public CommonResult<PageResult<studentSelectSupervisorRecordRespVO>> getStudentSelectSupervisorRecordPage(@Valid studentSelectSupervisorRecordPageReqVO pageReqVO) {
|
|
|
- PageResult<studentSelectSupervisorRecordDO> pageResult = studentSelectSupervisorRecordService.getStudentSelectSupervisorRecordPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, studentSelectSupervisorRecordRespVO.class));
|
|
|
+ LocalDateTime dateTime = LocalDateTime.now();
|
|
|
+ studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProjectByYear(dateTime.getYear()), studentSelectionProjectSaveReqVO.class);
|
|
|
+ if (project.getSupervisorConfirmDeadline().isBefore(dateTime)){
|
|
|
+ return error(1,"该项目已过截至日期");
|
|
|
+ }else {
|
|
|
+ PageResult<studentSelectSupervisorRecordDO> pageResult = studentSelectSupervisorRecordService.getStudentSelectSupervisorRecordPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, studentSelectSupervisorRecordRespVO.class));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@GetMapping("/export-excel")
|
|
@@ -161,7 +225,7 @@ public class studentSelectSupervisorRecordController {
|
|
|
return success(true);
|
|
|
}
|
|
|
|
|
|
- //传导师id
|
|
|
+ //在导师设置那传导师id
|
|
|
@PutMapping("/withdraw")
|
|
|
@Operation(summary = "撤回")
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:withdraw')")
|
|
@@ -203,19 +267,19 @@ public class studentSelectSupervisorRecordController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- //通过方法和志愿填报方法都是这个
|
|
|
+ //志愿填报方法都是这个
|
|
|
@PutMapping("/updateSelectionBook")
|
|
|
@Operation(summary = "更新互选表数据")
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:updateSelection')")
|
|
|
- public CommonResult<String> updateSelectionBook(selectionBookRespVO updateVo) {
|
|
|
+ public CommonResult<String> updateSelectionBook(@RequestBody selectionBookRespVO updateVo) {
|
|
|
Long loginId =SecurityFrameworkUtils.getLoginUserId();
|
|
|
Set<Long> roleIds =permissionService.getUserRoleIdListByUserId(loginId);
|
|
|
//填写简介
|
|
|
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
|
|
|
userSaveReqVO.setId(loginId);
|
|
|
|
|
|
- if (userSaveReqVO.getIntroduction()!=null&&!userSaveReqVO.getIntroduction().isEmpty()) {
|
|
|
- userSaveReqVO.setIntroduction(userSaveReqVO.getIntroduction());//用户简历
|
|
|
+ if (updateVo.getIntroduction()!=null&&!updateVo.getIntroduction().trim().isEmpty()) {
|
|
|
+ userSaveReqVO.setIntroduction(updateVo.getIntroduction());//用户简历
|
|
|
}
|
|
|
|
|
|
studentSelectSupervisorRecordSaveReqVO recordUpdateReqVO =new studentSelectSupervisorRecordSaveReqVO();
|
|
@@ -231,8 +295,12 @@ public class studentSelectSupervisorRecordController {
|
|
|
// }
|
|
|
//导师填写信息
|
|
|
//1.研究方向
|
|
|
- if (updateVo.getSupervisorMajor()!=null&&!updateVo.getSupervisorMajor().isEmpty()){
|
|
|
- userSaveReqVO.setMajor(updateVo.getSupervisorMajor());
|
|
|
+ if (updateVo.getMajor()!=null&&!updateVo.getMajor().isEmpty()){
|
|
|
+ userSaveReqVO.setMajor(updateVo.getMajor());
|
|
|
+ }
|
|
|
+ //职称
|
|
|
+ if (updateVo.getTitle()!=null&&!updateVo.getTitle().isEmpty()){
|
|
|
+ userSaveReqVO.setTitle(updateVo.getTitle());
|
|
|
}
|
|
|
//学生成果要求,和名额填写
|
|
|
supervisorSelectionSettingDO setting = supervisorSelectionSettingService.getSettingBySupervisorId(loginId);
|
|
@@ -254,7 +322,21 @@ public class studentSelectSupervisorRecordController {
|
|
|
@Operation(summary = "获取选择记录列表")
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:getRecordList')")
|
|
|
public CommonResult<List<studentSelectSupervisorRecordRespVO>> getRecordSelectSupervisorRecordList(@Valid studentSelectSupervisorRecordPageReqVO listReqVO) {
|
|
|
+// LocalDate date =LocalDate.now();
|
|
|
+// studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProjectByYear(date.getYear()),studentSelectionProjectSaveReqVO.class);
|
|
|
+// listReqVO.setProjectId(project.getId());
|
|
|
return success(BeanUtils.toBean(studentSelectSupervisorRecordService.getStudentSelectSupervisorRecordList(listReqVO),studentSelectSupervisorRecordRespVO.class));
|
|
|
}
|
|
|
|
|
|
+// @GetMapping("/getStudentRecordList")
|
|
|
+// @Operation(summary = "学院获取今年学生列表")
|
|
|
+// @PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:getStudentRecordList')")
|
|
|
+// public CommonResult<List<studentSelectSupervisorRecordRespVO>> getStudentSelectSupervisorRecord(@Valid studentSelectSupervisorRecordPageReqVO listReqVO) {
|
|
|
+// LocalDate date =LocalDate.now();
|
|
|
+// studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProjectByYear(date.getYear()),studentSelectionProjectSaveReqVO.class);
|
|
|
+// listReqVO.setProjectId(project.getId());
|
|
|
+// listReqVO.set
|
|
|
+// return success(BeanUtils.toBean(studentSelectSupervisorRecordService.getStudentSelectSupervisorRecordList(listReqVO),studentSelectSupervisorRecordRespVO.class));
|
|
|
+// }
|
|
|
+
|
|
|
}
|