|
|
@@ -23,6 +23,7 @@ import org.springframework.web.client.RestTemplate;
|
|
|
import shop.alien.entity.result.R;
|
|
|
import shop.alien.entity.store.*;
|
|
|
import shop.alien.entity.store.vo.StoreBannerVo;
|
|
|
+import shop.alien.entity.store.vo.StoreBusinessInfoVo;
|
|
|
import shop.alien.entity.store.vo.StoreBusinessStatusVo;
|
|
|
import shop.alien.entity.store.vo.StoreInfoVo;
|
|
|
import shop.alien.mapper.*;
|
|
|
@@ -389,7 +390,7 @@ public class AiSearchController {
|
|
|
|
|
|
/**
|
|
|
* 批量填充营业时间到StoreInfoVo列表中
|
|
|
- * 通过调用storeInfoService.getStoreBusinessStatus方法获取营业时间
|
|
|
+ * 通过调用storeInfoService.getStoreInfoBusinessHours方法获取营业时间(包含节假日信息)
|
|
|
*
|
|
|
* @param result StoreInfoVo列表
|
|
|
*/
|
|
|
@@ -398,32 +399,38 @@ public class AiSearchController {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 遍历result集合,为每个门店调用getStoreBusinessStatus方法
|
|
|
+ // 遍历result集合,为每个门店调用getStoreInfoBusinessHours方法
|
|
|
for (StoreInfoVo storeInfo : result) {
|
|
|
if (storeInfo.getId() != null) {
|
|
|
try {
|
|
|
- // 调用getStoreBusinessStatus方法获取营业时间
|
|
|
- StoreBusinessStatusVo businessStatus = storeInfoService.getStoreBusinessStatus(String.valueOf(storeInfo.getId()));
|
|
|
- if (businessStatus != null) {
|
|
|
- // 设置营业时间信息到StoreInfoVo中
|
|
|
- if (businessStatus.getStoreBusinessInfos() != null && !businessStatus.getStoreBusinessInfos().isEmpty()) {
|
|
|
- storeInfo.setStoreBusinessInfos(businessStatus.getStoreBusinessInfos());
|
|
|
- // 同时设置到openTime字段(格式化为字符串列表)
|
|
|
- List<String> openTimeList = businessStatus.getStoreBusinessInfos().stream()
|
|
|
- .map(info -> {
|
|
|
- if (info.getBusinessDate() != null && info.getStartTime() != null && info.getEndTime() != null) {
|
|
|
- return info.getBusinessDate() + " " + info.getStartTime() + "-" + info.getEndTime();
|
|
|
- }
|
|
|
- return null;
|
|
|
- })
|
|
|
- .filter(time -> time != null)
|
|
|
- .collect(Collectors.toList());
|
|
|
- storeInfo.setOpenTime(openTimeList);
|
|
|
- }
|
|
|
- // 设置营业状态
|
|
|
- if (businessStatus.getYyFlag() != null) {
|
|
|
- storeInfo.setYyFlag(businessStatus.getYyFlag());
|
|
|
+ // 调用getStoreInfoBusinessHours方法获取营业时间(包含节假日信息)
|
|
|
+ List<StoreBusinessInfoVo> storeBusinessInfoVos = storeInfoService.getStoreInfoBusinessHours(storeInfo.getId());
|
|
|
+ if (storeBusinessInfoVos != null && !storeBusinessInfoVos.isEmpty()) {
|
|
|
+ // 设置包含节假日信息的营业时间列表
|
|
|
+ storeInfo.setStoreBusinessInfoVos(storeBusinessInfoVos);
|
|
|
+ // 转换为 List<StoreBusinessInfo> 用于兼容原有字段(StoreBusinessInfoVo 继承自 StoreBusinessInfo)
|
|
|
+ List<StoreBusinessInfo> storeBusinessInfos = new ArrayList<>(storeBusinessInfoVos);
|
|
|
+ storeInfo.setStoreBusinessInfos(storeBusinessInfos);
|
|
|
+ // 设置第一个营业时间信息到 storeBusinessInfo 字段
|
|
|
+ if (!storeBusinessInfos.isEmpty()) {
|
|
|
+ storeInfo.setStoreBusinessInfo(storeBusinessInfos.get(0));
|
|
|
}
|
|
|
+ // 同时设置到openTime字段(格式化为字符串列表)
|
|
|
+ List<String> openTimeList = storeBusinessInfoVos.stream()
|
|
|
+ .map(info -> {
|
|
|
+ if (info.getBusinessDate() != null && info.getStartTime() != null && info.getEndTime() != null) {
|
|
|
+ return info.getBusinessDate() + " " + info.getStartTime() + "-" + info.getEndTime();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ })
|
|
|
+ .filter(time -> time != null)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ storeInfo.setOpenTime(openTimeList);
|
|
|
+ }
|
|
|
+ // 获取营业状态(通过getStoreBusinessStatus方法)
|
|
|
+ StoreBusinessStatusVo businessStatus = storeInfoService.getStoreBusinessStatus(String.valueOf(storeInfo.getId()));
|
|
|
+ if (businessStatus != null && businessStatus.getYyFlag() != null) {
|
|
|
+ storeInfo.setYyFlag(businessStatus.getYyFlag());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("获取门店营业时间失败,storeId: {}", storeInfo.getId(), e);
|