|
@@ -2,6 +2,7 @@ package com.xjrsoft.module.room.service.impl;
|
|
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
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.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
@@ -10,24 +11,25 @@ import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.base.entity.BaseOfficeBuild;
|
|
import com.xjrsoft.module.base.entity.BaseOfficeBuild;
|
|
|
|
|
+import com.xjrsoft.module.base.mapper.BaseClassMapper;
|
|
|
import com.xjrsoft.module.room.dto.RoomBedCheckRecordPageDto;
|
|
import com.xjrsoft.module.room.dto.RoomBedCheckRecordPageDto;
|
|
|
-import com.xjrsoft.module.room.entity.Room;
|
|
|
|
|
-import com.xjrsoft.module.room.entity.RoomBedCheckRecord;
|
|
|
|
|
-import com.xjrsoft.module.room.entity.RoomBedCheckRecordRelation;
|
|
|
|
|
|
|
+import com.xjrsoft.module.room.entity.*;
|
|
|
import com.xjrsoft.module.room.mapper.RoomBedCheckRecordMapper;
|
|
import com.xjrsoft.module.room.mapper.RoomBedCheckRecordMapper;
|
|
|
import com.xjrsoft.module.room.mapper.RoomBedCheckRecordRelationMapper;
|
|
import com.xjrsoft.module.room.mapper.RoomBedCheckRecordRelationMapper;
|
|
|
import com.xjrsoft.module.room.mapper.RoomMapper;
|
|
import com.xjrsoft.module.room.mapper.RoomMapper;
|
|
|
import com.xjrsoft.module.room.service.IRoomBedCheckRecordService;
|
|
import com.xjrsoft.module.room.service.IRoomBedCheckRecordService;
|
|
|
-import com.xjrsoft.module.room.vo.RoomBedCheckRecordPageVo;
|
|
|
|
|
-import com.xjrsoft.module.room.vo.RoomBedCheckRecordRelationVo;
|
|
|
|
|
-import com.xjrsoft.module.room.vo.RoomBedCheckRecordVo;
|
|
|
|
|
|
|
+import com.xjrsoft.module.room.vo.*;
|
|
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
|
|
+import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
|
import com.xjrsoft.module.system.entity.File;
|
|
import com.xjrsoft.module.system.entity.File;
|
|
|
import com.xjrsoft.module.system.service.IFileService;
|
|
import com.xjrsoft.module.system.service.IFileService;
|
|
|
import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
|
|
+import com.xjrsoft.module.teacher.mapper.XjrUserMapper;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -49,6 +51,10 @@ public class RoomBedCheckRecordServiceImpl extends MPJBaseServiceImpl<RoomBedChe
|
|
|
|
|
|
|
|
private final RoomMapper roomMapper;
|
|
private final RoomMapper roomMapper;
|
|
|
|
|
|
|
|
|
|
+ private final XjrUserMapper xjrUserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final BaseClassMapper baseClassMapper;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -165,4 +171,62 @@ public class RoomBedCheckRecordServiceImpl extends MPJBaseServiceImpl<RoomBedChe
|
|
|
|
|
|
|
|
return roomBedCheckRecordVo;
|
|
return roomBedCheckRecordVo;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public RoomBedCheckRecordEchoVo getEcho() {
|
|
|
|
|
+ //获取当前用户信息
|
|
|
|
|
+ XjrUser xjrUser = xjrUserMapper.selectById(StpUtil.getLoginIdAsLong());
|
|
|
|
|
+ RoomBedCheckRecordEchoVo roomBedCheckRecordEchoVo = new RoomBedCheckRecordEchoVo();
|
|
|
|
|
+ roomBedCheckRecordEchoVo.setUserId(xjrUser.getId());
|
|
|
|
|
+ roomBedCheckRecordEchoVo.setUserName(xjrUser.getName());
|
|
|
|
|
+
|
|
|
|
|
+ //根据用户id获取其所管理的班级
|
|
|
|
|
+ LambdaQueryWrapper<BaseClass> queryWrapperClass = new LambdaQueryWrapper<>();
|
|
|
|
|
+ queryWrapperClass
|
|
|
|
|
+ .eq(BaseClass::getTeacherId,xjrUser.getId());
|
|
|
|
|
+ List<BaseClass> baseClassList = baseClassMapper.selectList(queryWrapperClass);
|
|
|
|
|
+ List<BaseClass> classList = new ArrayList<>();
|
|
|
|
|
+ List<Long> classIdList = new ArrayList<>();
|
|
|
|
|
+ for (BaseClass baseClass : baseClassList) {
|
|
|
|
|
+ classList.add(new BaseClass(){{
|
|
|
|
|
+ setId(baseClass.getId());
|
|
|
|
|
+ setName(baseClass.getName());
|
|
|
|
|
+ }});
|
|
|
|
|
+ classIdList.add(baseClass.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ roomBedCheckRecordEchoVo.setClassList(classList);
|
|
|
|
|
+
|
|
|
|
|
+ //获取用户管理的寝室
|
|
|
|
|
+ //根据班级
|
|
|
|
|
+ List<RoomEchoVo> roomEchoVoByClassList = new ArrayList<>();
|
|
|
|
|
+ if(classIdList != null && classIdList.size() > 0){
|
|
|
|
|
+ MPJLambdaWrapper<Room> queryRoomByClass = new MPJLambdaWrapper<>();
|
|
|
|
|
+ queryRoomByClass
|
|
|
|
|
+ .selectAs(Room::getId, RoomEchoVo::getRoomId)
|
|
|
|
|
+ .selectAs(Room::getRoomName, RoomEchoVo::getRoomName)
|
|
|
|
|
+ .leftJoin(RoomBed.class, RoomBed::getRoomId, Room::getId)
|
|
|
|
|
+ .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, RoomBed::getStudentUserId)
|
|
|
|
|
+ .leftJoin(BaseOfficeBuild.class, BaseOfficeBuild::getId, Room::getOfficeBuildId)
|
|
|
|
|
+ .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Room::getGender)
|
|
|
|
|
+ .in(BaseStudentSchoolRoll::getClassId, classIdList);
|
|
|
|
|
+ roomEchoVoByClassList = roomMapper.selectJoinList(RoomEchoVo.class, queryRoomByClass);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //根据宿管任命
|
|
|
|
|
+ MPJLambdaWrapper<Room> queryRoomByTeacherAppoint = new MPJLambdaWrapper<>();
|
|
|
|
|
+ queryRoomByTeacherAppoint
|
|
|
|
|
+ .selectAs(Room::getId, RoomEchoVo::getRoomId)
|
|
|
|
|
+ .selectAs(Room::getRoomName, RoomEchoVo::getRoomName)
|
|
|
|
|
+ .leftJoin(RoomTeacherAppoint.class, RoomTeacherAppoint::getRoomId, Room::getId)
|
|
|
|
|
+ .eq(RoomTeacherAppoint::getUserId, StpUtil.getLoginIdAsLong());
|
|
|
|
|
+ List<RoomEchoVo> roomEchoVoByTeacherAppointList = roomMapper.selectJoinList(RoomEchoVo.class, queryRoomByTeacherAppoint);
|
|
|
|
|
+
|
|
|
|
|
+ List<RoomEchoVo> roomEchoVoList = new ArrayList<>();
|
|
|
|
|
+ roomEchoVoList.addAll(roomEchoVoByClassList);
|
|
|
|
|
+ roomEchoVoList.addAll(roomEchoVoByTeacherAppointList);
|
|
|
|
|
+
|
|
|
|
|
+ roomBedCheckRecordEchoVo.setRoomEchoVoList(roomEchoVoList);
|
|
|
|
|
+
|
|
|
|
|
+ return roomBedCheckRecordEchoVo;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|