|
@@ -83,13 +83,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
}
|
|
}
|
|
result.setSpecList(specList);
|
|
result.setSpecList(specList);
|
|
//获取图片
|
|
//获取图片
|
|
- List<Long> businessIdList = new ArrayList<>();
|
|
|
|
- businessIdList.add(result.getId());
|
|
|
|
- Map<Long, List<FileInfoVo>> fileMap = ObsFileUtil.getFileMap(businessIdList, 1);
|
|
|
|
- result.setFileList(fileMap.get(result.getId()));
|
|
|
|
-
|
|
|
|
- Map<Long, List<FileInfoVo>> contentImgMap = ObsFileUtil.getFileMap(businessIdList, 2);
|
|
|
|
- result.setContentImgList(contentImgMap.get(result.getId()));
|
|
|
|
|
|
+ buildFile(result);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -101,8 +95,6 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
this.save(productInfoDto);
|
|
this.save(productInfoDto);
|
|
// 保存图片
|
|
// 保存图片
|
|
ObsFileUtil.saveFile(productInfoDto.getCoverUrlList(), productInfoDto.getId(), 1);
|
|
ObsFileUtil.saveFile(productInfoDto.getCoverUrlList(), productInfoDto.getId(), 1);
|
|
-
|
|
|
|
-
|
|
|
|
ObsFileUtil.saveFile(productInfoDto.getContentImgList(), productInfoDto.getId(), 2);
|
|
ObsFileUtil.saveFile(productInfoDto.getContentImgList(), productInfoDto.getId(), 2);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -137,4 +129,31 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
Page<ProductInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
Page<ProductInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
return page;
|
|
return page;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ProductInfoVo detailByOpen(Long id) {
|
|
|
|
+ ProductInfo productInfo = this.getById(id);
|
|
|
|
+ ProductInfoVo result = BeanUtil.toBean(productInfo, ProductInfoVo.class);
|
|
|
|
+ Map<String, String> dictMap = DictUtilsByOpen.getDictMap("product_spec");
|
|
|
|
+ List<String> specList = new ArrayList<>();
|
|
|
|
+ if(StringUtils.isNotBlank(productInfo.getSpec())){
|
|
|
|
+ specList = Arrays.stream(productInfo.getSpec().split(",")).map(dictMap::get).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ result.setSpecList(specList);
|
|
|
|
+ //获取图片
|
|
|
|
+ buildFile(result);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void buildFile(ProductInfoVo result) {
|
|
|
|
+ List<Long> businessIdList = new ArrayList<>();
|
|
|
|
+ businessIdList.add(result.getId());
|
|
|
|
+ Map<Long, List<FileInfoVo>> fileMap = ObsFileUtil.getFileMap(businessIdList, 1);
|
|
|
|
+ result.setFileList(fileMap.get(result.getId()));
|
|
|
|
+ Map<Long, List<FileInfoVo>> contentImgMap = ObsFileUtil.getFileMap(businessIdList, 2);
|
|
|
|
+ result.setContentImgList(contentImgMap.get(result.getId()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|