Commit 476634a2 by 吕明尚

修改房间状态显示和保洁管房间理显示一致

parent 8734ea03
......@@ -52,6 +52,8 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
private RoomStatusService roomStatusService;
@Autowired
private SStoreConsumerMapper storeConsumerMapper;
@Autowired
private ISCleanRecordsService cleanRecordsService;
/**
......@@ -118,6 +120,8 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
// List<Long> storeIds = roomList.stream().map(SRoom::getStoreId).collect(Collectors.toList());
List<Long> roomIds = roomList.stream().map(SRoom::getId).collect(Collectors.toList());
List<SRoomPack> roomPacks = roomPackService.packIdsByRoomIds(roomIds);
List<SCleanRecords> sCleanRecordsList = cleanRecordsService.unCleanedListByRoomIds(roomIds);
Map<Long, List<SCleanRecords>> recordsMap = Optional.ofNullable(sCleanRecordsList).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(SCleanRecords::getRoomId));
SStore store = sStoreService.getById(roomList.get(0).getStoreId());
Map<Long,List<SRoomPack>> roomPackMap = Optional.ofNullable(roomPacks).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(SRoomPack::getRoomId));
List<Long> packIdList = Optional.ofNullable(roomPacks).orElse(new ArrayList<>()).stream().map(SRoomPack::getPackId).collect(Collectors.toList());
......@@ -129,6 +133,12 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
BeanUtils.copyProperties(sRoom, vo);
vo.setStoreName(store.getName());
vo.setRoomStatusList(roomStatusMap.get(sRoom.getId()));
if (CollectionUtils.isNotEmpty(sCleanRecordsList)) {
if (CollectionUtils.isNotEmpty(recordsMap.get(vo.getId()))) {
SCleanRecords records = recordsMap.get(vo.getId()).get(0);
vo.setRecordsStatus(records.getStatus());
}
}
if(!roomPackMap.isEmpty()) {
List<Long> packIds = Optional.ofNullable(roomPackMap.get(sRoom.getId())).orElse(new ArrayList<>()).stream().map(SRoomPack::getPackId).collect(Collectors.toList());
sRoom.setPackIds(packIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
......@@ -330,6 +340,14 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
public SRoomVo queryById(Long id) {
SRoom room = baseMapper.selectById(id);
SStore sStore = sStoreService.selectSStoreById(room.getStoreId());
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(SCleanRecords::getRoomId, id);
queryWrapper.ne(SCleanRecords::getStatus, CleaningStatusEnum.CLEANED.getCode());
queryWrapper.orderByDesc(SCleanRecords::getStartDate);
List<SCleanRecords> list = cleanRecordsService.list(queryWrapper);
if (CollectionUtils.isNotEmpty(list)) {
room.setRecordsStatus(list.get(0).getStatus());
}
room.setOpenShopUuid(sStore.getOpenShopUuid());
List<Long> packIds = roomPackService.selectPackListByRoomId(id);
//过滤首次下单套餐
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment