|
@@ -4,7 +4,6 @@ import com.google.common.base.Splitter; |
|
@@ -4,7 +4,6 @@ import com.google.common.base.Splitter; |
4
|
import com.google.common.collect.Lists;
|
4
|
import com.google.common.collect.Lists;
|
5
|
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
|
5
|
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
|
6
|
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
|
6
|
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
|
7
|
-import com.yohobuy.ufo.model.order.bo.OrderInfo;
|
|
|
8
|
import com.yohobuy.ufo.model.order.bo.ProductInfo;
|
7
|
import com.yohobuy.ufo.model.order.bo.ProductInfo;
|
9
|
import com.yohobuy.ufo.model.order.common.ButtonShow;
|
8
|
import com.yohobuy.ufo.model.order.common.ButtonShow;
|
10
|
import com.yohobuy.ufo.model.order.common.SellerOrderListType;
|
9
|
import com.yohobuy.ufo.model.order.common.SellerOrderListType;
|
|
@@ -15,10 +14,12 @@ import com.yohobuy.ufo.model.order.req.SellerGoodsRequest; |
|
@@ -15,10 +14,12 @@ import com.yohobuy.ufo.model.order.req.SellerGoodsRequest; |
15
|
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
|
14
|
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
|
16
|
import com.yohobuy.ufo.model.order.resp.PageResp;
|
15
|
import com.yohobuy.ufo.model.order.resp.PageResp;
|
17
|
import com.yohobuy.ufo.model.order.resp.SellerGoodsPageResp;
|
16
|
import com.yohobuy.ufo.model.order.resp.SellerGoodsPageResp;
|
|
|
17
|
+import com.yohobuy.ufo.model.response.StorageInfoResp;
|
18
|
import com.yohoufo.common.helper.ImageUrlAssist;
|
18
|
import com.yohoufo.common.helper.ImageUrlAssist;
|
19
|
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
|
19
|
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
|
20
|
import com.yohoufo.dal.order.SellerOrderGoodsViewMapper;
|
20
|
import com.yohoufo.dal.order.SellerOrderGoodsViewMapper;
|
21
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
21
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
22
|
+import com.yohoufo.order.model.dto.PrdOverPriceDTO;
|
22
|
import com.yohoufo.order.model.request.OrderListRequest;
|
23
|
import com.yohoufo.order.model.request.OrderListRequest;
|
23
|
import com.yohoufo.order.model.request.SellerGoodsListRequest;
|
24
|
import com.yohoufo.order.model.request.SellerGoodsListRequest;
|
24
|
import com.yohoufo.order.service.impl.processor.SellerOrderPrepareProcessor;
|
25
|
import com.yohoufo.order.service.impl.processor.SellerOrderPrepareProcessor;
|
|
@@ -26,8 +27,9 @@ import com.yohoufo.order.service.proxy.ProductProxyService; |
|
@@ -26,8 +27,9 @@ import com.yohoufo.order.service.proxy.ProductProxyService; |
26
|
import com.yohoufo.order.service.proxy.UserProxyService;
|
27
|
import com.yohoufo.order.service.proxy.UserProxyService;
|
27
|
import com.yohoufo.order.utils.LoggerUtils;
|
28
|
import com.yohoufo.order.utils.LoggerUtils;
|
28
|
import com.yohoufo.order.utils.OrderAssist;
|
29
|
import com.yohoufo.order.utils.OrderAssist;
|
29
|
-import com.yohobuy.ufo.model.response.StorageInfoResp;
|
30
|
+import com.yohoufo.order.utils.SellerGoodsHelper;
|
30
|
import org.apache.commons.collections.CollectionUtils;
|
31
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
32
|
+import org.apache.commons.collections.MapUtils;
|
31
|
import org.apache.commons.lang3.StringUtils;
|
33
|
import org.apache.commons.lang3.StringUtils;
|
32
|
import org.slf4j.Logger;
|
34
|
import org.slf4j.Logger;
|
33
|
import org.springframework.beans.factory.annotation.Autowired;
|
35
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -130,23 +132,30 @@ public class SkupListService { |
|
@@ -130,23 +132,30 @@ public class SkupListService { |
130
|
respBuilder = PageResp.builder()
|
132
|
respBuilder = PageResp.builder()
|
131
|
.page(request.getPage())
|
133
|
.page(request.getPage())
|
132
|
.pageSize(limit);
|
134
|
.pageSize(limit);
|
|
|
135
|
+ Integer uid = request.getUid();
|
|
|
136
|
+ boolean isEntry = userProxyService.isEntryShop(uid);
|
|
|
137
|
+ if (!isEntry){
|
|
|
138
|
+ logger.warn("getEntryGoodsList user is not entry, req {}", request);
|
|
|
139
|
+ return respBuilder.build();
|
|
|
140
|
+ }
|
133
|
int type;
|
141
|
int type;
|
134
|
if ((type=request.getType()) == SellerOrderListType.IN_SALE.getType()) {
|
142
|
if ((type=request.getType()) == SellerOrderListType.IN_SALE.getType()) {
|
135
|
- List<Integer> statusList = Arrays.asList(SkupStatus.CAN_SELL.getCode());
|
|
|
136
|
- int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSkc(request.getUid(), statusList);
|
143
|
+ SkupStatus viewableStatus = SkupStatus.CAN_SELL;
|
|
|
144
|
+ List<Integer> statusList = Arrays.asList(viewableStatus.getCode());
|
|
|
145
|
+ int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSkc(uid, statusList);
|
137
|
respBuilder.total(total)
|
146
|
respBuilder.total(total)
|
138
|
.pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1));
|
147
|
.pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1));
|
139
|
if (total == 0){
|
148
|
if (total == 0){
|
140
|
return respBuilder.build();
|
149
|
return respBuilder.build();
|
141
|
}
|
150
|
}
|
142
|
int offset = (request.getPage() - 1) * limit;
|
151
|
int offset = (request.getPage() - 1) * limit;
|
143
|
- List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSkc(request.getUid(),
|
152
|
+ List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSkc(uid,
|
144
|
statusList, offset , limit);
|
153
|
statusList, offset , limit);
|
145
|
if (CollectionUtils.isEmpty(sogList)){
|
154
|
if (CollectionUtils.isEmpty(sogList)){
|
146
|
logger.warn("seller get entry order list SellerOrderGoods is empty,req {}", request);
|
155
|
logger.warn("seller get entry order list SellerOrderGoods is empty,req {}", request);
|
147
|
return respBuilder.build();
|
156
|
return respBuilder.build();
|
148
|
}
|
157
|
}
|
149
|
- List<OrderListInfo> data = buildProductList(sogList, statusList);
|
158
|
+ List<OrderListInfo> data = buildProductList(sogList, viewableStatus);
|
150
|
respBuilder.data(data);
|
159
|
respBuilder.data(data);
|
151
|
}
|
160
|
}
|
152
|
|
161
|
|
|
@@ -294,6 +303,57 @@ public class SkupListService { |
|
@@ -294,6 +303,57 @@ public class SkupListService { |
294
|
return psogOfMerge;
|
303
|
return psogOfMerge;
|
295
|
}
|
304
|
}
|
296
|
|
305
|
|
|
|
306
|
+ private PrdOverPriceDTO getPrdOverPriceDTO(Integer uid,
|
|
|
307
|
+ Integer productId, SkupStatus skupStatus){
|
|
|
308
|
+ PrdOverPriceDTO popDTO = new PrdOverPriceDTO();
|
|
|
309
|
+ popDTO.setProductId(productId);
|
|
|
310
|
+ Integer status = skupStatus.getCode();
|
|
|
311
|
+
|
|
|
312
|
+
|
|
|
313
|
+ SellerOrderGoods sogCondition = new SellerOrderGoods();
|
|
|
314
|
+ sogCondition.setProductId(productId);
|
|
|
315
|
+ sogCondition.setUid(uid);
|
|
|
316
|
+ sogCondition.setStatus(status);
|
|
|
317
|
+ //
|
|
|
318
|
+ int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSku(sogCondition);
|
|
|
319
|
+ if (total == 0){
|
|
|
320
|
+ return popDTO;
|
|
|
321
|
+ }
|
|
|
322
|
+
|
|
|
323
|
+ int offset = 0, limit = total;
|
|
|
324
|
+ List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSku(sogCondition,
|
|
|
325
|
+ offset, limit);
|
|
|
326
|
+ if (CollectionUtils.isEmpty(sogList)){
|
|
|
327
|
+ logger.warn("seller getPrdOverPriceDTO use SellerOrderGoods is empty,uid {} productId {}", uid, productId);
|
|
|
328
|
+ return popDTO;
|
|
|
329
|
+ }
|
|
|
330
|
+
|
|
|
331
|
+ Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
|
|
|
332
|
+ .collect(Collectors.toSet());
|
|
|
333
|
+
|
|
|
334
|
+ Map<Integer, StorageInfoResp> storageDataMap = productProxyService.getStorageDataMap(storageIds);
|
|
|
335
|
+ Integer st = findPrdOverPriceDTO(sogList, storageDataMap);
|
|
|
336
|
+ popDTO.setStorageTotal(st);
|
|
|
337
|
+ return popDTO;
|
|
|
338
|
+ }
|
|
|
339
|
+
|
|
|
340
|
+ private Integer findPrdOverPriceDTO(List<SellerOrderGoods> sogList, Map<Integer, StorageInfoResp> storageDataMap ){
|
|
|
341
|
+ int total = 0;
|
|
|
342
|
+ if (MapUtils.isEmpty(storageDataMap)){
|
|
|
343
|
+ return total;
|
|
|
344
|
+ }
|
|
|
345
|
+ for (SellerOrderGoods sog : sogList){
|
|
|
346
|
+ BigDecimal salePrice = sog.getGoodsPrice();
|
|
|
347
|
+ Integer storageId = sog.getStorageId();
|
|
|
348
|
+ StorageInfoResp sir;
|
|
|
349
|
+ if (Objects.nonNull(sir=storageDataMap.get(storageId))
|
|
|
350
|
+ && SellerGoodsHelper.isOverSuggestMaxPrice(sir.getSuggestHighPrice(), salePrice)){
|
|
|
351
|
+ total += sog.getStorageNum();
|
|
|
352
|
+ }
|
|
|
353
|
+ }
|
|
|
354
|
+ return total;
|
|
|
355
|
+ }
|
|
|
356
|
+
|
297
|
|
357
|
|
298
|
|
358
|
|
299
|
|
359
|
|
|
@@ -354,11 +414,18 @@ public class SkupListService { |
|
@@ -354,11 +414,18 @@ public class SkupListService { |
354
|
}
|
414
|
}
|
355
|
|
415
|
|
356
|
|
416
|
|
357
|
- public List<OrderListInfo> buildProductList(List<SellerOrderGoods> sogList, List<Integer> statusList){
|
|
|
358
|
-
|
417
|
+ public List<OrderListInfo> buildProductList(List<SellerOrderGoods> sogList,SkupStatus viewableStatus){
|
|
|
418
|
+ List<Integer> statusList = Arrays.asList(viewableStatus.getCode());
|
359
|
List<OrderListInfo> data ;
|
419
|
List<OrderListInfo> data ;
|
360
|
data = sogList.parallelStream()
|
420
|
data = sogList.parallelStream()
|
361
|
- .map(sog -> buildEntryOrderListInfo(sog, statusList))
|
421
|
+ .map(sog -> {
|
|
|
422
|
+ OrderListInfo oli = buildEntryOrderListInfo(sog, statusList);
|
|
|
423
|
+ Integer uid = sog.getUid();
|
|
|
424
|
+ Integer productId= sog.getProductId();
|
|
|
425
|
+ PrdOverPriceDTO pop = getPrdOverPriceDTO(uid, productId, viewableStatus);
|
|
|
426
|
+ oli.setTips(pop.getTipsModule());
|
|
|
427
|
+ return oli;
|
|
|
428
|
+ })
|
362
|
.filter(oli -> Objects.nonNull(oli))
|
429
|
.filter(oli -> Objects.nonNull(oli))
|
363
|
.collect(Collectors.toList());
|
430
|
.collect(Collectors.toList());
|
364
|
return data;
|
431
|
return data;
|