|
@@ -1,11 +1,15 @@
|
|
|
package com.xjrsoft.module.room.controller;
|
|
package com.xjrsoft.module.room.controller;
|
|
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
|
|
+import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
|
|
+import com.xjrsoft.module.base.service.IBaseClassService;
|
|
|
import com.xjrsoft.module.room.dto.AdjustBedPageDto;
|
|
import com.xjrsoft.module.room.dto.AdjustBedPageDto;
|
|
|
import com.xjrsoft.module.room.dto.AdjustClassPageDto;
|
|
import com.xjrsoft.module.room.dto.AdjustClassPageDto;
|
|
|
import com.xjrsoft.module.room.dto.AdjustStudentBedDto;
|
|
import com.xjrsoft.module.room.dto.AdjustStudentBedDto;
|
|
@@ -41,14 +45,30 @@ public class RoomBedAdjustController {
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IRoomBedService roomBedService;
|
|
private final IRoomBedService roomBedService;
|
|
|
|
|
+ private final IBaseClassService baseClassService;
|
|
|
|
|
|
|
|
@GetMapping(value = "/class-student")
|
|
@GetMapping(value = "/class-student")
|
|
|
@ApiOperation(value="需要分配/调整床位的学生")
|
|
@ApiOperation(value="需要分配/调整床位的学生")
|
|
|
@SaCheckPermission("roomBedAdjust:detail")
|
|
@SaCheckPermission("roomBedAdjust:detail")
|
|
|
public RT<List<AdjustBedClassPageVo>> classStudent(@Valid AdjustClassPageDto dto){
|
|
public RT<List<AdjustBedClassPageVo>> classStudent(@Valid AdjustClassPageDto dto){
|
|
|
- if(ObjectUtil.isNull(dto.getClassId()) && ObjectUtil.isNull(dto.getGradeId())){
|
|
|
|
|
- return RT.ok(new ArrayList<>());
|
|
|
|
|
|
|
+ List<String> roleList = StpUtil.getRoleList();
|
|
|
|
|
+
|
|
|
|
|
+ long teacherId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
+ List<BaseClass> classList = baseClassService.list(
|
|
|
|
|
+ new QueryWrapper<BaseClass>().lambda().eq(BaseClass::getTeacherId, teacherId)
|
|
|
|
|
+ );
|
|
|
|
|
+ if(roleList.size() == 2 && roleList.contains("CLASSTE") && roleList.contains("TEACHER")){
|
|
|
|
|
+ if(classList != null && !classList.isEmpty()){
|
|
|
|
|
+ dto.setClassId(classList.get(0).getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(classList != null && !classList.isEmpty() && dto.getClassId() == null){
|
|
|
|
|
+ dto.setClassId(classList.get(0).getId());
|
|
|
|
|
+ }else if(ObjectUtil.isNull(dto.getClassId()) && ObjectUtil.isNull(dto.getGradeId())){
|
|
|
|
|
+ return RT.ok(new ArrayList<>());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
List<AdjustBedClassPageVo> result = roomBedService.getClassStudetBed(dto);
|
|
List<AdjustBedClassPageVo> result = roomBedService.getClassStudetBed(dto);
|
|
|
if (result == null) {
|
|
if (result == null) {
|
|
|
return RT.ok(new ArrayList<>());
|
|
return RT.ok(new ArrayList<>());
|
|
@@ -60,6 +80,21 @@ public class RoomBedAdjustController {
|
|
|
@ApiOperation(value="床位学生列表")
|
|
@ApiOperation(value="床位学生列表")
|
|
|
@SaCheckPermission("roomBedAdjust:detail")
|
|
@SaCheckPermission("roomBedAdjust:detail")
|
|
|
public RT<List<AdjustBedStudentPageVo>> distributeClassPage(@Valid AdjustBedPageDto dto){
|
|
public RT<List<AdjustBedStudentPageVo>> distributeClassPage(@Valid AdjustBedPageDto dto){
|
|
|
|
|
+ List<String> roleList = StpUtil.getRoleList();
|
|
|
|
|
+
|
|
|
|
|
+ long teacherId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
+ List<BaseClass> classList = baseClassService.list(
|
|
|
|
|
+ new QueryWrapper<BaseClass>().lambda().eq(BaseClass::getTeacherId, teacherId)
|
|
|
|
|
+ );
|
|
|
|
|
+ if(roleList.size() == 2 && roleList.contains("CLASSTE") && roleList.contains("TEACHER")){
|
|
|
|
|
+ if(classList != null && !classList.isEmpty()){
|
|
|
|
|
+ dto.setClassId(classList.get(0).getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(classList != null && !classList.isEmpty() && dto.getClassId() == null){
|
|
|
|
|
+ dto.setClassId(classList.get(0).getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
List<AdjustBedStudentPageVo> result = roomBedService.getBedStudetInfo(dto);
|
|
List<AdjustBedStudentPageVo> result = roomBedService.getBedStudetInfo(dto);
|
|
|
if (result == null) {
|
|
if (result == null) {
|
|
|
return RT.ok(new ArrayList<>());
|
|
return RT.ok(new ArrayList<>());
|