pull/1121/head
梁宇奇 2025-09-15 17:11:17 +08:00
parent 1ceba7275f
commit b0eb2c86b3
3 changed files with 23 additions and 12 deletions

View File

@ -28,4 +28,9 @@ public class PicPackSimpleVO {
*/
@ApiModelProperty(value = "文件大小(M)")
private BigDecimal fileSize;
/**
* 123
*/
@ApiModelProperty(value = "文件类型[3:商品下载图片包 4:商品下载图片包450px 5:商品下载图片包750px]")
private Integer fileType;
}

View File

@ -22,4 +22,8 @@ public class PicPackSimpleDTO {
* (M)
*/
private BigDecimal fileSize;
/**
* 123
*/
private Integer fileType;
}

View File

@ -617,25 +617,27 @@ public class StoreProductServiceImpl implements IStoreProductService {
@Override
public List<PicPackSimpleDTO> prepareGetPicPackDownloadUrl(Long storeProductId) {
Assert.notNull(storeProductId);
List<Long> fileIds = storeProdFileMapper.selectList(Wrappers.lambdaQuery(StoreProductFile.class)
.eq(StoreProductFile::getStoreProdId, storeProductId)
.in(StoreProductFile::getFileType, FileType.picPackValues())
.eq(XktBaseEntity::getDelFlag, UNDELETED))
List<StoreProductFile> productFiles = storeProdFileMapper.selectList(Wrappers.lambdaQuery(StoreProductFile.class)
.eq(StoreProductFile::getStoreProdId, storeProductId)
.in(StoreProductFile::getFileType, FileType.picPackValues())
.eq(XktBaseEntity::getDelFlag, UNDELETED))
.stream()
.map(StoreProductFile::getFileId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (CollUtil.isEmpty(fileIds)) {
if (CollUtil.isEmpty(productFiles)) {
return ListUtil.empty();
}
// 商品下载量+1
redisCache.valueIncr(CacheConstants.PRODUCT_STATISTICS_DOWNLOAD_COUNT, storeProductId);
List<SysFile> files = fileMapper.selectByIds(fileIds);
return files.stream()
.filter(o -> UNDELETED.equals(o.getDelFlag()))
List<Long> fileIds = productFiles.stream().map(StoreProductFile::getFileId).collect(Collectors.toList());
Map<Long, SysFile> fileMaps = fileMapper.selectByIds(fileIds)
.stream()
.collect(Collectors.toMap(SysFile::getId, Function.identity()));
return productFiles.stream()
.map(o -> {
PicPackSimpleDTO dto = BeanUtil.toBean(o, PicPackSimpleDTO.class);
dto.setFileId(o.getId());
SysFile sysFile = fileMaps.get(o.getFileId());
PicPackSimpleDTO dto = BeanUtil.toBean(sysFile, PicPackSimpleDTO.class);
dto.setFileId(sysFile.getId());
dto.setFileType(o.getFileType());
return dto;
}).collect(Collectors.toList());
}