|
|
@@ -113,6 +113,8 @@ class OrderAppServiceImplTest
|
|
113
|
113
|
when(orderItemMapper.selectByOrderIds(Collections.singletonList(ORDER_ID)))
|
|
114
|
114
|
.thenReturn(java.util.Arrays.asList(item1, item2));
|
|
115
|
115
|
when(reviewMapper.selectByOrderIds(Collections.singletonList(ORDER_ID))).thenReturn(Collections.emptyList());
|
|
|
116
|
+ when(aftersaleMapper.selectAftersaleStatusByOrderIds(Collections.singletonList(ORDER_ID)))
|
|
|
117
|
+ .thenReturn(Collections.emptyList());
|
|
116
|
118
|
when(shopMapper.selectById(10L)).thenReturn(null);
|
|
117
|
119
|
when(orderAppSupport.toStatusText(order.getOrderStatus())).thenReturn("待付款");
|
|
118
|
120
|
when(orderAppSupport.toItemSummary(item1)).thenReturn(summary(item1));
|
|
|
@@ -133,6 +135,76 @@ class OrderAppServiceImplTest
|
|
133
|
135
|
assertEquals(row.getItems().get(0), row.getFirstItem());
|
|
134
|
136
|
}
|
|
135
|
137
|
|
|
|
138
|
+ @Test
|
|
|
139
|
+ void list_withInProgressAftersale_setsAftersaleStatus()
|
|
|
140
|
+ {
|
|
|
141
|
+ when(memberFacade.isMemberEnabled(MEMBER_ID)).thenReturn(true);
|
|
|
142
|
+ BizOrder order = pendingOrder();
|
|
|
143
|
+ order.setOrderStatus(OrderConstants.STATUS_PENDING_SHIP);
|
|
|
144
|
+ order.setShopId(10L);
|
|
|
145
|
+ when(orderMapper.selectMemberAppList(eq(MEMBER_ID), any())).thenReturn(Collections.singletonList(order));
|
|
|
146
|
+ when(orderItemMapper.selectByOrderIds(Collections.singletonList(ORDER_ID)))
|
|
|
147
|
+ .thenReturn(Collections.singletonList(singleItem()));
|
|
|
148
|
+ when(reviewMapper.selectByOrderIds(Collections.singletonList(ORDER_ID))).thenReturn(Collections.emptyList());
|
|
|
149
|
+ com.ruoyi.web.modules.order.dto.OrderAftersaleStatusRow statusRow =
|
|
|
150
|
+ new com.ruoyi.web.modules.order.dto.OrderAftersaleStatusRow();
|
|
|
151
|
+ statusRow.setOrderId(ORDER_ID);
|
|
|
152
|
+ statusRow.setAftersaleStatus(OrderAppConstants.AFTERSALE_STATUS_IN_PROGRESS);
|
|
|
153
|
+ when(aftersaleMapper.selectAftersaleStatusByOrderIds(Collections.singletonList(ORDER_ID)))
|
|
|
154
|
+ .thenReturn(Collections.singletonList(statusRow));
|
|
|
155
|
+ when(shopMapper.selectById(10L)).thenReturn(null);
|
|
|
156
|
+ when(orderAppSupport.toStatusText(order.getOrderStatus())).thenReturn("待发货");
|
|
|
157
|
+ when(orderAppSupport.toItemSummary(any())).thenReturn(new com.ruoyi.web.modules.order.vo.OrderAppItemSummaryVO());
|
|
|
158
|
+ when(orderAppSupport.indexReviewsByItemId(any(), any())).thenReturn(Collections.emptyMap());
|
|
|
159
|
+ when(orderAppSupport.calcPayRemainSeconds(order)).thenReturn(0L);
|
|
|
160
|
+ when(orderAppSupport.resolveReviewStatus(eq(order), any(), any()))
|
|
|
161
|
+ .thenReturn(OrderAppConstants.REVIEW_STATUS_NONE);
|
|
|
162
|
+ when(orderAppSupport.resolveActions(order)).thenReturn(Collections.emptyList());
|
|
|
163
|
+
|
|
|
164
|
+ com.ruoyi.web.modules.order.vo.OrderAppListRowVO row =
|
|
|
165
|
+ orderAppService.list(MEMBER_ID, new com.ruoyi.web.modules.order.dto.OrderAppListQueryDTO()).get(0);
|
|
|
166
|
+
|
|
|
167
|
+ assertEquals("待发货", row.getOrderStatusText());
|
|
|
168
|
+ assertEquals(OrderAppConstants.AFTERSALE_STATUS_IN_PROGRESS, row.getAftersaleStatus());
|
|
|
169
|
+ }
|
|
|
170
|
+
|
|
|
171
|
+ @Test
|
|
|
172
|
+ void list_withoutAftersale_aftersaleStatusNull()
|
|
|
173
|
+ {
|
|
|
174
|
+ when(memberFacade.isMemberEnabled(MEMBER_ID)).thenReturn(true);
|
|
|
175
|
+ BizOrder order = pendingOrder();
|
|
|
176
|
+ order.setShopId(10L);
|
|
|
177
|
+ when(orderMapper.selectMemberAppList(eq(MEMBER_ID), any())).thenReturn(Collections.singletonList(order));
|
|
|
178
|
+ when(orderItemMapper.selectByOrderIds(Collections.singletonList(ORDER_ID)))
|
|
|
179
|
+ .thenReturn(Collections.singletonList(singleItem()));
|
|
|
180
|
+ when(reviewMapper.selectByOrderIds(Collections.singletonList(ORDER_ID))).thenReturn(Collections.emptyList());
|
|
|
181
|
+ when(aftersaleMapper.selectAftersaleStatusByOrderIds(Collections.singletonList(ORDER_ID)))
|
|
|
182
|
+ .thenReturn(Collections.emptyList());
|
|
|
183
|
+ when(shopMapper.selectById(10L)).thenReturn(null);
|
|
|
184
|
+ when(orderAppSupport.toStatusText(order.getOrderStatus())).thenReturn("待付款");
|
|
|
185
|
+ when(orderAppSupport.toItemSummary(any())).thenReturn(new com.ruoyi.web.modules.order.vo.OrderAppItemSummaryVO());
|
|
|
186
|
+ when(orderAppSupport.indexReviewsByItemId(any(), any())).thenReturn(Collections.emptyMap());
|
|
|
187
|
+ when(orderAppSupport.calcPayRemainSeconds(order)).thenReturn(3600L);
|
|
|
188
|
+ when(orderAppSupport.resolveReviewStatus(eq(order), any(), any()))
|
|
|
189
|
+ .thenReturn(OrderAppConstants.REVIEW_STATUS_NONE);
|
|
|
190
|
+ when(orderAppSupport.resolveActions(order)).thenReturn(Collections.emptyList());
|
|
|
191
|
+
|
|
|
192
|
+ com.ruoyi.web.modules.order.vo.OrderAppListRowVO row =
|
|
|
193
|
+ orderAppService.list(MEMBER_ID, new com.ruoyi.web.modules.order.dto.OrderAppListQueryDTO()).get(0);
|
|
|
194
|
+
|
|
|
195
|
+ assertEquals(null, row.getAftersaleStatus());
|
|
|
196
|
+ }
|
|
|
197
|
+
|
|
|
198
|
+ private BizOrderItem singleItem()
|
|
|
199
|
+ {
|
|
|
200
|
+ BizOrderItem item = new BizOrderItem();
|
|
|
201
|
+ item.setItemId(1L);
|
|
|
202
|
+ item.setOrderId(ORDER_ID);
|
|
|
203
|
+ item.setGoodsId(101L);
|
|
|
204
|
+ item.setGoodsName("商品A");
|
|
|
205
|
+ return item;
|
|
|
206
|
+ }
|
|
|
207
|
+
|
|
136
|
208
|
private com.ruoyi.web.modules.order.vo.OrderAppItemSummaryVO summary(BizOrderItem item)
|
|
137
|
209
|
{
|
|
138
|
210
|
com.ruoyi.web.modules.order.vo.OrderAppItemSummaryVO vo =
|