|
@@ -62,6 +62,12 @@ public class SkupListService { |
|
@@ -62,6 +62,12 @@ public class SkupListService { |
62
|
@Autowired
|
62
|
@Autowired
|
63
|
private SellerOrderGoodsViewMapper sellerOrderGoodsViewMapper;
|
63
|
private SellerOrderGoodsViewMapper sellerOrderGoodsViewMapper;
|
64
|
|
64
|
|
|
|
65
|
+ @Autowired
|
|
|
66
|
+ private ProductProxyService productProxyService;
|
|
|
67
|
+
|
|
|
68
|
+ @Autowired
|
|
|
69
|
+ private SellerOrderPrepareProcessor sellerOrderPrepareProcessor;
|
|
|
70
|
+
|
65
|
static Integer getMinSkupId(String skupList){
|
71
|
static Integer getMinSkupId(String skupList){
|
66
|
Integer lastSkup = null;
|
72
|
Integer lastSkup = null;
|
67
|
if (StringUtils.isNotBlank(skupList)){
|
73
|
if (StringUtils.isNotBlank(skupList)){
|
|
@@ -202,7 +208,7 @@ public class SkupListService { |
|
@@ -202,7 +208,7 @@ public class SkupListService { |
202
|
|
208
|
|
203
|
Integer status = SkupStatus.CAN_SELL.getCode();
|
209
|
Integer status = SkupStatus.CAN_SELL.getCode();
|
204
|
Integer uid = request.getUid();
|
210
|
Integer uid = request.getUid();
|
205
|
- boolean isEntry = userProxyService.isEntryShop(request.getUid());
|
211
|
+ boolean isEntry = userProxyService.isEntryShop(uid);
|
206
|
if (!isEntry){
|
212
|
if (!isEntry){
|
207
|
logger.warn("getEntryGoodsSizeList not entry seller, req {}", request);
|
213
|
logger.warn("getEntryGoodsSizeList not entry seller, req {}", request);
|
208
|
return respBuilder.build();
|
214
|
return respBuilder.build();
|
|
@@ -215,11 +221,12 @@ public class SkupListService { |
|
@@ -215,11 +221,12 @@ public class SkupListService { |
215
|
sogCondition.setStatus(status);
|
221
|
sogCondition.setStatus(status);
|
216
|
//
|
222
|
//
|
217
|
int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSku(sogCondition);
|
223
|
int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSku(sogCondition);
|
218
|
- respBuilder.total(total)
|
|
|
219
|
- .pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1));
|
224
|
+ respBuilder.total(total);
|
220
|
if (total == 0){
|
225
|
if (total == 0){
|
221
|
return respBuilder.build();
|
226
|
return respBuilder.build();
|
222
|
}
|
227
|
}
|
|
|
228
|
+ int pageTotal = (total % limit == 0) ? (total / limit) : (total / limit + 1);
|
|
|
229
|
+ respBuilder.pagetotal(pageTotal);
|
223
|
int offset = (request.getPage() - 1) * limit;
|
230
|
int offset = (request.getPage() - 1) * limit;
|
224
|
List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSku(sogCondition,
|
231
|
List<SellerOrderGoods> sogList = sellerOrderGoodsViewMapper.selectEntryListByUidStatusGBSku(sogCondition,
|
225
|
offset, limit);
|
232
|
offset, limit);
|
|
@@ -231,12 +238,12 @@ public class SkupListService { |
|
@@ -231,12 +238,12 @@ public class SkupListService { |
231
|
final SellerType sellerType = SellerType.ENTRY;
|
238
|
final SellerType sellerType = SellerType.ENTRY;
|
232
|
List<OrderListInfo> orderListInfos = buildPrdSkuList(productId, sogList, sellerType);
|
239
|
List<OrderListInfo> orderListInfos = buildPrdSkuList(productId, sogList, sellerType);
|
233
|
respBuilder.data(orderListInfos);
|
240
|
respBuilder.data(orderListInfos);
|
234
|
- ProductInfo productInfo = buildProductInfo(sogList);
|
241
|
+ ProductInfo productInfo = buildProductInfo(uid, status, sogList, pageTotal);
|
235
|
respBuilder.productInfo(productInfo);
|
242
|
respBuilder.productInfo(productInfo);
|
236
|
return respBuilder.build();
|
243
|
return respBuilder.build();
|
237
|
}
|
244
|
}
|
238
|
|
245
|
|
239
|
- ProductInfo buildProductInfo(List<SellerOrderGoods> sogList){
|
246
|
+ ProductInfo buildProductInfo(Integer uid, Integer status, List<SellerOrderGoods> sogList, int pageTotal){
|
240
|
ProductInfo productInfo = new ProductInfo();
|
247
|
ProductInfo productInfo = new ProductInfo();
|
241
|
SellerOrderGoods sog = sogList.get(0);
|
248
|
SellerOrderGoods sog = sogList.get(0);
|
242
|
productInfo.setProductId(sog.getProductId());
|
249
|
productInfo.setProductId(sog.getProductId());
|
|
@@ -246,24 +253,49 @@ public class SkupListService { |
|
@@ -246,24 +253,49 @@ public class SkupListService { |
246
|
String imageUrl = ImageUrlAssist.getAllProductPicUrl(sog.getImageUrl(), "goodsimg", "center", "d2hpdGU=");
|
253
|
String imageUrl = ImageUrlAssist.getAllProductPicUrl(sog.getImageUrl(), "goodsimg", "center", "d2hpdGU=");
|
247
|
productInfo.setImageUrl(imageUrl);
|
254
|
productInfo.setImageUrl(imageUrl);
|
248
|
//
|
255
|
//
|
|
|
256
|
+
|
|
|
257
|
+ int storageNum = 0, sizeNum = 0;
|
|
|
258
|
+ if (pageTotal==1) {
|
249
|
Set<Integer> sizeIds = new HashSet<>(sogList.size());
|
259
|
Set<Integer> sizeIds = new HashSet<>(sogList.size());
|
250
|
- int storageNum = 0;
|
|
|
251
|
- for(SellerOrderGoods csog : sogList){
|
260
|
+ for (SellerOrderGoods csog : sogList) {
|
252
|
storageNum += csog.getStorageNum();
|
261
|
storageNum += csog.getStorageNum();
|
253
|
Integer sizeId;
|
262
|
Integer sizeId;
|
254
|
- if (!sizeIds.contains(sizeId=csog.getSizeId())){
|
263
|
+ if (!sizeIds.contains(sizeId = csog.getSizeId())) {
|
255
|
sizeIds.add(sizeId);
|
264
|
sizeIds.add(sizeId);
|
256
|
}
|
265
|
}
|
257
|
}
|
266
|
}
|
258
|
- productInfo.setSizeNum(sizeIds.size());
|
267
|
+ sizeNum = sizeIds.size();
|
|
|
268
|
+ }
|
|
|
269
|
+ if (pageTotal>1){
|
|
|
270
|
+ SellerOrderGoods psogOfMerge = fetchSellerOrderGoodsFromDB(uid, Arrays.asList(status), sog.getProductId());
|
|
|
271
|
+ if (psogOfMerge != null) {
|
|
|
272
|
+ storageNum = psogOfMerge.getStorageNum();
|
|
|
273
|
+ sizeNum = psogOfMerge.getSizeNum();
|
|
|
274
|
+ }
|
|
|
275
|
+ }
|
|
|
276
|
+ //fetch from db if page num larger than 1
|
|
|
277
|
+ productInfo.setSizeNum(sizeNum);
|
259
|
productInfo.setStorageNum(storageNum);
|
278
|
productInfo.setStorageNum(storageNum);
|
260
|
return productInfo;
|
279
|
return productInfo;
|
261
|
}
|
280
|
}
|
262
|
|
281
|
|
263
|
- @Autowired
|
|
|
264
|
- private ProductProxyService productProxyService;
|
|
|
265
|
- @Autowired
|
|
|
266
|
- private SellerOrderPrepareProcessor sellerOrderPrepareProcessor;
|
282
|
+ /**
|
|
|
283
|
+ *
|
|
|
284
|
+ * @param uid
|
|
|
285
|
+ * @param statusList
|
|
|
286
|
+ * @param productId
|
|
|
287
|
+ * @return
|
|
|
288
|
+ */
|
|
|
289
|
+ private SellerOrderGoods fetchSellerOrderGoodsFromDB(int uid,
|
|
|
290
|
+ List<Integer> statusList,
|
|
|
291
|
+ Integer productId){
|
|
|
292
|
+ SellerOrderGoods psogOfMerge = sellerOrderGoodsViewMapper.selectByUidStatusGBSkc(uid, statusList, productId);
|
|
|
293
|
+ logger.info("fetchSellerOrderGoodsFromDB uid {} statusList {} prd id {}", uid, statusList, productId);
|
|
|
294
|
+ return psogOfMerge;
|
|
|
295
|
+ }
|
|
|
296
|
+
|
|
|
297
|
+
|
|
|
298
|
+
|
267
|
|
299
|
|
268
|
public Map<String,String> buildOverPriceTipsMap(Collection<Integer> storageIds, List<SellerOrderGoods> sogList,
|
300
|
public Map<String,String> buildOverPriceTipsMap(Collection<Integer> storageIds, List<SellerOrderGoods> sogList,
|
269
|
Map<Integer, StorageInfoResp> getStorageDataMap){
|
301
|
Map<Integer, StorageInfoResp> getStorageDataMap){
|
|
@@ -380,7 +412,7 @@ public class SkupListService { |
|
@@ -380,7 +412,7 @@ public class SkupListService { |
380
|
productInfo.setProductId(productId=sellerOrderGoods.getProductId());
|
412
|
productInfo.setProductId(productId=sellerOrderGoods.getProductId());
|
381
|
productInfo.setEntryFlag(true);
|
413
|
productInfo.setEntryFlag(true);
|
382
|
//
|
414
|
//
|
383
|
- SellerOrderGoods psogOfMerge = sellerOrderGoodsViewMapper.selectByUidStatusGBSkc(uid,statusList,productId);
|
415
|
+ SellerOrderGoods psogOfMerge = fetchSellerOrderGoodsFromDB(uid,statusList,productId);
|
384
|
if (psogOfMerge != null){
|
416
|
if (psogOfMerge != null){
|
385
|
productInfo.setStorageNum(psogOfMerge.getStorageNum());
|
417
|
productInfo.setStorageNum(psogOfMerge.getStorageNum());
|
386
|
productInfo.setSizeNum(psogOfMerge.getSizeNum());
|
418
|
productInfo.setSizeNum(psogOfMerge.getSizeNum());
|