|
@@ -112,13 +112,15 @@ public class SellerOrderViewService { |
|
@@ -112,13 +112,15 @@ public class SellerOrderViewService { |
112
|
Integer cnt = orderCacheService.getOrderSummary(uid, TabType.SELL, businessClient);
|
112
|
Integer cnt = orderCacheService.getOrderSummary(uid, TabType.SELL, businessClient);
|
113
|
if (cnt == null) {
|
113
|
if (cnt == null) {
|
114
|
final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
|
114
|
final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
|
|
|
115
|
+ //set number of seller goods
|
|
|
116
|
+ int num = getSellerGoodsNumOfInSale(uid, bce);
|
|
|
117
|
+ //set number of buyer order related seller goods
|
115
|
List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
|
118
|
List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
|
116
|
- Integer num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes);
|
|
|
117
|
- List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.SEND_OUT, SellerOrderListType.WAITING_PAY);
|
|
|
118
|
- List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
|
119
|
+ List<SellerOrderListType> orderListTypes = Arrays.asList(SellerOrderListType.SEND_OUT, SellerOrderListType.WAITING_PAY);
|
|
|
120
|
+ List<Integer> statusList = orderListTypes.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
|
119
|
Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUidStatus(uid, statusList, orderTypes);
|
121
|
Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUidStatus(uid, statusList, orderTypes);
|
120
|
logger.info("in seller order count uid {}, num {}, buyerOrderNum {}", uid, num, buyerOrderNum);
|
122
|
logger.info("in seller order count uid {}, num {}, buyerOrderNum {}", uid, num, buyerOrderNum);
|
121
|
- if (num == null) {
|
123
|
+ if (num == 0) {
|
122
|
cnt = 0;
|
124
|
cnt = 0;
|
123
|
} else {
|
125
|
} else {
|
124
|
if (buyerOrderNum != null) {
|
126
|
if (buyerOrderNum != null) {
|
|
@@ -135,19 +137,26 @@ public class SellerOrderViewService { |
|
@@ -135,19 +137,26 @@ public class SellerOrderViewService { |
135
|
return new OrderSummaryResp("sell", cnt);
|
137
|
return new OrderSummaryResp("sell", cnt);
|
136
|
}
|
138
|
}
|
137
|
|
139
|
|
|
|
140
|
+ private int getSellerGoodsNumOfInSale(int uid, final BusinessClientEnum bce){
|
|
|
141
|
+ List<Integer> sellerGoodsTypes = OrderAssist.matchSellerGoodsTypes(bce);
|
|
|
142
|
+ int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), sellerGoodsTypes);
|
|
|
143
|
+ return num;
|
|
|
144
|
+ }
|
|
|
145
|
+
|
138
|
public List<OrderSummaryResp> getOrderCntListByUid(int uid, String businessClient) {
|
146
|
public List<OrderSummaryResp> getOrderCntListByUid(int uid, String businessClient) {
|
139
|
final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
|
147
|
final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
|
|
|
148
|
+ //fetch from cache
|
140
|
List<OrderSummaryResp> list = orderCacheService.getSellerSaleGoodsTabSummary(uid, bce);
|
149
|
List<OrderSummaryResp> list = orderCacheService.getSellerSaleGoodsTabSummary(uid, bce);
|
141
|
final String actor = TabType.SELL.getValue();
|
150
|
final String actor = TabType.SELL.getValue();
|
142
|
- //not hit in cache
|
151
|
+ //not hit in cache, sourcing database
|
143
|
if (CollectionUtils.isEmpty(list)) {
|
152
|
if (CollectionUtils.isEmpty(list)) {
|
144
|
- List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
|
|
|
145
|
list = new ArrayList<>(8);
|
153
|
list = new ArrayList<>(8);
|
146
|
SellerOrderListType insale = SellerOrderListType.IN_SALE;
|
154
|
SellerOrderListType insale = SellerOrderListType.IN_SALE;
|
147
|
- int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes);
|
155
|
+ int num = getSellerGoodsNumOfInSale(uid, bce);
|
148
|
OrderSummaryResp sellerGoodsSummary = new OrderSummaryResp(actor, insale.getType(), num);
|
156
|
OrderSummaryResp sellerGoodsSummary = new OrderSummaryResp(actor, insale.getType(), num);
|
149
|
list.add(sellerGoodsSummary);
|
157
|
list.add(sellerGoodsSummary);
|
150
|
//
|
158
|
//
|
|
|
159
|
+ List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
|
151
|
List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.WAITING_PAY,
|
160
|
List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.WAITING_PAY,
|
152
|
SellerOrderListType.SEND_OUT,
|
161
|
SellerOrderListType.SEND_OUT,
|
153
|
SellerOrderListType.ORDER_SUCCESS,
|
162
|
SellerOrderListType.ORDER_SUCCESS,
|