|
@@ -11,6 +11,7 @@ import java.util.concurrent.ArrayBlockingQueue; |
|
@@ -11,6 +11,7 @@ import java.util.concurrent.ArrayBlockingQueue; |
11
|
import java.util.concurrent.ExecutorService;
|
11
|
import java.util.concurrent.ExecutorService;
|
12
|
import java.util.concurrent.ThreadPoolExecutor;
|
12
|
import java.util.concurrent.ThreadPoolExecutor;
|
13
|
import java.util.concurrent.TimeUnit;
|
13
|
import java.util.concurrent.TimeUnit;
|
|
|
14
|
+import java.util.function.Consumer;
|
14
|
import java.util.stream.Collectors;
|
15
|
import java.util.stream.Collectors;
|
15
|
|
16
|
|
16
|
import javax.annotation.Resource;
|
17
|
import javax.annotation.Resource;
|
|
@@ -300,19 +301,32 @@ public class AppraiseService { |
|
@@ -300,19 +301,32 @@ public class AppraiseService { |
300
|
}
|
301
|
}
|
301
|
|
302
|
|
302
|
private void deliveryDepositGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder) {
|
303
|
private void deliveryDepositGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder) {
|
303
|
- expressInfoService.deliverGoods(buyerOrder.getUid(),
|
|
|
304
|
- appraiseExpressInfoBo.getExpressCompanyId(),
|
|
|
305
|
- buyerOrder.getOrderCode(),
|
|
|
306
|
- appraiseExpressInfoBo.getWayBillCode(),
|
|
|
307
|
- appraiseExpressInfoBo.getDepotNum(),
|
|
|
308
|
- appraiseExpressInfoBo.getMobile());
|
|
|
309
|
- // 通知买家已发货
|
|
|
310
|
- buyerNoticeFacade.deliveryDepositGoodsToBuyer(buyerOrder.getUid(), appraiseExpressInfoBo.getWayBillCode(),
|
|
|
311
|
- () -> cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(), buyerOrder.getUid(), buyerOrder.getSellerUid()),
|
|
|
312
|
- sellerOrderGoods -> Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null));
|
304
|
+ if(buyerOrder.getStatus() == OrderStatus.DONE.getCode()){
|
|
|
305
|
+ expressInfoService.deliverGoods(buyerOrder.getUid(),
|
|
|
306
|
+ appraiseExpressInfoBo.getExpressCompanyId(),
|
|
|
307
|
+ buyerOrder.getOrderCode(),
|
|
|
308
|
+ appraiseExpressInfoBo.getWayBillCode(),
|
|
|
309
|
+ appraiseExpressInfoBo.getDepotNum(),
|
|
|
310
|
+ appraiseExpressInfoBo.getMobile());
|
|
|
311
|
+ // 通知买家已发货
|
|
|
312
|
+ buyerNoticeFacade.deliveryDepositGoodsToBuyer(buyerOrder.getUid(), appraiseExpressInfoBo.getWayBillCode(),
|
|
|
313
|
+ () -> cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(), buyerOrder.getUid(), buyerOrder.getSellerUid()),
|
|
|
314
|
+ sellerOrderGoods -> Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null));
|
|
|
315
|
+ }
|
|
|
316
|
+ // 买家接受瑕疵,走非寄存流程
|
|
|
317
|
+ else if (buyerOrder.getStatus() == OrderStatus.MINI_FAULT_ACCEPT.getCode()) {
|
|
|
318
|
+ deliveryNonDepositGoodsToBuyerAndRun(appraiseExpressInfoBo,buyerOrder,sog -> {
|
|
|
319
|
+ // 通知买家已发货
|
|
|
320
|
+ buyerNoticeFacade.deliveryDepositGoodsToBuyer(buyerOrder.getUid(), appraiseExpressInfoBo.getWayBillCode(), sog,
|
|
|
321
|
+ sellerOrderGoods -> Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null));
|
|
|
322
|
+ });
|
|
|
323
|
+ } else {
|
|
|
324
|
+ LOGGER.warn("in deliveryGoodsToBuyer, buyer Deposit Order orderCode {}", buyerOrder.getOrderCode());
|
|
|
325
|
+ throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
|
|
|
326
|
+ }
|
313
|
}
|
327
|
}
|
314
|
|
328
|
|
315
|
- private void deliveryNonDepositGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder) {
|
329
|
+ private void deliveryNonDepositGoodsToBuyerAndRun(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder, Consumer<SellerOrderGoods> run) {
|
316
|
final Long orderCode = buyerOrder.getOrderCode();
|
330
|
final Long orderCode = buyerOrder.getOrderCode();
|
317
|
final OrderStatus expectOrderStatus;
|
331
|
final OrderStatus expectOrderStatus;
|
318
|
final OrderStatus targetOrderStatus = OrderStatus.WAITING_RECEIVE;
|
332
|
final OrderStatus targetOrderStatus = OrderStatus.WAITING_RECEIVE;
|
|
@@ -346,11 +360,12 @@ public class AppraiseService { |
|
@@ -346,11 +360,12 @@ public class AppraiseService { |
346
|
});
|
360
|
});
|
347
|
//记录订单的状态变更信息
|
361
|
//记录订单的状态变更信息
|
348
|
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetOrderStatus.getCode());
|
362
|
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetOrderStatus.getCode());
|
349
|
-
|
|
|
350
|
//清缓存
|
363
|
//清缓存
|
351
|
SellerOrderGoods sellerOrderGoods = cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(), buyerOrder.getUid(), buyerOrder.getSellerUid());
|
364
|
SellerOrderGoods sellerOrderGoods = cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(), buyerOrder.getUid(), buyerOrder.getSellerUid());
|
352
|
- Product product = Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
|
|
|
353
|
- buyerNoticeFacade.deliveryGoodsToBuyer(buyerOrder, sellerOrderGoods, product);
|
365
|
+ if(Objects.nonNull(run)){
|
|
|
366
|
+ run.accept(sellerOrderGoods);
|
|
|
367
|
+ }
|
|
|
368
|
+
|
354
|
} else {
|
369
|
} else {
|
355
|
LOGGER.warn("in deliveryGoodsToBuyer update status number zero, buyer Order orderCode {} pstatus {}, expect Order Status {}",
|
370
|
LOGGER.warn("in deliveryGoodsToBuyer update status number zero, buyer Order orderCode {} pstatus {}, expect Order Status {}",
|
356
|
orderCode, buyerOrder.getStatus(), expectOrderStatus);
|
371
|
orderCode, buyerOrder.getStatus(), expectOrderStatus);
|
|
@@ -358,6 +373,13 @@ public class AppraiseService { |
|
@@ -358,6 +373,13 @@ public class AppraiseService { |
358
|
}
|
373
|
}
|
359
|
}
|
374
|
}
|
360
|
|
375
|
|
|
|
376
|
+ private void deliveryNonDepositGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder) {
|
|
|
377
|
+ deliveryNonDepositGoodsToBuyerAndRun(appraiseExpressInfoBo, buyerOrder, sellerOrderGoods -> {
|
|
|
378
|
+ Product product = Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
|
|
|
379
|
+ buyerNoticeFacade.deliveryGoodsToBuyer(buyerOrder, sellerOrderGoods, product);
|
|
|
380
|
+ });
|
|
|
381
|
+ }
|
|
|
382
|
+
|
361
|
/**
|
383
|
/**
|
362
|
* 鉴定不通过退回
|
384
|
* 鉴定不通过退回
|
363
|
* (1)记录物流
|
385
|
* (1)记录物流
|