...
|
...
|
@@ -174,7 +174,7 @@ public class SkupListService { |
|
|
logger.warn("seller get entry order list SellerOrderGoods is empty,req {}", request);
|
|
|
return respBuilder.build();
|
|
|
}
|
|
|
List<OrderListInfo> data = buildProductList(sogList, viewableStatus);
|
|
|
List<OrderListInfo> data = buildProductList(sogList, viewableStatus, skupTypeCodes, isEntry);
|
|
|
respBuilder.data(data);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -251,7 +251,7 @@ public class SkupListService { |
|
|
sogCondition.setStatus(status);
|
|
|
final List<Integer> skupTypeCodes = ENTRY_SKUP_TYPES;
|
|
|
//
|
|
|
int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSku(sogCondition, skupTypeCodes);
|
|
|
int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSku(sogCondition, skupTypeCodes, isEntry);
|
|
|
respBuilder.total(total);
|
|
|
if (total == 0){
|
|
|
return respBuilder.build();
|
...
|
...
|
@@ -260,7 +260,7 @@ public class SkupListService { |
|
|
respBuilder.pagetotal(pageTotal);
|
|
|
int offset = (request.getPage() - 1) * limit;
|
|
|
List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSku(sogCondition,
|
|
|
skupTypeCodes, offset, limit);
|
|
|
skupTypeCodes, offset, limit, isEntry);
|
|
|
//TODO 可以提前计算 total offset limit三者之间的关系,减少一次网络IO
|
|
|
if (CollectionUtils.isEmpty(sogList)){
|
|
|
logger.warn("seller get order list SellerOrderGoods is empty,req {}", request);
|
...
|
...
|
@@ -269,12 +269,16 @@ public class SkupListService { |
|
|
|
|
|
List<OrderListInfo> orderListInfos = buildEntryPrdSkuList(productId, sogList);
|
|
|
respBuilder.data(orderListInfos);
|
|
|
ProductInfo productInfo = buildProductInfo(uid, status, sogList, pageTotal);
|
|
|
ProductInfo productInfo = buildProductInfo(uid, status, sogList, pageTotal, skupTypeCodes, isEntry);
|
|
|
respBuilder.productInfo(productInfo);
|
|
|
return respBuilder.build();
|
|
|
}
|
|
|
|
|
|
public ProductInfo buildProductInfo(Integer uid, Integer status, List<SellerOrderGoods> sogList, int pageTotal){
|
|
|
public ProductInfo buildProductInfo(Integer uid,
|
|
|
Integer status,
|
|
|
List<SellerOrderGoods> sogList,
|
|
|
int pageTotal,
|
|
|
List<Integer> skupTypeCodes,boolean isEntry){
|
|
|
ProductInfo productInfo = new ProductInfo();
|
|
|
SellerOrderGoods sog = sogList.get(0);
|
|
|
productInfo.setProductId(sog.getProductId());
|
...
|
...
|
@@ -298,7 +302,8 @@ public class SkupListService { |
|
|
sizeNum = sizeIds.size();
|
|
|
}
|
|
|
if (pageTotal>1){
|
|
|
SellerOrderGoods psogOfMerge = fetchSellerOrderGoodsFromDB(uid, Arrays.asList(status), sog.getProductId());
|
|
|
SellerOrderGoods psogOfMerge = fetchSellerOrderGoodsFromDB(uid, Arrays.asList(status), sog.getProductId(),
|
|
|
skupTypeCodes, isEntry);
|
|
|
if (psogOfMerge != null) {
|
|
|
storageNum = psogOfMerge.getStorageNum();
|
|
|
sizeNum = psogOfMerge.getSizeNum();
|
...
|
...
|
@@ -319,8 +324,10 @@ public class SkupListService { |
|
|
*/
|
|
|
private SellerOrderGoods fetchSellerOrderGoodsFromDB(int uid,
|
|
|
List<Integer> statusList,
|
|
|
Integer productId){
|
|
|
SellerOrderGoods psogOfMerge = sellerOrderGoodsViewMapper.selectByUidStatusGBSkc(uid, statusList, ENTRY_SKUP_TYPES, productId);
|
|
|
Integer productId,
|
|
|
List<Integer> skupTypeCodes,
|
|
|
boolean isEntry){
|
|
|
SellerOrderGoods psogOfMerge = sellerOrderGoodsViewMapper.selectByUidStatusGBSkc(uid, statusList, skupTypeCodes, productId, isEntry);
|
|
|
logger.info("fetchSellerOrderGoodsFromDB uid {} statusList {} prd id {}", uid, statusList, productId);
|
|
|
return psogOfMerge;
|
|
|
}
|
...
|
...
|
@@ -338,14 +345,14 @@ public class SkupListService { |
|
|
sogCondition.setStatus(status);
|
|
|
List<Integer> skupTypesCondition = NORMAL_SKUPTYPES;
|
|
|
//
|
|
|
int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSku(sogCondition, skupTypesCondition);
|
|
|
int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSku(sogCondition, skupTypesCondition, true);
|
|
|
if (total == 0){
|
|
|
return popDTO;
|
|
|
}
|
|
|
|
|
|
int offset = 0, limit = total;
|
|
|
List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSku(sogCondition, skupTypesCondition,
|
|
|
offset, limit);
|
|
|
offset, limit, true);
|
|
|
if (CollectionUtils.isEmpty(sogList)){
|
|
|
logger.warn("seller getPrdOverPriceDTO use SellerOrderGoods is empty,uid {} productId {}", uid, productId);
|
|
|
return popDTO;
|
...
|
...
|
@@ -463,11 +470,13 @@ public class SkupListService { |
|
|
}
|
|
|
|
|
|
|
|
|
public List<OrderListInfo> buildProductList(List<SellerOrderGoods> sogList,SkupStatus viewableStatus){
|
|
|
public List<OrderListInfo> buildProductList(List<SellerOrderGoods> sogList,
|
|
|
SkupStatus viewableStatus,
|
|
|
List<Integer> skupTypeCodes,boolean isEntry){
|
|
|
List<OrderListInfo> data ;
|
|
|
data = sogList.parallelStream()
|
|
|
.map(sog -> {
|
|
|
OrderListInfo oli = buildEntryOrderListInfo(sog, viewableStatus);
|
|
|
OrderListInfo oli = buildEntryOrderListInfo(sog, viewableStatus, skupTypeCodes, isEntry);
|
|
|
return oli;
|
|
|
})
|
|
|
.filter(oli -> Objects.nonNull(oli))
|
...
|
...
|
@@ -481,6 +490,7 @@ public class SkupListService { |
|
|
* @return
|
|
|
*/
|
|
|
public OrderListInfo getOrderListInfo(SellerGoodsRequest req){
|
|
|
List<Integer> skupTypeCodes = ENTRY_SKUP_TYPES;
|
|
|
SkupStatus ss = SkupStatus.CAN_SELL;
|
|
|
Integer status = ss.getCode();
|
|
|
Integer uid = req.getUid();
|
...
|
...
|
@@ -489,15 +499,17 @@ public class SkupListService { |
|
|
sogCondition.setProductId(productId=req.getProductId());
|
|
|
sogCondition.setUid(uid);
|
|
|
sogCondition.setStatus(status);
|
|
|
List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSku(sogCondition, ENTRY_SKUP_TYPES, 0, 1);
|
|
|
boolean isEntry = true;
|
|
|
List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSku(sogCondition, skupTypeCodes , 0, 1, isEntry);
|
|
|
if (CollectionUtils.isEmpty(sogList)){
|
|
|
logger.warn("in getOrderListInfo soglist is empty req {}", req);
|
|
|
return null;
|
|
|
}
|
|
|
return buildEntryOrderListInfo(sogList.get(0), ss);
|
|
|
return buildEntryOrderListInfo(sogList.get(0), ss, skupTypeCodes, isEntry);
|
|
|
}
|
|
|
|
|
|
OrderListInfo buildEntryOrderListInfo(SellerOrderGoods sellerOrderGoods, SkupStatus skupStatus) {
|
|
|
OrderListInfo buildEntryOrderListInfo(SellerOrderGoods sellerOrderGoods, SkupStatus skupStatus,
|
|
|
List<Integer> skupTypeCodes, boolean isEntry) {
|
|
|
Integer uid;
|
|
|
OrderListInfo orderListInfo = new OrderListInfo();
|
|
|
orderListInfo.setUid(uid = sellerOrderGoods.getUid());
|
...
|
...
|
@@ -526,7 +538,7 @@ public class SkupListService { |
|
|
productInfo.setEntryFlag(true);
|
|
|
//
|
|
|
List<Integer> statusList = Arrays.asList(skupStatus.getCode());
|
|
|
SellerOrderGoods psogOfMerge = fetchSellerOrderGoodsFromDB(uid,statusList,productId);
|
|
|
SellerOrderGoods psogOfMerge = fetchSellerOrderGoodsFromDB(uid,statusList,productId, skupTypeCodes, isEntry);
|
|
|
if (psogOfMerge != null){
|
|
|
productInfo.setStorageNum(psogOfMerge.getStorageNum());
|
|
|
productInfo.setSizeNum(psogOfMerge.getSizeNum());
|
...
|
...
|
|