|
@@ -10,10 +10,12 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
+import shop.alien.entity.store.EssentialHolidayComparison;
|
|
|
import shop.alien.entity.store.StoreBookingBusinessHours;
|
|
import shop.alien.entity.store.StoreBookingBusinessHours;
|
|
|
import shop.alien.entity.store.StoreBookingSettings;
|
|
import shop.alien.entity.store.StoreBookingSettings;
|
|
|
import shop.alien.entity.store.dto.StoreBookingBusinessHoursDTO;
|
|
import shop.alien.entity.store.dto.StoreBookingBusinessHoursDTO;
|
|
|
import shop.alien.entity.store.dto.StoreBookingSettingsDTO;
|
|
import shop.alien.entity.store.dto.StoreBookingSettingsDTO;
|
|
|
|
|
+import shop.alien.mapper.EssentialHolidayComparisonMapper;
|
|
|
import shop.alien.mapper.StoreBookingSettingsMapper;
|
|
import shop.alien.mapper.StoreBookingSettingsMapper;
|
|
|
import shop.alien.store.service.StoreBookingBusinessHoursService;
|
|
import shop.alien.store.service.StoreBookingBusinessHoursService;
|
|
|
import shop.alien.store.service.StoreBookingSettingsService;
|
|
import shop.alien.store.service.StoreBookingSettingsService;
|
|
@@ -37,6 +39,7 @@ import java.util.regex.Pattern;
|
|
|
public class StoreBookingSettingsServiceImpl extends ServiceImpl<StoreBookingSettingsMapper, StoreBookingSettings> implements StoreBookingSettingsService {
|
|
public class StoreBookingSettingsServiceImpl extends ServiceImpl<StoreBookingSettingsMapper, StoreBookingSettings> implements StoreBookingSettingsService {
|
|
|
|
|
|
|
|
private final StoreBookingBusinessHoursService storeBookingBusinessHoursService;
|
|
private final StoreBookingBusinessHoursService storeBookingBusinessHoursService;
|
|
|
|
|
+ private final EssentialHolidayComparisonMapper essentialHolidayComparisonMapper;
|
|
|
|
|
|
|
|
// 时间格式正则:HH:mm
|
|
// 时间格式正则:HH:mm
|
|
|
private static final Pattern TIME_PATTERN = Pattern.compile("^([0-1][0-9]|2[0-3]):[0-5][0-9]$");
|
|
private static final Pattern TIME_PATTERN = Pattern.compile("^([0-1][0-9]|2[0-3]):[0-5][0-9]$");
|
|
@@ -287,7 +290,21 @@ public class StoreBookingSettingsServiceImpl extends ServiceImpl<StoreBookingSet
|
|
|
|
|
|
|
|
if (!specialHoursList.isEmpty()) {
|
|
if (!specialHoursList.isEmpty()) {
|
|
|
List<StoreBookingBusinessHoursDTO> specialHoursDTOList = specialHoursList.stream()
|
|
List<StoreBookingBusinessHoursDTO> specialHoursDTOList = specialHoursList.stream()
|
|
|
- .map(this::convertToBusinessHoursDTO)
|
|
|
|
|
|
|
+ .map(businessHours -> {
|
|
|
|
|
+ StoreBookingBusinessHoursDTO hoursDTO = convertToBusinessHoursDTO(businessHours);
|
|
|
|
|
+ // 如果有关联的节假日ID,查询节假日信息
|
|
|
|
|
+ if (businessHours.getEssentialId() != null) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ EssentialHolidayComparison holiday = essentialHolidayComparisonMapper.selectById(businessHours.getEssentialId());
|
|
|
|
|
+ if (holiday != null) {
|
|
|
|
|
+ hoursDTO.setHolidayInfo(holiday);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("查询节假日信息失败,essentialId={}", businessHours.getEssentialId(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return hoursDTO;
|
|
|
|
|
+ })
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
dto.setSpecialBusinessHoursList(specialHoursDTOList);
|
|
dto.setSpecialBusinessHoursList(specialHoursDTOList);
|
|
|
}
|
|
}
|
|
@@ -314,6 +331,9 @@ public class StoreBookingSettingsServiceImpl extends ServiceImpl<StoreBookingSet
|
|
|
businessHours.setStartTime(dto.getStartTime());
|
|
businessHours.setStartTime(dto.getStartTime());
|
|
|
businessHours.setEndTime(dto.getEndTime());
|
|
businessHours.setEndTime(dto.getEndTime());
|
|
|
businessHours.setSort(dto.getSort() != null ? dto.getSort() : 0);
|
|
businessHours.setSort(dto.getSort() != null ? dto.getSort() : 0);
|
|
|
|
|
+ businessHours.setEssentialId(dto.getEssentialId());
|
|
|
|
|
+ businessHours.setReservation(dto.getReservation());
|
|
|
|
|
+ businessHours.setReservationMoney(dto.getReservationMoney());
|
|
|
return businessHours;
|
|
return businessHours;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -334,6 +354,9 @@ public class StoreBookingSettingsServiceImpl extends ServiceImpl<StoreBookingSet
|
|
|
dto.setStartTime(businessHours.getStartTime());
|
|
dto.setStartTime(businessHours.getStartTime());
|
|
|
dto.setEndTime(businessHours.getEndTime());
|
|
dto.setEndTime(businessHours.getEndTime());
|
|
|
dto.setSort(businessHours.getSort());
|
|
dto.setSort(businessHours.getSort());
|
|
|
|
|
+ dto.setEssentialId(businessHours.getEssentialId());
|
|
|
|
|
+ dto.setReservation(businessHours.getReservation());
|
|
|
|
|
+ dto.setReservationMoney(businessHours.getReservationMoney());
|
|
|
return dto;
|
|
return dto;
|
|
|
}
|
|
}
|
|
|
|
|
|