...
|
...
|
@@ -112,13 +112,15 @@ public class SellerOrderViewService { |
|
|
Integer cnt = orderCacheService.getOrderSummary(uid, TabType.SELL, businessClient);
|
|
|
if (cnt == null) {
|
|
|
final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
|
|
|
//set number of seller goods
|
|
|
int num = getSellerGoodsNumOfInSale(uid, bce);
|
|
|
//set number of buyer order related seller goods
|
|
|
List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
|
|
|
Integer num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes);
|
|
|
List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.SEND_OUT, SellerOrderListType.WAITING_PAY);
|
|
|
List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
|
|
|
List<SellerOrderListType> orderListTypes = Arrays.asList(SellerOrderListType.SEND_OUT, SellerOrderListType.WAITING_PAY);
|
|
|
List<Integer> statusList = orderListTypes.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
|
|
|
Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUidStatus(uid, statusList, orderTypes);
|
|
|
logger.info("in seller order count uid {}, num {}, buyerOrderNum {}", uid, num, buyerOrderNum);
|
|
|
if (num == null) {
|
|
|
if (num == 0) {
|
|
|
cnt = 0;
|
|
|
} else {
|
|
|
if (buyerOrderNum != null) {
|
...
|
...
|
@@ -135,19 +137,26 @@ public class SellerOrderViewService { |
|
|
return new OrderSummaryResp("sell", cnt);
|
|
|
}
|
|
|
|
|
|
private int getSellerGoodsNumOfInSale(int uid, final BusinessClientEnum bce){
|
|
|
List<Integer> sellerGoodsTypes = OrderAssist.matchSellerGoodsTypes(bce);
|
|
|
int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), sellerGoodsTypes);
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
public List<OrderSummaryResp> getOrderCntListByUid(int uid, String businessClient) {
|
|
|
final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
|
|
|
//fetch from cache
|
|
|
List<OrderSummaryResp> list = orderCacheService.getSellerSaleGoodsTabSummary(uid, bce);
|
|
|
final String actor = TabType.SELL.getValue();
|
|
|
//not hit in cache
|
|
|
//not hit in cache, sourcing database
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
|
|
|
list = new ArrayList<>(8);
|
|
|
SellerOrderListType insale = SellerOrderListType.IN_SALE;
|
|
|
int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes);
|
|
|
int num = getSellerGoodsNumOfInSale(uid, bce);
|
|
|
OrderSummaryResp sellerGoodsSummary = new OrderSummaryResp(actor, insale.getType(), num);
|
|
|
list.add(sellerGoodsSummary);
|
|
|
//
|
|
|
List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
|
|
|
List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.WAITING_PAY,
|
|
|
SellerOrderListType.SEND_OUT,
|
|
|
SellerOrderListType.ORDER_SUCCESS,
|
...
|
...
|
|