Explorar el Código

1.6一点修改

Crazy hace 3 días
padre
commit
1c3d3d5292

+ 7 - 6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/studentSelectSupervisorRecord/StudentSelectSupervisorRecordController.java

@@ -110,8 +110,8 @@ public class StudentSelectSupervisorRecordController {
         if ((roleIds.contains(112L) || roleIds.contains(113L)) && project.getSupervisorConfirmDeadline().isBefore(dateTime)) {
             return error(1, "该项目已过截至日期");
         }else {
-            Integer occupiedAcademicSlots = adminUserService.countStudentListBySupervisorId(Math.toIntExact(createReqVO.getSupervisorId()), 1);//占用学硕
-            Integer occupiedProfessionalSlots = adminUserService.countStudentListBySupervisorId(Math.toIntExact(createReqVO.getSupervisorId()), 2);//占用专硕
+            Integer occupiedAcademicSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),Math.toIntExact(createReqVO.getSupervisorId()), 1);//占用学硕
+            Integer occupiedProfessionalSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),Math.toIntExact(createReqVO.getSupervisorId()), 2);//占用专硕
             supervisorSelectionSettingDO supervisorSelectionSetting = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(createReqVO.getSupervisorId(), createReqVO.getProjectId());
 
             if (supervisorSelectionSetting == null || (supervisorSelectionSetting.getAcademicSlots() == null && supervisorSelectionSetting.getProfessionalSlots() == null)) {
@@ -154,9 +154,10 @@ public class StudentSelectSupervisorRecordController {
 
         studentSelectSupervisorRecordDO record =studentSelectSupervisorRecordService.getStudentSelectSupervisorRecord(updateReqVO.getId());
         //
+        studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProject(record.getProjectId()), studentSelectionProjectSaveReqVO.class);
         AdminUserDO user =adminUserService.getUser(record.getStudentId());
-        Integer  occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(Math.toIntExact(updateReqVO.getSupervisorId()),1);//占用学硕
-        Integer  occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(Math.toIntExact(updateReqVO.getSupervisorId()),2);//占用专硕
+        Integer  occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),Math.toIntExact(updateReqVO.getSupervisorId()),1);//占用学硕
+        Integer  occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),Math.toIntExact(updateReqVO.getSupervisorId()),2);//占用专硕
         supervisorSelectionSettingDO supervisorSelectionSetting = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(updateReqVO.getSupervisorId(), record.getProjectId());
         // 检查导师是否有名额设置
         if (supervisorSelectionSetting == null || (supervisorSelectionSetting.getAcademicSlots() == null && supervisorSelectionSetting.getProfessionalSlots() == null)) {
@@ -272,8 +273,8 @@ public class StudentSelectSupervisorRecordController {
             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);//占用专硕名额
+            Integer occupiedAcademicSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),Math.toIntExact(loginId), 1);//占用学硕名额
+            Integer occupiedProfessionalSlots = adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),Math.toIntExact(loginId), 2);//占用专硕名额
 
             supervisorSelectionSettingDO supervisorSelectionSetting = supervisorSelectionSettingService.getSettingBySupervisorIdAndProjectId(loginId, project.getId());
             // 检查导师是否有名额设置

+ 4 - 2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/supervisorSelectionSetting/supervisorSelectionSettingController.java

@@ -69,8 +69,10 @@ public class supervisorSelectionSettingController {
 
         supervisorSelectionSettingDO setting = supervisorSelectionSettingService.getSupervisorSelectionSetting(updateReqVO.getId());
 
-        Integer  occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(Math.toIntExact(setting.getSupervisorId()),1);//占用学硕
-        Integer  occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(Math.toIntExact(setting.getSupervisorId()),2);//占用专硕
+        studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProject(setting.getProjectId()), studentSelectionProjectSaveReqVO.class);
+
+        Integer  occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),Math.toIntExact(setting.getSupervisorId()),1);//占用学硕
+        Integer  occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),Math.toIntExact(setting.getSupervisorId()),2);//占用专硕
 
         if (updateReqVO.getAcademicSlots()<occupiedAcademicSlots){
             return error(1,"占用学硕名额大于更新学硕名额");

+ 9 - 2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java

@@ -260,8 +260,15 @@ public class UserController {
     @GetMapping("/supervisor")
     @Operation(summary = "获得所有导师")
     public CommonResult<List<AdminUserDO>> getSupervisor() {
-        List<AdminUserDO> deptUser = userService.getSupervisor();
-        return success(deptUser);
+        List<AdminUserDO> user = userService.getSupervisor();
+        return success(user);
+    }
+
+    @GetMapping("/getExternalSupervisor")
+    @Operation(summary = "获得所有校外导师")
+    public CommonResult<List<AdminUserDO>> getExternalSupervisor() {
+        List<AdminUserDO> User = userService.getExternalSupervisor();
+        return success(User);
     }
 
     //工作间详情

+ 8 - 2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java

@@ -291,6 +291,12 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
         return selectList(queryWrapper);
     }
 
+    default List<AdminUserDO> getExternalSupervisor() {
+        LambdaQueryWrapperX<AdminUserDO> queryWrapper = (LambdaQueryWrapperX<AdminUserDO>) new LambdaQueryWrapperX<AdminUserDO>()
+                .eqIfPresent(AdminUserDO::getUserType,5);
+        return selectList(queryWrapper);
+    }
+
     //  查登录工作间下的用户列表
     default List<AdminUserDO> selectDeptUser(UserPageReqVO reqVO) {
         Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
@@ -349,8 +355,8 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
             "HAVING COUNT(sa.id) > 2;")
     List<AdminUserDO> getStudentErrorAttendance();
 
-    @Select("SELECT COUNT(*) FROM system_users WHERE supervisor_id = #{supervisorId} AND master_type = #{masterType} AND user_type = '1' AND deleted = 0")
-    Integer countStudentListBySupervisorId(@Param("supervisorId") Integer supervisorId, @Param("masterType") Integer masterType);
+    @Select("SELECT COUNT(*) FROM system_users WHERE grade =#{grade} AND supervisor_id = #{supervisorId} AND master_type = #{masterType} AND user_type = '1' AND deleted = 0")
+    Integer countStudentListBySupervisorId(@Param("grade") String grade,@Param("supervisorId") Integer supervisorId, @Param("masterType") Integer masterType);
 
 
     //弹窗值

+ 5 - 2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/supervisorSelectionSetting/supervisorSelectionSettingServiceImpl.java

@@ -43,6 +43,8 @@ public class supervisorSelectionSettingServiceImpl implements supervisorSelectio
     private studentSelectSupervisorRecordService studentSelectSupervisorRecordService;
     @Resource
     private PermissionService permissionService;
+    @Resource
+    private studentSelectionProjectService studentSelectionProjectService;
 
     @Override
     public Integer createSupervisorSelectionSetting(supervisorSelectionSettingSaveReqVO createReqVO) {
@@ -88,11 +90,12 @@ public class supervisorSelectionSettingServiceImpl implements supervisorSelectio
         Set<Long> roleIds = permissionService.getUserRoleIdListByUserId(loginId);
         //获取项目名称
         PageResult<supervisorSelectionSettingDO> result =supervisorSelectionSettingMapper.selectPage(pageReqVO,roleIds,loginUser);
+        studentSelectionProjectSaveReqVO project = BeanUtils.toBean(studentSelectionProjectService.getStudentSelectionProject(pageReqVO.getProjectId()), studentSelectionProjectSaveReqVO.class);
 
         result.getList().forEach(re->{
             Integer supervisorId =re.getSupervisorId();
-            Integer  occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(supervisorId,1);//占用学硕
-            Integer  occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(supervisorId,2);//占用专硕
+            Integer  occupiedAcademicSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorId,1);//占用学硕
+            Integer  occupiedProfessionalSlots =adminUserService.countStudentListBySupervisorId(project.getStudentGrade(),supervisorId,2);//占用专硕
             re.setOccupiedAcademicSlots(occupiedAcademicSlots);
             re.setOccupiedProfessionalSlots(occupiedProfessionalSlots);
             if (roleIds.contains(112L)){

+ 3 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java

@@ -138,6 +138,8 @@ public interface AdminUserService {
     //查所有导师
     List<AdminUserDO> getSupervisor();
 
+    List<AdminUserDO> getExternalSupervisor();
+
     List<AdminUserDO> selectAllList(UserPageReqVO reqVO);
     /**
      * 通过用户 ID 查询用户
@@ -241,7 +243,7 @@ public interface AdminUserService {
     //获取三天内都缺勤的人
     List<AdminUserDO> getStudentErrorAttendance();
 
-    Integer countStudentListBySupervisorId(Integer supervisorId,Integer masterType);
+    Integer countStudentListBySupervisorId(String grade ,Integer supervisorId,Integer masterType);
 
     //是否弹窗
     PopDo getPopData();

+ 7 - 2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java

@@ -525,6 +525,11 @@ public class AdminUserServiceImpl implements AdminUserService {
         return userMapper.selectSupervisor();
     }
 
+    @Override
+    public List<AdminUserDO> getExternalSupervisor() {
+        return userMapper.getExternalSupervisor();
+    }
+
     //<>
 
     @Override
@@ -1171,8 +1176,8 @@ public class AdminUserServiceImpl implements AdminUserService {
         return userMapper.getStudentErrorAttendance();
     }
     @Override
-     public Integer countStudentListBySupervisorId(Integer supervisorId,Integer masterType){
-        return userMapper.countStudentListBySupervisorId(supervisorId,masterType);
+     public Integer countStudentListBySupervisorId(String grade ,Integer supervisorId,Integer masterType){
+        return userMapper.countStudentListBySupervisorId(grade,supervisorId,masterType);
     }
 
     //弹窗值