|
@@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
|
|
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.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import javax.annotation.Resource;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -55,6 +56,7 @@ public class studentSelectionProjectController {
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建师生互选项目")
|
|
|
@PreAuthorize("@ss.hasPermission('system:student-selection-project:create')")
|
|
|
+ @Transactional
|
|
|
public CommonResult<String> createStudentSelectionProject(@Valid @RequestBody studentSelectionProjectSaveReqVO createReqVO) {
|
|
|
|
|
|
// TODO 项目:1. 创建项目,建一个简单项目表, 2. 再创建一个教师信息表,存这个他今年填的信息和名额 (关联项目)
|
|
@@ -80,13 +82,18 @@ public class studentSelectionProjectController {
|
|
|
}else {
|
|
|
Integer projectId = studentSelectionProjectService.createStudentSelectionProject(createReqVO);
|
|
|
//创建初始化的导师名额设置
|
|
|
- supervisorSelectionSettingSaveReqVO settingSaveReqVO = new supervisorSelectionSettingSaveReqVO();
|
|
|
- if (createReqVO.getSupervisorIds() != null && !createReqVO.getSupervisorIds().isEmpty()) {
|
|
|
- createReqVO.getSupervisorIds().forEach(supervisorId -> {
|
|
|
- settingSaveReqVO.setSupervisorId(supervisorId);
|
|
|
- settingSaveReqVO.setProjectId(projectId);
|
|
|
+ for (Map<String, String> entry : createReqVO.getSupervisorsWithQuota()) {
|
|
|
+ supervisorSelectionSettingSaveReqVO settingSaveReqVO = new supervisorSelectionSettingSaveReqVO();
|
|
|
+
|
|
|
+ settingSaveReqVO
|
|
|
+ .setSupervisorId(Long.parseLong(entry.get("id")))
|
|
|
+ .setProjectId(projectId)
|
|
|
+ .setAcademicSlots(Integer.valueOf(entry.get("academicSlots")))
|
|
|
+ .setProfessionalSlots(Integer.valueOf(entry.get("professionalSlots")));
|
|
|
+
|
|
|
+ if (entry.get("academicSlots") != null && entry.get("professionalSlots") != null ) {
|
|
|
supervisorSelectionSettingService.createSupervisorSelectionSetting(settingSaveReqVO);
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return success("创建项目成功");
|