|
@@ -1,6 +1,14 @@
|
|
package cn.iocoder.yudao.module.system.controller.admin.studentSelectSupervisorRecord;
|
|
package cn.iocoder.yudao.module.system.controller.admin.studentSelectSupervisorRecord;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.supervisorSelectionSetting.vo.supervisorSelectionSettingSaveReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
|
|
|
+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.supervisorSelectionSetting.supervisorSelectionSettingService;
|
|
|
|
+import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -12,6 +20,8 @@ import io.swagger.v3.oas.annotations.Operation;
|
|
import javax.validation.constraints.*;
|
|
import javax.validation.constraints.*;
|
|
import javax.validation.*;
|
|
import javax.validation.*;
|
|
import javax.servlet.http.*;
|
|
import javax.servlet.http.*;
|
|
|
|
+import java.time.LocalDate;
|
|
|
|
+import java.time.LocalDateTime;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
|
|
@@ -19,6 +29,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
+
|
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
@@ -38,18 +50,33 @@ public class studentSelectSupervisorRecordController {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private studentSelectSupervisorRecordService studentSelectSupervisorRecordService;
|
|
private studentSelectSupervisorRecordService studentSelectSupervisorRecordService;
|
|
|
|
+ @Resource
|
|
|
|
+ private AdminUserService adminUserService;
|
|
|
|
+ @Resource
|
|
|
|
+ private supervisorSelectionSettingService supervisorSelectionSettingService;
|
|
|
|
+ @Resource
|
|
|
|
+ private PermissionService permissionService;
|
|
|
|
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
@Operation(summary = "创建师生互选记录")
|
|
@Operation(summary = "创建师生互选记录")
|
|
@PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:create')")
|
|
@PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:create')")
|
|
- public CommonResult<Integer> createStudentSelectSupervisorRecord(@Valid @RequestBody studentSelectSupervisorRecordSaveReqVO createReqVO) {
|
|
|
|
|
|
+ public CommonResult<String> createStudentSelectSupervisorRecord(@Valid @RequestBody studentSelectSupervisorRecordSaveReqVO createReqVO) {
|
|
Long loginId = SecurityFrameworkUtils.getLoginUserId();
|
|
Long loginId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
|
+ studentSelectSupervisorRecordDO record1 =studentSelectSupervisorRecordService.getRecordByStudentIdAndSupervisorId(loginId,null,2);//同意
|
|
|
|
+ studentSelectSupervisorRecordDO record2 =studentSelectSupervisorRecordService.getRecordByStudentIdAndSupervisorId(loginId,null,1);//待处理
|
|
|
|
+
|
|
|
|
+ if (record1!=null){
|
|
|
|
+ return error(1,"请求已通过了");
|
|
|
|
+ }else if (record2!=null){
|
|
|
|
+ return error(1,"还有请求在待处理中");
|
|
|
|
+ }
|
|
createReqVO.setStudentId(loginId);
|
|
createReqVO.setStudentId(loginId);
|
|
- createReqVO.setSelectType(0L);
|
|
|
|
|
|
+ createReqVO.setSelectType(1);//待处理
|
|
String StudentSignature =createReqVO.getStudentSignature();
|
|
String StudentSignature =createReqVO.getStudentSignature();
|
|
System.out.println("电子签名"+StudentSignature);
|
|
System.out.println("电子签名"+StudentSignature);
|
|
- return success(studentSelectSupervisorRecordService.createStudentSelectSupervisorRecord(createReqVO));
|
|
|
|
|
|
+ studentSelectSupervisorRecordService.createStudentSelectSupervisorRecord(createReqVO);
|
|
|
|
+ return success("请求提交成功");
|
|
}
|
|
}
|
|
|
|
|
|
// 撤回,同意,退回,
|
|
// 撤回,同意,退回,
|
|
@@ -100,4 +127,134 @@ public class studentSelectSupervisorRecordController {
|
|
BeanUtils.toBean(list, studentSelectSupervisorRecordRespVO.class));
|
|
BeanUtils.toBean(list, studentSelectSupervisorRecordRespVO.class));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //通过,
|
|
|
|
+ @PutMapping("/agree")
|
|
|
|
+ @Operation(summary = "通过")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:agree')")
|
|
|
|
+ public CommonResult<Boolean> agreeStudentSelectSupervisorRecord(@Valid @RequestBody studentSelectSupervisorRecordSaveReqVO updateReqVO) {
|
|
|
|
+ //提交导师签名
|
|
|
|
+ updateReqVO.setSelectType(2);
|
|
|
|
+ LocalDateTime dateTime =LocalDateTime.now();
|
|
|
|
+ updateReqVO.setSupervisorApproveTime(dateTime);
|
|
|
|
+ updateReqVO.setAgreeDate(dateTime.toLocalDate());
|
|
|
|
+ studentSelectSupervisorRecordService.updateStudentSelectSupervisorRecord(updateReqVO);
|
|
|
|
+ //更新学生的supervisorId
|
|
|
|
+ if (updateReqVO.getId()!=null) {
|
|
|
|
+ studentSelectSupervisorRecordDO record = studentSelectSupervisorRecordService.getStudentSelectSupervisorRecord(updateReqVO.getId());
|
|
|
|
+ UserSaveReqVO saveReqVO =new UserSaveReqVO();
|
|
|
|
+ saveReqVO.setId(record.getStudentId());
|
|
|
|
+ saveReqVO.setSupervisorId(record.getSupervisorId());
|
|
|
|
+ adminUserService.updateUser(saveReqVO);
|
|
|
|
+ }
|
|
|
|
+ return success(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 退回,
|
|
|
|
+ @PutMapping("/refuse")
|
|
|
|
+ @Operation(summary = "退回")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:refuse')")
|
|
|
|
+ public CommonResult<Boolean> refuseStudentSelectSupervisorRecord(@Valid @RequestBody studentSelectSupervisorRecordSaveReqVO updateReqVO) {
|
|
|
|
+ LocalDateTime dateTime =LocalDateTime.now();
|
|
|
|
+ updateReqVO.setSupervisorApproveTime(dateTime);
|
|
|
|
+ updateReqVO.setSelectType(3);
|
|
|
|
+ studentSelectSupervisorRecordService.updateStudentSelectSupervisorRecord(updateReqVO);
|
|
|
|
+ return success(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //传导师id
|
|
|
|
+ @PutMapping("/withdraw")
|
|
|
|
+ @Operation(summary = "撤回")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:withdraw')")
|
|
|
|
+ public CommonResult<Boolean> withdrawStudentSelectSupervisorRecord(@Valid @RequestBody studentSelectSupervisorRecordSaveReqVO updateReqVO) {
|
|
|
|
+ Long loginId =SecurityFrameworkUtils.getLoginUserId();
|
|
|
|
+ studentSelectSupervisorRecordDO record =studentSelectSupervisorRecordService.getRecordByStudentIdAndSupervisorId(loginId,updateReqVO.getSupervisorId(),1);//待处理的
|
|
|
|
+ updateReqVO.setId(record.getId());
|
|
|
|
+ updateReqVO.setSelectType(0);
|
|
|
|
+// updateReqVO.setSupervisorId(0L);
|
|
|
|
+ studentSelectSupervisorRecordService.updateStudentSelectSupervisorRecord(updateReqVO);
|
|
|
|
+ return success(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/getSelectionBook")
|
|
|
|
+ @Operation(summary = "互选表打印数据")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:getSelection')")
|
|
|
|
+ public CommonResult<selectionBookRespVO> getSelectionBook(@Param("id") Integer recordId) {
|
|
|
|
+ studentSelectSupervisorRecordDO record = studentSelectSupervisorRecordService.getStudentSelectSupervisorRecord(recordId);
|
|
|
|
+ AdminUserDO student =adminUserService.getUser(record.getStudentId());
|
|
|
|
+ AdminUserDO supervisor =adminUserService.getUser(record.getSupervisorId());
|
|
|
|
+ supervisorSelectionSettingDO superVisorSetting = supervisorSelectionSettingService.getSettingBySupervisorId(record.getSupervisorId());
|
|
|
|
+ selectionBookRespVO result = new selectionBookRespVO();
|
|
|
|
+ result =BeanUtils.toBean(record,selectionBookRespVO.class);
|
|
|
|
+ //学生
|
|
|
|
+ result.setMajor(student.getMajor());
|
|
|
|
+ result.setStudentName(student.getNickname());
|
|
|
|
+ result.setStudentMobile(student.getMobile());
|
|
|
|
+ result.setStudentNumber(student.getUserNumber());
|
|
|
|
+
|
|
|
|
+ //导师
|
|
|
|
+ result.setSupervisor(supervisor.getNickname());
|
|
|
|
+ if (supervisor.getUserType().equals("3")) {
|
|
|
|
+ result.setSupervisorType("校内导师");
|
|
|
|
+ }else if (supervisor.getUserType().equals("5")) {
|
|
|
|
+ result.setSupervisorType("校外导师");
|
|
|
|
+ }
|
|
|
|
+ result.setStudentAchievementRequirement(superVisorSetting.getStudentAchievementRequirement());
|
|
|
|
+ return success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //通过方法和志愿填报方法都是这个
|
|
|
|
+ @PutMapping("/updateSelectionBook")
|
|
|
|
+ @Operation(summary = "更新互选表数据")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:updateSelection')")
|
|
|
|
+ public CommonResult<String> updateSelectionBook(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());//用户简历
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ studentSelectSupervisorRecordSaveReqVO recordUpdateReqVO =new studentSelectSupervisorRecordSaveReqVO();
|
|
|
|
+ if (roleIds.contains(112L)){
|
|
|
|
+ //学生提交签名//在创建的时候提交了
|
|
|
|
+
|
|
|
|
+ }else if (roleIds.contains(113L)){//导师
|
|
|
|
+ //导师提交签名,通过的时候提交
|
|
|
|
+// if (updateVo.getSupervisorSignature()!=null&&!updateVo.getSupervisorSignature().isEmpty()) {
|
|
|
|
+// recordUpdateReqVO.setId(updateVo.getId());
|
|
|
|
+// recordUpdateReqVO.setStudentSignature(updateVo.getSupervisorSignature());
|
|
|
|
+// studentSelectSupervisorRecordService.updateStudentSelectSupervisorRecord(recordUpdateReqVO);
|
|
|
|
+// }
|
|
|
|
+ //导师填写信息
|
|
|
|
+ //1.研究方向
|
|
|
|
+ if (updateVo.getSupervisorMajor()!=null&&!updateVo.getSupervisorMajor().isEmpty()){
|
|
|
|
+ userSaveReqVO.setMajor(updateVo.getSupervisorMajor());
|
|
|
|
+ }
|
|
|
|
+ //学生成果要求,和名额填写
|
|
|
|
+ supervisorSelectionSettingDO setting = supervisorSelectionSettingService.getSettingBySupervisorId(loginId);
|
|
|
|
+ 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);//已经填写了信息
|
|
|
|
+ adminUserService.updateUser(userSaveReqVO);
|
|
|
|
+ return success("填写成功");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/getRecordList")
|
|
|
|
+ @Operation(summary = "获取选择记录列表")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:student-select-supervisor-record:getRecordList')")
|
|
|
|
+ public CommonResult<List<studentSelectSupervisorRecordRespVO>> getRecordSelectSupervisorRecordList(@Valid studentSelectSupervisorRecordPageReqVO listReqVO) {
|
|
|
|
+ return success(BeanUtils.toBean(studentSelectSupervisorRecordService.getStudentSelectSupervisorRecordList(listReqVO),studentSelectSupervisorRecordRespVO.class));
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|