pull/1121/head
parent
1ceba7275f
commit
b0eb2c86b3
|
|
@ -28,4 +28,9 @@ public class PicPackSimpleVO {
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "文件大小(M)")
|
@ApiModelProperty(value = "文件大小(M)")
|
||||||
private BigDecimal fileSize;
|
private BigDecimal fileSize;
|
||||||
|
/**
|
||||||
|
* 文件类型(1主图、2视频、3下载)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "文件类型[3:商品下载图片包 4:商品下载图片包450px 5:商品下载图片包750px]")
|
||||||
|
private Integer fileType;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,8 @@ public class PicPackSimpleDTO {
|
||||||
* 文件大小(M)
|
* 文件大小(M)
|
||||||
*/
|
*/
|
||||||
private BigDecimal fileSize;
|
private BigDecimal fileSize;
|
||||||
|
/**
|
||||||
|
* 文件类型(1主图、2视频、3下载)
|
||||||
|
*/
|
||||||
|
private Integer fileType;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -617,25 +617,27 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
||||||
@Override
|
@Override
|
||||||
public List<PicPackSimpleDTO> prepareGetPicPackDownloadUrl(Long storeProductId) {
|
public List<PicPackSimpleDTO> prepareGetPicPackDownloadUrl(Long storeProductId) {
|
||||||
Assert.notNull(storeProductId);
|
Assert.notNull(storeProductId);
|
||||||
List<Long> fileIds = storeProdFileMapper.selectList(Wrappers.lambdaQuery(StoreProductFile.class)
|
List<StoreProductFile> productFiles = storeProdFileMapper.selectList(Wrappers.lambdaQuery(StoreProductFile.class)
|
||||||
.eq(StoreProductFile::getStoreProdId, storeProductId)
|
.eq(StoreProductFile::getStoreProdId, storeProductId)
|
||||||
.in(StoreProductFile::getFileType, FileType.picPackValues())
|
.in(StoreProductFile::getFileType, FileType.picPackValues())
|
||||||
.eq(XktBaseEntity::getDelFlag, UNDELETED))
|
.eq(XktBaseEntity::getDelFlag, UNDELETED))
|
||||||
.stream()
|
.stream()
|
||||||
.map(StoreProductFile::getFileId)
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (CollUtil.isEmpty(fileIds)) {
|
if (CollUtil.isEmpty(productFiles)) {
|
||||||
return ListUtil.empty();
|
return ListUtil.empty();
|
||||||
}
|
}
|
||||||
// 商品下载量+1
|
// 商品下载量+1
|
||||||
redisCache.valueIncr(CacheConstants.PRODUCT_STATISTICS_DOWNLOAD_COUNT, storeProductId);
|
redisCache.valueIncr(CacheConstants.PRODUCT_STATISTICS_DOWNLOAD_COUNT, storeProductId);
|
||||||
List<SysFile> files = fileMapper.selectByIds(fileIds);
|
List<Long> fileIds = productFiles.stream().map(StoreProductFile::getFileId).collect(Collectors.toList());
|
||||||
return files.stream()
|
Map<Long, SysFile> fileMaps = fileMapper.selectByIds(fileIds)
|
||||||
.filter(o -> UNDELETED.equals(o.getDelFlag()))
|
.stream()
|
||||||
|
.collect(Collectors.toMap(SysFile::getId, Function.identity()));
|
||||||
|
return productFiles.stream()
|
||||||
.map(o -> {
|
.map(o -> {
|
||||||
PicPackSimpleDTO dto = BeanUtil.toBean(o, PicPackSimpleDTO.class);
|
SysFile sysFile = fileMaps.get(o.getFileId());
|
||||||
dto.setFileId(o.getId());
|
PicPackSimpleDTO dto = BeanUtil.toBean(sysFile, PicPackSimpleDTO.class);
|
||||||
|
dto.setFileId(sysFile.getId());
|
||||||
|
dto.setFileType(o.getFileType());
|
||||||
return dto;
|
return dto;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue