|
|
@@ -72,7 +72,7 @@ class MultiStoreCheckoutQueryServiceTest {
|
|
|
when(mapper.selectMembersForBatches(List.of(7L))).thenReturn(List.of(
|
|
|
member(7L, 71L, 3L, "ONLINE_PAID", 100, 100), unpicked));
|
|
|
|
|
|
- MultiStoreCardView detail = service.groupDetail(4L, 33L, 1000L);
|
|
|
+ MultiStoreCardView detail = service.groupDetail(4L, 33L, 1000L, null, null);
|
|
|
|
|
|
assertEquals("toPickup", detail.getPrimaryTab());
|
|
|
assertEquals(1, detail.getPickedUpCount());
|
|
|
@@ -90,7 +90,7 @@ class MultiStoreCheckoutQueryServiceTest {
|
|
|
when(mapper.selectMembersForBatches(List.of(7L)))
|
|
|
.thenReturn(List.of(member(7L, 71L, 3L, "ONLINE_PAID", 100, 100)));
|
|
|
|
|
|
- assertEquals("completed", service.groupDetail(4L, 33L, 1000L).getPrimaryTab());
|
|
|
+ assertEquals("completed", service.groupDetail(4L, 33L, 1000L, null, null).getPrimaryTab());
|
|
|
|
|
|
CheckoutCardRow cancelled = card("GROUP", 5L, "GROUP:5");
|
|
|
cancelled.setBatchId(8L);
|
|
|
@@ -100,7 +100,7 @@ class MultiStoreCheckoutQueryServiceTest {
|
|
|
cancelledMember.setState(4L);
|
|
|
when(mapper.selectMembersForBatches(List.of(8L))).thenReturn(List.of(cancelledMember));
|
|
|
|
|
|
- assertEquals("cancelled", service.groupDetail(5L, 33L, 1000L).getPrimaryTab());
|
|
|
+ assertEquals("cancelled", service.groupDetail(5L, 33L, 1000L, null, null).getPrimaryTab());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
@@ -222,7 +222,7 @@ class MultiStoreCheckoutQueryServiceTest {
|
|
|
when(ordinaryOrders.listByIds(List.of(71L))).thenReturn(List.of(order));
|
|
|
|
|
|
var detail = new com.fasterxml.jackson.databind.ObjectMapper().valueToTree(
|
|
|
- service.groupDetail(4L, 33L, 1000L));
|
|
|
+ service.groupDetail(4L, 33L, 1000L, null, null));
|
|
|
var member = detail.path("members").get(0);
|
|
|
assertTrue(member.has("juli"));
|
|
|
assertTrue(member.path("juli").isNull()); // 与旧普通订单详情一样,未传定位时为空。
|
|
|
@@ -230,6 +230,26 @@ class MultiStoreCheckoutQueryServiceTest {
|
|
|
assertEquals(5.0, member.path("legacyOrder").path("jvli").asDouble());
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void groupDetailComputesMemberJuliFromRequestCoords() {
|
|
|
+ CheckoutCardRow group = card("GROUP", 4L, "GROUP:4");
|
|
|
+ group.setBatchId(7L);
|
|
|
+ group.setGroupStatus("ACCEPTED");
|
|
|
+ when(mapper.selectGroupForRider(4L, 33L, 1000L)).thenReturn(group);
|
|
|
+ when(mapper.selectMembersForBatches(List.of(7L)))
|
|
|
+ .thenReturn(List.of(member(7L, 71L, 1L, "COD_CONFIRMED", 80, 0)));
|
|
|
+ PosOrder order = new PosOrder();
|
|
|
+ order.setId(71L);
|
|
|
+ order.setLongitude(new BigDecimal("108.30"));
|
|
|
+ order.setLatitude(new BigDecimal("22.90"));
|
|
|
+ when(ordinaryOrders.listByIds(List.of(71L))).thenReturn(List.of(order));
|
|
|
+
|
|
|
+ MultiStoreCardView detail = service.groupDetail(4L, 33L, 1000L,
|
|
|
+ new BigDecimal("108.30"), new BigDecimal("22.90"));
|
|
|
+
|
|
|
+ assertEquals(0.0, detail.getMembers().get(0).getJuli());
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
void invalidPaginationIsRejectedBeforeQuery() {
|
|
|
try (org.mockito.MockedStatic<com.ruoyi.common.utils.MessageUtils> messages =
|