|
@@ -11,6 +11,7 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.github.yulichang.toolkit.MPJWrappers;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.enums.DeleteMark;
|
|
|
+import com.xjrsoft.common.exception.MyException;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.base.mapper.BaseClassMapper;
|
|
@@ -440,8 +441,17 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
}
|
|
|
RoomBed roomBedInfo = roomBedMapper.selectById(dto.getBedId());
|
|
|
Room room = roomMapper.selectById(roomBedInfo.getRoomId());
|
|
|
+ if(room == null){
|
|
|
+ throw new MyException("为查询到该床位");
|
|
|
+ }
|
|
|
if(!room.getGender().equals(studentGender)){
|
|
|
- return true;
|
|
|
+ String genderStr = "";
|
|
|
+ if("SB10001".equals(room.getGender())){
|
|
|
+ genderStr = "男";
|
|
|
+ }else if("SB10002".equals(room.getGender())){
|
|
|
+ genderStr = "女";
|
|
|
+ }
|
|
|
+ throw new MyException("该学生无法入住" + genderStr + "寝室");
|
|
|
}
|
|
|
|
|
|
//先清空学生原来的床位
|
|
@@ -450,17 +460,23 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
updateWrapper.setSql("student_user_id = null");
|
|
|
updateWrapper.setSql("is_check_in = 0");
|
|
|
|
|
|
- RoomBed roomBed = roomBedMapper.selectOne(new QueryWrapper<RoomBed>().lambda().eq(RoomBed::getStudentUserId, dto.getStudentUserId()));
|
|
|
- roomBedMapper.update(roomBed, updateWrapper);
|
|
|
+ List<Long> roomIds = new ArrayList<>();
|
|
|
+
|
|
|
+ List<RoomBed> roomBedList = roomBedMapper.selectList(new QueryWrapper<RoomBed>().lambda().eq(RoomBed::getStudentUserId, dto.getStudentUserId()));
|
|
|
+ for (RoomBed roomBed : roomBedList) {
|
|
|
+ roomBedMapper.update(roomBed, updateWrapper);
|
|
|
+ roomIds.add(roomBed.getRoomId());
|
|
|
+ }
|
|
|
+
|
|
|
//再把学生保存到新的床位
|
|
|
roomBedMapper.updateById(new RoomBed(){{
|
|
|
setId(dto.getBedId());
|
|
|
setStudentUserId(dto.getStudentUserId());
|
|
|
}});
|
|
|
-
|
|
|
+ if(roomIds.isEmpty()){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
//如果寝室的人是多个班级,将混合寝室改为是
|
|
|
- List<Long> roomIds = new ArrayList<>();
|
|
|
- roomIds.add(roomBed.getRoomId());
|
|
|
List<RoomClassCountVo> classCountVoList = roomMapper.getRoomClassCount(roomIds);
|
|
|
for (RoomClassCountVo roomClassCountVo : classCountVoList) {
|
|
|
if(roomClassCountVo.getClassCount() > 1){
|