|
@@ -190,7 +190,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
|
String skuIds = goodsSubList.stream().map(e -> e.getSku().toString()).collect(Collectors.joining(","));
|
|
|
PmsProductQueryParamDto paramDto = new PmsProductQueryParamDto();
|
|
|
paramDto.setSkuStockIds(skuIds);
|
|
|
- paramDto.setPublishStatus(1);
|
|
|
+// paramDto.setPublishStatus(1);
|
|
|
paramDto.setPageSize(1000);
|
|
|
paramDto.setPageNum(1);
|
|
|
paramDto.setJson(JSON.toJSONString(paramDto));
|
|
@@ -204,6 +204,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
|
goods.setSellCount(0);
|
|
|
Goods goodsRecord = new Goods();
|
|
|
BeanUtils.copyProperties(goods,goodsRecord);
|
|
|
+ goodsRecord.setStatus(YesOrNoEnum.NO);
|
|
|
BigDecimal organCostPrice = goodsSubList.stream().map(GoodsWrapper.GoodsSub::getGoodsPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
goodsRecord.setOrganCostPrice(organCostPrice);
|
|
|
goodsDao.insert(goodsRecord);
|
|
@@ -291,8 +292,13 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
|
QueryWrapper<GoodsSub> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("goods_id_", goodsId);
|
|
|
List<GoodsSub> goodsSubs = goodsSubMapper.selectList(queryWrapper);
|
|
|
+ if (goodsSubs.isEmpty()) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ List<String> skuList = goodsSubs.stream().map(next -> next.getSku().toString()).distinct().collect(Collectors.toList());
|
|
|
List<GoodsWrapper.GoodsSub> goodsSubList = goodsSubs.stream().map(next -> {
|
|
|
GoodsWrapper.GoodsSub goodsSub = new GoodsWrapper.GoodsSub();
|
|
|
+ goodsSub.setId(next.getId());
|
|
|
goodsSub.setGoodsId(goodsId);
|
|
|
goodsSub.setMallGoodsId(next.getMallGoodsId());
|
|
|
goodsSub.setGoodsStatus(next.getGoodsStatus());
|
|
@@ -300,21 +306,25 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
|
goodsSub.setGoodsPrice(next.getGoodsPrice());
|
|
|
return goodsSub;
|
|
|
}).collect(Collectors.toList());
|
|
|
- if (!CollectionUtils.isEmpty(goodsSubList)) {
|
|
|
- List<String> goodIdList = goodsSubList.stream().map(next -> next.getMallGoodsId().toString()).distinct().collect(Collectors.toList());
|
|
|
- PmsProductQueryParamDto build = PmsProductQueryParamDto.builder()
|
|
|
- .productIds(String.join(",", goodIdList))
|
|
|
- .pageSize(9999)
|
|
|
- .pageNum(1).build();
|
|
|
- build.setJson(JSON.toJSONString(build));
|
|
|
- Map<String, PmsProductDto> map = mallFeignService.getProductList(build)
|
|
|
- .getRows().stream().collect(Collectors.toMap(next -> next.getGoodsId() + "_" + next.getSkuStockId(), Function.identity()));
|
|
|
- goodsSubList.forEach(next -> {
|
|
|
- PmsProductDto orDefault = map.getOrDefault(next.getMallGoodsId() + "_" + next.getSku(), new PmsProductDto());
|
|
|
- next.setPrice(orDefault.getPrice());
|
|
|
- next.setMallGoodsName(orDefault.getName());
|
|
|
- });
|
|
|
- }
|
|
|
+ PmsProductQueryParamDto build = PmsProductQueryParamDto.builder()
|
|
|
+ .skuStockIds(String.join(",", skuList))
|
|
|
+ .pageSize(9999)
|
|
|
+ .pageNum(1).build();
|
|
|
+ build.setJson(JSON.toJSONString(build));
|
|
|
+ Map<Integer, PmsProductDto> map = mallFeignService.getProductList(build)
|
|
|
+ .getRows().stream().collect(Collectors.toMap(PmsProductDto::getSkuStockId, Function.identity()));
|
|
|
+ goodsSubList.forEach(next -> {
|
|
|
+ PmsProductDto dto = map.get(next.getSku());
|
|
|
+ if (dto != null) {
|
|
|
+ next.setPrice(dto.getPrice());
|
|
|
+ if (1 == dto.getDeleteStatus()) {
|
|
|
+ next.setGoodsStatus(false);
|
|
|
+ } else {
|
|
|
+ next.setGoodsStatus(dto.getPublishStatus() == 1);
|
|
|
+ }
|
|
|
+ next.setMallGoodsName(dto.getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
return goodsSubList;
|
|
|
}
|
|
|
|