|
|
@@ -31,6 +31,7 @@ import com.xjrsoft.module.room.service.IRoomBedService;
|
|
|
import com.xjrsoft.module.room.vo.AdjustBedClassPageVo;
|
|
|
import com.xjrsoft.module.room.vo.AdjustBedClassStudentPageVo;
|
|
|
import com.xjrsoft.module.room.vo.AdjustBedStudentPageVo;
|
|
|
+import com.xjrsoft.module.room.vo.ClassStudentCountVo;
|
|
|
import com.xjrsoft.module.room.vo.DistributeClassPageVo;
|
|
|
import com.xjrsoft.module.room.vo.DistributeResultClassVo;
|
|
|
import com.xjrsoft.module.room.vo.DistributeResultListVo;
|
|
|
@@ -123,7 +124,80 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
|
|
|
|
|
|
@Override
|
|
|
public Page<DistributeClassPageVo> getDistributeClassInfo(Page<DistributeClassPageDto> page, DistributeClassPageDto dto) {
|
|
|
- return roomBedMapper.getDistributeClassInfo(page, dto);
|
|
|
+ Page<DistributeClassPageVo> classInfo = roomBedMapper.getDistributeClassInfo(page, dto);
|
|
|
+ List<DistributeClassPageVo> records = classInfo.getRecords();
|
|
|
+ //查询所有班级需要安排住宿的人数,并组装成map备用
|
|
|
+ List<ClassStudentCountVo> allStayCount = roomBedMapper.getAllStayCount();
|
|
|
+ Map<String, Integer> allStayCountMap = new HashMap<>();
|
|
|
+ for (ClassStudentCountVo classStudentCountVo : allStayCount) {
|
|
|
+ allStayCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询所有班级需要安排住宿的男生人数,并组装成map备用
|
|
|
+ List<ClassStudentCountVo> allStayMaleCount = roomBedMapper.getAllStayMaleCount();
|
|
|
+ Map<String, Integer> allStayMaleCountMap = new HashMap<>();
|
|
|
+ for (ClassStudentCountVo classStudentCountVo : allStayMaleCount) {
|
|
|
+ allStayMaleCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询所有班级需要安排住宿的女生人数,并组装成map备用
|
|
|
+ List<ClassStudentCountVo> allStayFemaleCount = roomBedMapper.getAllStayFemaleCount();
|
|
|
+ Map<String, Integer> allStayFemaleCountMap = new HashMap<>();
|
|
|
+ for (ClassStudentCountVo classStudentCountVo : allStayFemaleCount) {
|
|
|
+ allStayFemaleCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询所有班级已经安排住宿的总人数,并组装成map备用
|
|
|
+ List<ClassStudentCountVo> allArrangedCount = roomBedMapper.getAllArrangedCount();
|
|
|
+ Map<String, Integer> allArrangedCountMap = new HashMap<>();
|
|
|
+ for (ClassStudentCountVo classStudentCountVo : allArrangedCount) {
|
|
|
+ allArrangedCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询所有班级已经安排住宿的男生人数,并组装成map备用
|
|
|
+ List<ClassStudentCountVo> allArrangedMaleCount = roomBedMapper.getAllArrangedMaleCount();
|
|
|
+ Map<String, Integer> allArrangedMaleCountMap = new HashMap<>();
|
|
|
+ for (ClassStudentCountVo classStudentCountVo : allArrangedMaleCount) {
|
|
|
+ allArrangedMaleCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询所有班级已经安排住宿的女生人数,并组装成map备用
|
|
|
+ List<ClassStudentCountVo> allArrangedFemaleCount = roomBedMapper.getAllArrangedFemaleCount();
|
|
|
+ Map<String, Integer> allArrangedFemaleCountMap = new HashMap<>();
|
|
|
+ for (ClassStudentCountVo classStudentCountVo : allArrangedFemaleCount) {
|
|
|
+ allArrangedFemaleCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
|
|
|
+ }
|
|
|
+
|
|
|
+ for (DistributeClassPageVo record : records) {
|
|
|
+ Integer needCout = 0;
|
|
|
+ Integer distributeCount = 0;
|
|
|
+ Integer maleCount = 0, femaleCount = 0;
|
|
|
+ if(allStayMaleCountMap.get(record.getId()) != null){
|
|
|
+ maleCount = allStayMaleCountMap.get(record.getId());
|
|
|
+ }
|
|
|
+ record.setMaleCount(maleCount);
|
|
|
+
|
|
|
+ if(allStayFemaleCountMap.get(record.getId()) != null){
|
|
|
+ femaleCount = allStayMaleCountMap.get(record.getId());
|
|
|
+ }
|
|
|
+ record.setFemaleCount(femaleCount);
|
|
|
+
|
|
|
+ if("SB10001".equals(dto.getGender()) && allStayMaleCountMap.get(record.getId()) != null){
|
|
|
+ needCout = allStayMaleCountMap.get(record.getId());
|
|
|
+ distributeCount = needCout - (allArrangedMaleCountMap.get(record.getId()) == null ? 0 : allArrangedMaleCountMap.get(record.getId()));
|
|
|
+ }else if("SB10002".equals(dto.getGender())){
|
|
|
+ needCout = femaleCount;
|
|
|
+ distributeCount = needCout - (allArrangedFemaleCountMap.get(record.getId()) == null ? 0 : allArrangedFemaleCountMap.get(record.getId()));
|
|
|
+ }else{
|
|
|
+ needCout = allStayCountMap.get(record.getId());
|
|
|
+ distributeCount = needCout - (allArrangedCountMap.get(record.getId()) == null ? 0 : allArrangedCountMap.get(record.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ record.setNeedCount(needCout);
|
|
|
+ record.setDistributeCount(distributeCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ return classInfo;
|
|
|
}
|
|
|
|
|
|
@Override
|