|
|
@@ -324,7 +324,39 @@ public class VoyageStockDistributeNewServiceImpl implements VoyageStockDistribut
|
|
|
* @return
|
|
|
*/
|
|
|
private List<RoomRespDTO> getAppShareCanSelectRoomList(AppCanSelectRoomReqVO reqVO) {
|
|
|
- return null;
|
|
|
+ //获取该游轮的所有房间
|
|
|
+ List<RoomRespDTO> roomList = roomApi.getRoomList(reqVO.getShipId());
|
|
|
+ Integer floor = reqVO.getFloor();
|
|
|
+ if(floor != null) {
|
|
|
+ //获取当前楼层的房间
|
|
|
+ roomList = roomList.stream().filter(item -> item.getFloors().equals(floor)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ Long roomModelId = reqVO.getRoomModelId();
|
|
|
+ if(roomModelId != null) {
|
|
|
+ roomList = roomList.stream().filter(item -> item.getRoomModelId().equals(roomModelId)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ // 获取已被分配的房间
|
|
|
+ VoyageStockDistributeNewDetailReqVO queryVO = new VoyageStockDistributeNewDetailReqVO();
|
|
|
+ queryVO.setVoyageId(reqVO.getVoyageId());
|
|
|
+ queryVO.setType(DistributorOrStoreEnum.DISTRIBUTOR.getValue());
|
|
|
+ List<VoyageStockDistributeRoomDO> distributeRoomList = voyageStockDistributeRoomService.getListByVoyageIdAndObjectId(queryVO);
|
|
|
+ List<Long> selectedRoomIds = CollectionUtils.convertList(distributeRoomList, VoyageStockDistributeRoomDO::getRoomId);
|
|
|
+ //过滤掉已被分配的房间
|
|
|
+ roomList = roomList.stream().filter(item -> !selectedRoomIds.contains(item.getId())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //获取已被门店选择的房间
|
|
|
+ List<VoyageStockDistributeRoomDO> storeRoomList = voyageStockDistributeRoomService.getListByVoyageId(reqVO.getVoyageId(), DistributorOrStoreEnum.STORE.getValue());
|
|
|
+ List<Long> selectedStoreRoomIds = CollectionUtils.convertList(storeRoomList, VoyageStockDistributeRoomDO::getRoomId);
|
|
|
+ roomList = roomList.stream().filter(item -> !selectedStoreRoomIds.contains(item.getId())).collect(Collectors.toList());
|
|
|
+ //获取已被使用的房间
|
|
|
+ List<VoyageStockRoomUsedDO> roomUsedList = voyageStockRoomUsedMapper.selectListByVoyageId(reqVO.getVoyageId());
|
|
|
+ List<Long> usedRoomIds = CollectionUtils.convertList(roomUsedList, VoyageStockRoomUsedDO::getRoomId);
|
|
|
+ //过滤掉已被使用的房间
|
|
|
+ roomList = roomList.stream().filter(item -> !usedRoomIds.contains(item.getId())).collect(Collectors.toList());
|
|
|
+ roomList.stream().forEach(item -> {
|
|
|
+ item.setNum(BigDecimal.ONE);
|
|
|
+ });
|
|
|
+ return roomList;
|
|
|
}
|
|
|
|
|
|
/**
|