From 507b65838ce465f2a18dbf66ee959f53fa3ccf93 Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Thu, 6 Nov 2025 22:52:59 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E9=A2=84=E7=BA=A6=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=A7=BD,=E5=A2=9E=E5=8A=A0=20=E5=BC=80?= =?UTF-8?q?=E4=B8=9A=E7=AD=B9=E5=A4=87=E4=B8=AD=E7=9A=84=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/modules/store/ShopStoreBase.java | 4 +- .../order/service/ShopOrderBaseService.java | 2 + .../impl/ShopOrderBaseServiceImpl.java | 1 + .../impl/ShopOrderInfoServiceImpl.java | 61 ++++++++++++------- .../store/service/ShopStoreBaseService.java | 10 +++ .../impl/ShopStoreBaseServiceImpl.java | 48 +++++++++++++++ .../mapper/store/ShopStoreBaseMapper.xml | 2 +- pom.xml | 6 ++ 8 files changed, 110 insertions(+), 24 deletions(-) diff --git a/mall-common/src/main/java/com/suisung/mall/common/modules/store/ShopStoreBase.java b/mall-common/src/main/java/com/suisung/mall/common/modules/store/ShopStoreBase.java index 89c1fa17..43d0142c 100644 --- a/mall-common/src/main/java/com/suisung/mall/common/modules/store/ShopStoreBase.java +++ b/mall-common/src/main/java/com/suisung/mall/common/modules/store/ShopStoreBase.java @@ -83,8 +83,8 @@ public class ShopStoreBase implements Serializable { @ApiModelProperty(value = "店铺营业状态:1-营业中;2-已打烊;3-开业(活动)筹备中;") private Integer store_biz_state; - @ApiModelProperty(value = "开业(活动)筹备具体时间 yyyy-MM-dd HH:mm:ss;") - private Date store_biz_opening_dtime; + @ApiModelProperty(value = "开业(活动)筹备日期 yyyy-MM-dd") + private Date store_biz_opening_date; @ApiModelProperty(value = "上级店铺编号:创建店铺决定,所属分销商-不可更改! 佣金公平性考虑") private Integer shop_parent_id; diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/ShopOrderBaseService.java b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/ShopOrderBaseService.java index e0212547..e60c32c2 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/ShopOrderBaseService.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/ShopOrderBaseService.java @@ -616,4 +616,6 @@ public interface ShopOrderBaseService extends IBaseService { * @return */ Boolean updateOrderTime(String orderId, Date orderTime); + + } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java index 8cdf0518..8c4f0576 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java @@ -9366,4 +9366,5 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl genBookingOrderArgList(String storeIds) { // 初始化营业时间对象 - Pair timesPair = null; + Pair storeBizTimeRange = null; // 如果storeId不为空,则尝试获取店铺信息 if (StrUtil.isNotBlank(storeIds)) { - // 多个店铺的营业时间段集合 - List> timesMapList = selStoreBizTimeMapList(storeIds); - if (!CollUtil.isEmpty(timesMapList)) { + // 根据一个或多个店铺id获取有效店铺的有效营业时间段 + List> storeBizTimeRangesList = selectMulStoreBizTimeRanges(storeIds); + if (!CollUtil.isEmpty(storeBizTimeRangesList)) { // 获取多个店铺的营业时间段的一个交集 - timesPair = DateTimeUtils.findTimeInterSection(timesMapList); + storeBizTimeRange = DateTimeUtils.findTimeInterSection(storeBizTimeRangesList); } } - if (timesPair == null || StrUtil.isBlank(timesPair.getFirst()) || StrUtil.isBlank(timesPair.getSecond())) { + if (storeBizTimeRange == null + || StrUtil.isBlank(storeBizTimeRange.getFirst()) + || StrUtil.isBlank(storeBizTimeRange.getSecond())) { // 没有具体的营业时间段 logger.info("[生成预约参数] 未找到营业时间段"); return Collections.emptyList(); @@ -1037,15 +1039,31 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl result = new ArrayList<>(); + List bookingArgList = new ArrayList<>(); - // 判断今天还能不能立即下单和预约下单?能:就有今天的时间槽;不能:就没有今天的时间槽 + Date startDate = new Date(); //-1-在时间段之前 0-时间段内,1-在时间段之后 - int inRangeVal = DateTimeUtils.isCurrentTimeInRange(timesPair.getFirst(), timesPair.getSecond()); + int inRangeVal = 0; + // 今天是否可预约(在营业时间之前或之中) + boolean isTodayAvailable = true; + + // 获取开业(活动)筹备中店铺最晚的日期, 如果存在说明几个店铺中有开业(活动)筹备中的店铺 + Date latestBizOpeningDate = shopStoreBaseService.getLatestBizOpeningDate(storeIds); + if (latestBizOpeningDate != null) { + // 有开业筹备中的店铺,预约以这个开业日期为起始日期 + startDate = latestBizOpeningDate; + inRangeVal = 1; + isTodayAvailable = false; + } else { + // 判断今天还能不能立即下单和预约下单?能:就有今天的时间槽;不能:就没有今天的时间槽 + //-1-在时间段之前 0-时间段内,1-在时间段之后 + inRangeVal = DateTimeUtils.isCurrentTimeInRange(storeBizTimeRange.getFirst(), storeBizTimeRange.getSecond()); + + // 确定起始日期 + startDate = inRangeVal == 1 ? DateUtil.offsetDay(startDate, 1) : startDate; + isTodayAvailable = inRangeVal <= 0; // 今天是否可预约(在营业时间之前或之中) + } - // 确定起始日期 - Date startDate = inRangeVal == 1 ? DateUtil.offsetDay(new Date(), 1) : new Date(); - boolean isTodayAvailable = inRangeVal <= 0; // 今天是否可预约(在营业时间之前或之中) for (int i = 0; i < daysCnt; i++) { Date currentDate = DateUtil.offsetDay(startDate, i); @@ -1065,9 +1083,9 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl * 根据 storeIds(一个或多个 storeid,如 34,23,43,23,),先对id去重, * 再获取多个店铺的营业时间 List 列表list * 启动如果遇到某个店铺是开业(活动)筹备中的,获取他的开始营业的的日期和营业时间段组合出特有营业时间段 @@ -1196,7 +1216,7 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl> selStoreBizTimeMapList(String storeIds) { + private List> selectMulStoreBizTimeRanges(String storeIds) { // 参数校验 if (StrUtil.isBlank(storeIds)) { return Collections.emptyList(); @@ -1220,7 +1240,6 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.select("store_opening_hours", "store_close_hours"); // 只查询必要字段 queryWrapper.in("store_id", storeIds); - List shopStoreInfos = shopStoreInfoService.find(queryWrapper); // 4. 转换为营业时间映射列表 diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBaseService.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBaseService.java index d83998c6..b00c7986 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBaseService.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopStoreBaseService.java @@ -17,6 +17,7 @@ import org.springframework.data.util.Pair; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; +import java.util.Date; import java.util.List; import java.util.Map; @@ -245,6 +246,15 @@ public interface ShopStoreBaseService extends IBaseService { */ Pair getStoreBizState(Integer storeId); + + /** + * 根据一个或多个店铺Id,获取开业(活动)筹备中店铺的营业日期最晚的那个日期 + * + * @param storeIds 店铺ID列表,多个ID用英文逗号分隔 + * @return 最晚的营业开始日期,格式为yyyy-MM-dd + */ + Date getLatestBizOpeningDate(String storeIds); + // Page getMobileStoreList(Integer page, Integer rows); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java index 559bbde2..31b92843 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java @@ -4336,6 +4336,54 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl uniqueStoreIds = Arrays.stream(storeIds.split(",")) + .map(String::trim) + .filter(StrUtil::isNotBlank) + .map(Integer::valueOf) + .distinct() + .collect(Collectors.toList()); + + // 2. 如果没有有效的店铺ID,返回null + if (uniqueStoreIds.isEmpty()) { + return null; + } + + // 3. 查询开业筹备中店铺的最晚营业开始日期 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select("MAX(store_biz_opening_date) AS store_biz_opening_date"); + queryWrapper.in("store_id", uniqueStoreIds) + .eq("store_biz_state", CommonConstant.Store_Biz_State_PreActivity) + .eq("store_is_open", CommonConstant.Enable) + .gt("store_biz_opening_date", new Date()); + + ShopStoreBase shopStoreBase = getOne(queryWrapper); + return shopStoreBase != null ? shopStoreBase.getStore_biz_opening_date() : null; + + } catch (NumberFormatException e) { + logger.warn("店铺ID解析失败: storeIds={}", storeIds, e); + return null; + } catch (Exception e) { + logger.error("查询店铺最晚营业开始日期异常: storeIds={}", storeIds, e); + return null; + } + } + + // @Override // public Page getMobileStoreList(Integer page, Integer rows) { // QueryWrapper queryWrapper=new QueryWrapper<>(); diff --git a/mall-shop/src/main/resources/mapper/store/ShopStoreBaseMapper.xml b/mall-shop/src/main/resources/mapper/store/ShopStoreBaseMapper.xml index 52529964..e0bbc023 100644 --- a/mall-shop/src/main/resources/mapper/store/ShopStoreBaseMapper.xml +++ b/mall-shop/src/main/resources/mapper/store/ShopStoreBaseMapper.xml @@ -6,7 +6,7 @@ store_id , user_id, store_name, store_grade_id, store_logo, store_slogan, store_domain, store_area, store_district_id, store_address, store_latitude, store_longitude, store_is_selfsupport, store_type, store_is_open, - store_biz_state, store_biz_opening_dtime, ringtone_is_enable, shop_parent_id, store_2nd_category_id, + store_biz_state, store_biz_opening_date, ringtone_is_enable, shop_parent_id, store_2nd_category_id, store_category_id, store_state_id, store_time, store_end_time, product_category_ids, store_o2o_tags, store_o2o_flag, store_o2o_merchant_id, store_circle, subsite_id, lkl_merchant_no, lkl_term_no, wx_qrcode, split_ratio, packing_fee, created_at, updated_at diff --git a/pom.xml b/pom.xml index 5bc7e062..01d2025e 100644 --- a/pom.xml +++ b/pom.xml @@ -308,6 +308,7 @@ https://114.132.210.208:2375 10.1.8.3:5000 /Users/panjunjie/code/docker_registry_ca_dev + false 114.132.210.208:8848 public @@ -366,6 +367,7 @@ https://114.132.210.208:2375 10.1.8.3:5000 /Users/panjunjie/code/docker_registry_ca_dev + false 114.132.210.208:8848 public @@ -418,6 +420,7 @@ https://114.132.210.208:2375 10.1.8.3:5000 /Users/panjunjie/code/docker_registry_ca_dev + false 10.1.8.3:8848 public @@ -470,6 +473,7 @@ https://159.75.249.163:2275 172.16.0.11:5000 /Users/panjunjie/code/docker_registry_ca_prod + true 172.16.0.11:8848 public @@ -556,6 +560,8 @@ ${docker.registry}/mall/${project.artifactId}:${project.version} + + ${docker.remove_old_image}