|
@@ -10,6 +10,8 @@ import com.xjrsoft.common.enums.DeleteMark;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.base.mapper.BaseClassMapper;
|
|
|
+import com.xjrsoft.module.room.dto.AdjustBedPageDto;
|
|
|
+import com.xjrsoft.module.room.dto.AdjustClassPageDto;
|
|
|
import com.xjrsoft.module.room.dto.DistributeClassPageDto;
|
|
|
import com.xjrsoft.module.room.dto.DistributeRoomBedDto;
|
|
|
import com.xjrsoft.module.room.dto.DistributeRoomBedPageDto;
|
|
@@ -21,10 +23,13 @@ import com.xjrsoft.module.room.mapper.RoomBedMapper;
|
|
|
import com.xjrsoft.module.room.mapper.RoomBedRecordMapper;
|
|
|
import com.xjrsoft.module.room.mapper.RoomMapper;
|
|
|
import com.xjrsoft.module.room.service.IRoomBedService;
|
|
|
+import com.xjrsoft.module.room.vo.AdjustBedClassPageVo;
|
|
|
+import com.xjrsoft.module.room.vo.AdjustBedStudentPageVo;
|
|
|
import com.xjrsoft.module.room.vo.DistributeClassPageVo;
|
|
|
import com.xjrsoft.module.room.vo.DistributeResultClassVo;
|
|
|
import com.xjrsoft.module.room.vo.DistributeResultListVo;
|
|
|
import com.xjrsoft.module.room.vo.DistributeRoomBedPageVo;
|
|
|
+import com.xjrsoft.module.room.vo.NoBedStudentPageVo;
|
|
|
import com.xjrsoft.module.room.vo.RoomBedPageVo;
|
|
|
import com.xjrsoft.module.room.vo.RoomBedVo;
|
|
|
import com.xjrsoft.module.room.vo.RoomClassCountVo;
|
|
@@ -71,6 +76,18 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean clearStudentInfoByRoomId(Long id) {
|
|
|
+ List<RoomBed> bedList = roomBedMapper.selectList(
|
|
|
+ MPJWrappers.<RoomBed>lambdaJoin().eq(RoomBed::getRoomId, id)
|
|
|
+ );
|
|
|
+ for (RoomBed roomBed : bedList) {
|
|
|
+ roomBed.setStudentUserId(null);
|
|
|
+ roomBedMapper.updateById(roomBed);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Page<DistributeClassPageVo> getDistributeClassInfo(Page<DistributeClassPageVo> page, DistributeClassPageDto dto) {
|
|
|
return roomBedMapper.getDistributeClassInfo(page, dto);
|
|
@@ -134,12 +151,27 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
classDistributeBedNumber.put(classId, distributeBedNumber);
|
|
|
classStudent.put(classId, studentList.size());
|
|
|
}
|
|
|
+ Map<Long, Long> classGradeMap = new HashMap<>();
|
|
|
+ baseClassMapper.selectList(
|
|
|
+ MPJWrappers.<BaseClass>lambdaJoin().in(BaseClass::getId, dto.getClassIds())
|
|
|
+ ).forEach((baseClass)->{
|
|
|
+ classGradeMap.put(baseClass.getId(), baseClass.getGradeId());
|
|
|
+ });
|
|
|
//插入记录表 room_bed_record
|
|
|
- classStudent.forEach((classId, studentCount)->{
|
|
|
+ Integer maxSortCode = roomBedRecordMapper.getMaxSortCode();
|
|
|
+ for (Long classId : classGradeMap.keySet()) {
|
|
|
+ maxSortCode ++;
|
|
|
+ Integer studentCount = classStudent.get(classId);
|
|
|
RoomBedRecord record = new RoomBedRecord();
|
|
|
-// record.setClassId();
|
|
|
-// roomBedRecordMapper.insert();
|
|
|
- });
|
|
|
+ record.setClassId(classId);
|
|
|
+ record.setGradeId(classGradeMap.get(classId));
|
|
|
+ record.setCreateDate(modifyDate);
|
|
|
+ record.setSortCode(maxSortCode);
|
|
|
+ record.setNeedBedNumber(classStudent.get(classId));
|
|
|
+ record.setDistributeBedNumber(classDistributeBedNumber.get(classId));
|
|
|
+ record.setDeleteMark(DeleteMark.NODELETE.getCode());
|
|
|
+ roomBedRecordMapper.insert(record);
|
|
|
+ }
|
|
|
|
|
|
//查询每个寝室住入的班级数量,大于2的设置为混合寝室
|
|
|
List<RoomClassCountVo> classCountVoList = roomMapper.getRoomClassCount(dto.getRoomIds());
|
|
@@ -176,4 +208,20 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<AdjustBedClassPageVo> getClassStudetBed(Page<AdjustBedClassPageVo> page, AdjustClassPageDto dto) {
|
|
|
+ Page<AdjustBedClassPageVo> result = roomBedMapper.getClassStudetBed(page, dto);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<AdjustBedStudentPageVo> getBedStudetInfo(Page<AdjustBedStudentPageVo> page, AdjustBedPageDto dto) {
|
|
|
+ return roomBedMapper.getBedStudentInfo(page, dto);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<NoBedStudentPageVo> getNoBedStudent(Page<NoBedStudentPageVo> page, AdjustBedPageDto dto) {
|
|
|
+ return roomBedMapper.getNoBedStudent(page, dto);
|
|
|
+ }
|
|
|
}
|