Browse Source

Merge branch 'master' of http://gogs.gisvg.com/YDM/graduate

Crazy 2 weeks ago
parent
commit
e163c2524e

+ 13 - 6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/studentSelectionProject/studentSelectionProjectController.java

@@ -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("创建项目成功");

+ 2 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/studentSelectionProject/vo/studentSelectionProjectSaveReqVO.java

@@ -34,5 +34,6 @@ public class studentSelectionProjectSaveReqVO {
 //    @NotEmpty(message = "导师不能为空")
     private List<Long> supervisorIds;
 
-
+    @Schema(description = "导师选择数组", requiredMode = Schema.RequiredMode.REQUIRED)
+    private List<Map<String,String>> supervisorsWithQuota;
 }