浏览代码

订单表字段修改

zhangchen 1 月之前
父节点
当前提交
f445b6c99f

+ 38 - 17
alien-store/src/main/java/shop/alien/store/service/impl/ReservationOrderPageServiceImpl.java

@@ -26,6 +26,7 @@ public class ReservationOrderPageServiceImpl implements ReservationOrderPageServ
 
     private static final int PAYMENT_DEADLINE_MINUTES = 15;
     private static final int ORDER_STATUS_UNPAID = 0;
+    private static final int ORDER_STATUS_TO_USE = 1;
     private static final int CANCELLATION_FREE = 0;
     private static final int CANCELLATION_NOT_FREE = 1;
     private static final int CANCELLATION_CONDITIONAL = 2;
@@ -64,8 +65,22 @@ public class ReservationOrderPageServiceImpl implements ReservationOrderPageServ
         vo.setPaymentSecondsLeft(secondsLeft);
         vo.setCanContinuePay(Boolean.valueOf(ORDER_STATUS_UNPAID == order.getOrderStatus() && secondsLeft > 0));
 
-        // 页面标题后缀
-        vo.setPageTitleSuffix(buildPageTitleSuffix(order.getCancellationPolicyType()));
+        // 页面标题:待支付 / 预订成功(待使用兼容预订成功页)
+        Integer orderStatus = order.getOrderStatus();
+        if (ORDER_STATUS_UNPAID == orderStatus) {
+            vo.setPageTitle("待支付");
+            vo.setPageTitleSuffix(buildPendingPaymentTitleSuffix(order.getCancellationPolicyType()));
+        } else if (ORDER_STATUS_TO_USE == orderStatus) {
+            vo.setPageTitle("预订成功");
+            vo.setPageTitleSuffix(buildSuccessPageTitleSuffix(order.getCancellationPolicyType()));
+        } else {
+            vo.setPageTitle(null);
+            vo.setPageTitleSuffix(buildPendingPaymentTitleSuffix(order.getCancellationPolicyType()));
+        }
+
+        // 操作按钮:取消预订、修改预订
+        vo.setCanCancelReservation(Boolean.valueOf(ORDER_STATUS_UNPAID == orderStatus || ORDER_STATUS_TO_USE == orderStatus));
+        vo.setCanModifyReservation(Boolean.valueOf(ORDER_STATUS_TO_USE == orderStatus));
 
         // 门店
         if (storeId != null) {
@@ -115,11 +130,14 @@ public class ReservationOrderPageServiceImpl implements ReservationOrderPageServ
         vo.setVerificationCode(order.getVerificationCode());
         vo.setVerificationUrl(order.getVerificationUrl());
 
-        // 预订说明
-        vo.setLateArrivalGraceMinutes(order.getLateArrivalGraceMinutes() != null ? order.getLateArrivalGraceMinutes() : 0);
-        vo.setSeatRetentionText(order.getLateArrivalGraceMinutes() != null && order.getLateArrivalGraceMinutes() > 0
-                ? "未按时到店座位保留" + order.getLateArrivalGraceMinutes() + "分钟"
-                : null);
+        // 预订说明(待支付与待使用页面共用)
+        Integer graceMinutes = order.getLateArrivalGraceMinutes() != null ? order.getLateArrivalGraceMinutes() : 0;
+        vo.setLateArrivalGraceMinutes(graceMinutes);
+        if (graceMinutes != null && graceMinutes > 0) {
+            vo.setSeatRetentionText("未按时到店座位保留" + graceMinutes + "分钟");
+        } else {
+            vo.setSeatRetentionText("未按时到店座位将不会保留");
+        }
         vo.setDepositAmount(order.getDepositAmount());
         vo.setDepositText(order.getDepositAmount() != null && order.getDepositAmount().compareTo(BigDecimal.ZERO) > 0
                 ? "需支付¥" + order.getDepositAmount().stripTrailingZeros().toPlainString() + "订金"
@@ -159,19 +177,22 @@ public class ReservationOrderPageServiceImpl implements ReservationOrderPageServ
         return diff > 0 ? (int) diff : 0;
     }
 
-    private String buildPageTitleSuffix(Integer cancellationPolicyType) {
-        if (cancellationPolicyType == null) {
-            return "不可免责取消";
-        }
-        if (cancellationPolicyType == CANCELLATION_FREE) {
-            return "免费预订";
-        }
-        if (cancellationPolicyType == CANCELLATION_CONDITIONAL) {
-            return "分情况是否免责";
-        }
+    /** 待支付页标题后缀 */
+    private String buildPendingPaymentTitleSuffix(Integer cancellationPolicyType) {
+        if (cancellationPolicyType == null) return "不可免责取消";
+        if (cancellationPolicyType == CANCELLATION_FREE) return "免费预订";
+        if (cancellationPolicyType == CANCELLATION_CONDITIONAL) return "分情况是否免责";
         return "不可免责取消";
     }
 
+    /** 预订成功页标题后缀(待使用状态) */
+    private String buildSuccessPageTitleSuffix(Integer cancellationPolicyType) {
+        if (cancellationPolicyType == null) return "不可免责";
+        if (cancellationPolicyType == CANCELLATION_FREE) return "免费预订";
+        if (cancellationPolicyType == CANCELLATION_CONDITIONAL) return "分情况是否免责";
+        return "不可免责";
+    }
+
     private String buildDiningTimeSlot(String startTime, String endTime) {
         if (startTime == null && endTime == null) return null;
         if (startTime != null && endTime != null) return startTime + "-" + endTime;

+ 12 - 3
alien-store/src/main/java/shop/alien/store/vo/ReservationOrderPageVo.java

@@ -9,8 +9,8 @@ import java.math.BigDecimal;
 import java.util.Date;
 
 /**
- * 预订订单页面展示 VO(待支付详情页:门店、预订信息、支付倒计时、使用凭证、预订说明、订单信息
- * 通过 store_id + order_id 或 order_sn 查询
+ * 预订订单页面展示 VO(兼容「待支付」与「预订成功/待使用」两种页面
+ * 按订单ID查询,根据 orderStatus 展示待支付或预订成功内容。
  *
  * @author system
  */
@@ -30,7 +30,10 @@ public class ReservationOrderPageVo {
     @ApiModelProperty(value = "支付状态 0:未支付 1:已支付 2:已退款")
     private Integer paymentStatus;
 
-    @ApiModelProperty(value = "页面标题后缀:不可免责取消 / 分情况是否免责")
+    @ApiModelProperty(value = "页面主标题:待支付 / 预订成功(前端据此区分待支付页与预订成功页)")
+    private String pageTitle;
+
+    @ApiModelProperty(value = "页面标题后缀:待支付时为「不可免责取消/分情况是否免责」;预订成功时为「免费预订/不可免责/分情况是否免责」")
     private String pageTitleSuffix;
 
     // --------- 支付倒计时(待支付时有效) ---------
@@ -145,4 +148,10 @@ public class ReservationOrderPageVo {
 
     @ApiModelProperty(value = "是否可继续支付(待支付且未超时)")
     private Boolean canContinuePay;
+
+    @ApiModelProperty(value = "是否显示「取消预订」按钮(待支付、待使用时为 true)")
+    private Boolean canCancelReservation;
+
+    @ApiModelProperty(value = "是否显示「修改预订」按钮(待使用时为 true)")
+    private Boolean canModifyReservation;
 }