瀏覽代碼

修改配置信息

qmj 3 天之前
父節點
當前提交
062a17d217

+ 92 - 0
.test-hold/MultiStoreCheckoutBatchServiceTest.java.hold

@@ -0,0 +1,92 @@
+package com.ruoyi.app.order;
+
+import com.ruoyi.app.order.dto.MultiStoreBatchCreateRequest;
+import com.ruoyi.app.order.dto.MultiStoreQuoteRequest;
+import com.ruoyi.app.order.dto.MultiStoreQuoteView;
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.system.domain.InfoAddress;
+import com.ruoyi.system.domain.OrderCheckoutBatch;
+import com.ruoyi.system.domain.OrderParent;
+import com.ruoyi.system.domain.PosFood;
+import com.ruoyi.system.domain.PosOrder;
+import com.ruoyi.system.domain.PosStore;
+import com.ruoyi.system.mapper.FoodSpecsValueMapper;
+import com.ruoyi.system.mapper.InfoAddressMapper;
+import com.ruoyi.system.mapper.OrderCheckoutMapper;
+import com.ruoyi.system.mapper.PosFoodMapper;
+import com.ruoyi.system.mapper.PosStoreMapper;
+import com.ruoyi.system.service.IOrderParentService;
+import com.ruoyi.system.service.IPosOrderService;
+import org.junit.jupiter.api.Test;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+class MultiStoreCheckoutBatchServiceTest {
+    private final MultiStoreCheckoutQuoteService quotes = mock(MultiStoreCheckoutQuoteService.class);
+    private final OrderCheckoutMapper checkout = mock(OrderCheckoutMapper.class);
+    private final IOrderParentService parents = mock(IOrderParentService.class);
+    private final IPosOrderService orders = mock(IPosOrderService.class);
+    private final InfoAddressMapper addresses = mock(InfoAddressMapper.class);
+    private final PosStoreMapper stores = mock(PosStoreMapper.class);
+    private final PosFoodMapper foods = mock(PosFoodMapper.class);
+    private final FoodSpecsValueMapper values = mock(FoodSpecsValueMapper.class);
+    private final OrderPromotionHelper promotions = mock(OrderPromotionHelper.class);
+
+    private MultiStoreCheckoutBatchService subject() {
+        return new MultiStoreCheckoutBatchService(quotes, checkout, parents, orders,
+                addresses, stores, foods, values, promotions);
+    }
+
+    @Test
+    void createsHiddenUnpaidChildrenWithoutOpeningFulfilment() {
+        MultiStoreQuoteRequest requested = new MultiStoreQuoteRequest(10L, true, List.of(
+                new MultiStoreQuoteRequest.Store(1L, null, List.of(new MultiStoreQuoteRequest.Item(11L, 1, List.of())), null, null),
+                new MultiStoreQuoteRequest.Store(2L, null, List.of(new MultiStoreQuoteRequest.Item(22L, 1, List.of())), null, null)));
+        when(quotes.loadSnapshot("quote", 42L)).thenReturn(
+                new MultiStoreCheckoutQuoteService.QuoteSnapshot(42L, requested, "fingerprint", Long.MAX_VALUE));
+        when(quotes.quote(requested, 42L)).thenReturn(new MultiStoreQuoteView("other", Long.MAX_VALUE,
+                7L, 1L, 1000, List.of(1L, 2L), List.of(
+                new MultiStoreQuoteView.StorePrice(1L, new BigDecimal("50"), new BigDecimal("50"),
+                        new BigDecimal("40"), new BigDecimal("36"), new BigDecimal("86"), List.of("1")),
+                new MultiStoreQuoteView.StorePrice(2L, new BigDecimal("60"), new BigDecimal("60"),
+                        new BigDecimal("40"), new BigDecimal("36"), new BigDecimal("96"), List.of("1"))),
+                List.of(), new BigDecimal("0.9"), "fingerprint"));
+        InfoAddress address = new InfoAddress(); address.setId(10L); address.setUserId(42L);
+        when(addresses.selectById(10L)).thenReturn(address);
+        for (int id : List.of(1, 2)) {
+            PosStore store = new PosStore(); store.setId(id); store.setUserId((long) id);
+            when(stores.selectById((long) id)).thenReturn(store);
+            PosFood food = new PosFood(); food.setId(id == 1 ? 11L : 22L);
+            food.setPrice(new BigDecimal(id == 1 ? "50" : "60")); food.setName("meal");
+            when(foods.selectById(food.getId())).thenReturn(food);
+        }
+        when(checkout.insertOrGetBatch(any(OrderCheckoutBatch.class))).thenAnswer(call -> {
+            OrderCheckoutBatch row = call.getArgument(0); row.setId(100L); return 1;
+        });
+        when(checkout.selectBatchById(100L)).thenAnswer(call -> created);
+        when(orders.save(any(PosOrder.class))).thenAnswer(call -> {
+            PosOrder order = call.getArgument(0); order.setId(order.getMdId()); return true;
+        });
+
+        MultiStoreCheckoutBatchService.BatchCreated result = subject().create(
+                new MultiStoreBatchCreateRequest("request-1", "quote", List.of(1L, 2L)), 42L);
+
+        assertEquals(100L, result.batchId());
+        assertEquals("PENDING", result.status());
+        assertEquals(2, result.members().size());
+        assertFalse(result.members().get(0).payType() != null);
+        verify(parents).save(any(OrderParent.class));
+        verify(checkout).insertGroup(any());
+    }
+
+    private OrderCheckoutBatch created;
+}

+ 10 - 0
.test-hold/README.md

@@ -0,0 +1,10 @@
+# 暂存的未完成测试(2026-10-14)
+
+`MultiStoreCheckoutBatchServiceTest.java` 来自另一个会话(036 多店结算,进行中),
+引用的 `com.ruoyi.app.order.dto.MultiStore*` 等 DTO 尚未创建,会导致整模块 test-compile 失败。
+按用户要求先排除出编译范围;文件内容一字未改(字节原样)。
+
+**还原方法**(等 036 的 DTO 就绪后):
+
+    git mv --force 不可用(该文件未跟踪),直接移动:
+    move .test-hold\ MultiStoreCheckoutBatchServiceTest.java.hold ruoyi-admin\src\test\java\com\ruoyi\app\order\MultiStoreCheckoutBatchServiceTest.java

+ 3 - 3
ruoyi-admin/src/main/resources/application.yml

@@ -117,19 +117,19 @@ oauth:
     user:
       client-id: "2010911071"
       client-secret: "880fb850c17a3399d207100144a1cb67"
-      redirect-uri: https://foodieapi.waimai-paotui.com/auth/line/callback?provider=line_user
+      redirect-uri: https://api.awayqtw.com/auth/line/callback?provider=line_user
       app-redirect: com.twanmsdyh.app://pages/UserCenter/oauthLogin
     rider:
       # 恰恰吃骑手;Android 包名 com.twanmsdqs.app;SHA1 61:DC:40:A2:00:9B:EE:9B:9A:09:A7:09:E8:6A:BD:D2:31:E3:7C:D2
       client-id: "2011397520"
       client-secret: "b22b413b21bfb46803420ff174cff29f"
-      redirect-uri: https://foodieapi.waimai-paotui.com/auth/line/callback?provider=line_rider
+      redirect-uri: https://api.awayqtw.com/auth/line/callback?provider=line_rider
       app-redirect: com.twanmsdqs.app://pages/UserCenter/oauthLogin
     merchant:
       # 恰恰吃商家;Android 包名 com.twanmsdsj.app;SHA1 7D:29:6A:ED:F8:DD:BF:F5:A3:15:3F:6E:A2:7E:D2:22:53:79:D1:77
       client-id: "2011397463"
       client-secret: "cdfacbd327fec9b4ae8dbd27dbd2788c"
-      redirect-uri: https://foodieapi.waimai-paotui.com/auth/line/callback?provider=line_merchant
+      redirect-uri: https://api.awayqtw.com/auth/line/callback?provider=line_merchant
       app-redirect: com.twanmsdsj.app://pages/UserCenter/oauthLogin
 
 # 开发环境配置