|
@@ -4,6 +4,9 @@ import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
+import com.github.yulichang.toolkit.MPJWrappers;
|
|
|
+import com.xjrsoft.common.enums.DeleteMark;
|
|
|
+import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.room.dto.DistributeClassPageDto;
|
|
|
import com.xjrsoft.module.room.dto.DistributeRoomBedDto;
|
|
|
import com.xjrsoft.module.room.dto.DistributeRoomBedPageDto;
|
|
@@ -18,14 +21,17 @@ import com.xjrsoft.module.room.vo.DistributeRoomBedPageVo;
|
|
|
import com.xjrsoft.module.room.vo.RoomBedPageVo;
|
|
|
import com.xjrsoft.module.room.vo.RoomBedVo;
|
|
|
import com.xjrsoft.module.room.vo.RoomClassCountVo;
|
|
|
-import com.xjrsoft.module.student.dto.DistributeStudentDto;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudent;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
import com.xjrsoft.module.student.mapper.BaseStudentMapper;
|
|
|
-import com.xjrsoft.module.student.vo.StudentInfoVo;
|
|
|
+import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @title: 寝室床位
|
|
@@ -84,12 +90,24 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
|
|
|
//查询每个班的学生,修改床位信息
|
|
|
int i = 0;
|
|
|
+ Map<Long, Integer> classDistributeBedNumber = new HashMap<>();
|
|
|
+ Map<Long, Integer> classStudent = new HashMap<>();
|
|
|
for (Long classId : dto.getClassIds()) {
|
|
|
- DistributeStudentDto classDto = new DistributeStudentDto();
|
|
|
- classDto.setClassId(classId);
|
|
|
- classDto.setGender(genderNumber);
|
|
|
- List<StudentInfoVo> studentList = baseStudentMapper.getClassStudent(classDto);
|
|
|
- for (StudentInfoVo studentInfoVo : studentList) {
|
|
|
+ List<BaseStudent> studentList = baseStudentMapper.selectList(
|
|
|
+ MPJWrappers.<BaseStudent>lambdaJoin()
|
|
|
+ .select(BaseStudent::getUserId)
|
|
|
+ .eq(BaseClass::getId, classId)
|
|
|
+ .eq(XjrUser::getGender, genderNumber)
|
|
|
+ .eq(BaseStudentSchoolRoll::getStduyStatus, "FB3001")
|
|
|
+ .eq(BaseStudent::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ .eq(XjrUser::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ .innerJoin(XjrUser.class, XjrUser::getId, BaseStudent::getUserId)
|
|
|
+ .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, BaseStudent::getUserId)
|
|
|
+ .leftJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
|
|
|
+ );
|
|
|
+ //已分配床位数
|
|
|
+ int distributeBedNumber = 0;
|
|
|
+ for (BaseStudent studentInfoVo : studentList) {
|
|
|
if(i > bedInfoList.size()){
|
|
|
continue;
|
|
|
}
|
|
@@ -100,8 +118,16 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
roomBed.setModifyUserId(modifyUserId);
|
|
|
roomBedMapper.updateById(roomBed);
|
|
|
i ++;
|
|
|
+ distributeBedNumber ++;
|
|
|
+
|
|
|
}
|
|
|
+ classDistributeBedNumber.put(classId, distributeBedNumber);
|
|
|
+ classStudent.put(classId, studentList.size());
|
|
|
}
|
|
|
+ //插入记录表 room_bed_record
|
|
|
+ classStudent.forEach((classId, studentCount)->{
|
|
|
+
|
|
|
+ });
|
|
|
|
|
|
//查询每个寝室住入的班级数量,大于2的设置为混合寝室
|
|
|
List<RoomClassCountVo> classCountVoList = roomMapper.getRoomClassCount(dto.getRoomIds());
|