ソースを参照

update[litemall-db]: 订单状态码和用户操作的映射关系调整。

Junling Bu 7 年 前
コミット
dbd5eb7e58

+ 47 - 16
litemall-db/src/main/java/org/linlinjava/litemall/db/util/OrderUtil.java

@@ -10,17 +10,15 @@ import java.util.List;
  * 订单流程:下单成功-》支付订单-》发货-》收货
  * 订单状态:
  * 101 订单生成,未支付;102,下单未支付用户取消;103,下单未支付超期系统自动取消
- * 201 支付完成,商家未发货;202,订单生产,已付款未发货,却取消
+ * 201 支付完成,商家未发货;202,订单生产,已付款未发货,用户申请退款;203,管理员执行退款操作,确认退款成功;
  * 301 商家发货,用户未确认;
  * 401 用户确认收货,订单结束; 402 用户没有确认收货,但是快递反馈已收获后,超过一定时间,系统自动确认收货,订单结束。
  *
- * 当101用户未付款时,此时用户可以进行的操作是取消订单,或者付款操作
- * 当201支付完成而商家未发货时,此时用户可以取消订单并申请退款
- * 当301商家已发货时,此时用户可以有确认收货的操作
- * 当401用户确认收货以后,此时用户可以进行的操作是删除订单,评价商品,或者再次购买
- * 当402系统自动确认收货以后,此时用户可以删除订单,评价商品,或者再次购买
- *
- * 目前不支持订单退货
+ * 当101用户未付款时,此时用户可以进行的操作是取消或者付款
+ * 当201支付完成而商家未发货时,此时用户可以退款
+ * 当301商家已发货时,此时用户可以有确认收货
+ * 当401用户确认收货以后,此时用户可以进行的操作是退货、删除、去评价或者再次购买
+ * 当402系统自动确认收货以后,此时用户可以删除、去评价、或者再次购买
  */
 public class OrderUtil {
 
@@ -55,8 +53,11 @@ public class OrderUtil {
         }
 
         if (status == 202) {
-            // 进一步跟踪退款状态
-            return "已取消,退款中";
+            return "订单取消,退款中";
+        }
+
+        if (status == 203) {
+            return "已退款";
         }
 
         if (status == 301) {
@@ -87,16 +88,17 @@ public class OrderUtil {
         else if (status == 102 || status == 103) {
             // 如果订单已经取消或是已完成,则可删除
             handleOption.setDelete(true);
-            handleOption.setRebuy(true);
         }
         else if (status == 201) {
-            // 如果订单已付款,没有发货,则可退款操作
+            // 如果订单已付款,没有发货,则可退款
             handleOption.setRefund(true);
         }
         else if (status == 202) {
-            // 如果订单已经取消或是已完成,则可删除
+            // 如果订单申请退款中,没有相关操作
+        }
+        else if (status == 203) {
+            // 如果订单已经退款,则可删除
             handleOption.setDelete(true);
-            handleOption.setRebuy(true);
         }
         else if (status == 301) {
             // 如果订单已经发货,没有收货,则可收货操作,
@@ -104,7 +106,7 @@ public class OrderUtil {
             handleOption.setConfirm(true);
         }
         else if (status ==  401 || status == 402) {
-            // 如果订单已经支付,且已经收货,则可完成交易、评论和再次购买
+            // 如果订单已经支付,且已经收货,则可删除、去评论和再次购买
             handleOption.setDelete(true);
             handleOption.setComment(true);
             handleOption.setRebuy(true);
@@ -139,7 +141,8 @@ public class OrderUtil {
         else if (showType.equals(4)) {
             // 待评价订单
             status.add((short)401);
-            status.add((short)401);
+//            系统超时自动取消,此时应该不支持评价
+//            status.add((short)402);
         }
         else {
             return null;
@@ -149,6 +152,10 @@ public class OrderUtil {
     }
 
 
+    public static boolean isCreateStatus(LitemallOrder litemallOrder) {
+        return OrderUtil.STATUS_CREATE == litemallOrder.getOrderStatus().shortValue();
+    }
+
     public static boolean isPayStatus(LitemallOrder litemallOrder) {
         return OrderUtil.STATUS_PAY == litemallOrder.getOrderStatus().shortValue();
     }
@@ -156,4 +163,28 @@ public class OrderUtil {
     public static boolean isShipStatus(LitemallOrder litemallOrder) {
         return OrderUtil.STATUS_SHIP == litemallOrder.getOrderStatus().shortValue();
     }
+
+    public static boolean isConfirmStatus(LitemallOrder litemallOrder) {
+        return OrderUtil.STATUS_CONFIRM == litemallOrder.getOrderStatus().shortValue();
+    }
+
+    public static boolean isCancelStatus(LitemallOrder litemallOrder) {
+        return OrderUtil.STATUS_CANCEL == litemallOrder.getOrderStatus().shortValue();
+    }
+
+    public static boolean isAutoCancelStatus(LitemallOrder litemallOrder) {
+        return OrderUtil.STATUS_AUTO_CANCEL == litemallOrder.getOrderStatus().shortValue();
+    }
+
+    public static boolean isRefundStatus(LitemallOrder litemallOrder) {
+        return OrderUtil.STATUS_REFUND == litemallOrder.getOrderStatus().shortValue();
+    }
+
+    public static boolean isRefundConfirmStatus(LitemallOrder litemallOrder) {
+        return OrderUtil.STATUS_REFUND_CONFIRM == litemallOrder.getOrderStatus().shortValue();
+    }
+
+    public static boolean isAutoConfirmStatus(LitemallOrder litemallOrder) {
+        return OrderUtil.STATUS_AUTO_CONFIRM == litemallOrder.getOrderStatus().shortValue();
+    }
 }