修复日程美甲师筛选消失与日视图泳道末端裁切
This commit is contained in:
+11
@@ -133,7 +133,9 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
}
|
||||
}
|
||||
|
||||
boolean artistFiltered = artistId != null && artistId > 0;
|
||||
List<PlanningArtistVO> artists = listArtists(shopId, artistId);
|
||||
List<PlanningArtistVO> artistOptions = artistFiltered ? listArtists(shopId, null) : artists;
|
||||
List<ArtistScheduleDO> schedules = listSchedules(shopId, start, end, artistId);
|
||||
Map<Long, String> artistNames = artists.stream()
|
||||
.collect(Collectors.toMap(PlanningArtistVO::getId, PlanningArtistVO::getName, (a, b) -> a));
|
||||
@@ -151,6 +153,14 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
.filter(appointment -> appointment.getArtistId() != null)
|
||||
.collect(Collectors.groupingBy(PlanningAppointmentVO::getArtistId, Collectors.counting()));
|
||||
artists.forEach(artist -> artist.setRangeCount(countByArtist.getOrDefault(artist.getId(), 0L).intValue()));
|
||||
if (artistFiltered) {
|
||||
List<PlanningAppointmentVO> rangeAppointments = listAppointments(shopId, rangeStart, rangeEnd, null, artistOptions);
|
||||
Map<Long, Long> optionCountByArtist = rangeAppointments.stream()
|
||||
.filter(appointment -> appointment.getArtistId() != null)
|
||||
.collect(Collectors.groupingBy(PlanningAppointmentVO::getArtistId, Collectors.counting()));
|
||||
artistOptions.forEach(artist -> artist.setRangeCount(
|
||||
optionCountByArtist.getOrDefault(artist.getId(), 0L).intValue()));
|
||||
}
|
||||
|
||||
PlanningCalendarVO vo = new PlanningCalendarVO();
|
||||
vo.setBusinessStartTime(businessHours == null ? null : businessHours.start().toString());
|
||||
@@ -159,6 +169,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
|| shop.getDefaultAppointmentDurationMinutes() <= 0 ? DEFAULT_DURATION_MINUTES : shop.getDefaultAppointmentDurationMinutes());
|
||||
vo.setSlotMinutes(DEFAULT_SLOT_MINUTES);
|
||||
vo.setArtists(artists);
|
||||
vo.setArtistOptions(artistOptions);
|
||||
vo.setSchedules(scheduleVos);
|
||||
vo.setAppointments(appointments);
|
||||
vo.setDaySummaries(buildDaySummaries(start, end, artists, schedules, appointments, weeklyHours));
|
||||
|
||||
+2
@@ -11,6 +11,8 @@ public class PlanningCalendarVO {
|
||||
private Integer defaultAppointmentDurationMinutes;
|
||||
private Integer slotMinutes;
|
||||
private List<PlanningArtistVO> artists;
|
||||
/** 全部美甲师选项(不受 artistId 筛选影响),供端侧筛选栏始终展示完整 chip 列表 */
|
||||
private List<PlanningArtistVO> artistOptions;
|
||||
private List<PlanningScheduleVO> schedules;
|
||||
private List<PlanningAppointmentVO> appointments;
|
||||
private List<PlanningDaySummaryVO> daySummaries;
|
||||
|
||||
Reference in New Issue
Block a user