master:删掉多余的接口,商品下载返回的信息优化;
parent
6e572c07ed
commit
3c32eb61bb
|
|
@ -150,13 +150,6 @@ public class StoreProductController extends XktBaseController {
|
|||
return R.ok(BeanUtil.toBean(storeProdService.getPcDownloadInfo(storeProdId), StoreProdPcDownloadInfoResVO.class));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商品图包列表", httpMethod = "GET", response = R.class)
|
||||
@GetMapping(value = "/pic-pack/{storeProdId}")
|
||||
public R<List<PicPackSimpleVO>> listPickPack(@PathVariable("storeProdId") Long storeProdId) {
|
||||
List<PicPackSimpleDTO> dtoList = storeProdService.prepareGetPicPackDownloadUrl(storeProdId);
|
||||
return success(BeanUtil.copyToList(dtoList, PicPackSimpleVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,agent')")
|
||||
@Log(title = "获取商品图包下载链接", businessType = BusinessType.OTHER)
|
||||
@ApiOperation(value = "获取商品图包下载链接", httpMethod = "POST", response = R.class)
|
||||
|
|
@ -169,6 +162,4 @@ public class StoreProductController extends XktBaseController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ public class StoreProdPcDownloadInfoResVO {
|
|||
|
||||
@Data
|
||||
public static class SPPDIFileVO {
|
||||
@ApiModelProperty(value = "文件id")
|
||||
private Long fileId;
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
@ApiModelProperty(value = "文件路径")
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ public class StoreProdPcDownloadInfoResDTO {
|
|||
|
||||
@Data
|
||||
public static class SPPDIFileDTO {
|
||||
@ApiModelProperty(value = "文件id")
|
||||
private Long fileId;
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
@ApiModelProperty(value = "文件路径")
|
||||
|
|
|
|||
|
|
@ -139,14 +139,6 @@ public interface IStoreProductService {
|
|||
*/
|
||||
List<StoreProdFuzzyLatest30ResDTO> fuzzyQueryLatest30List(Long storeId, String prodArtNum);
|
||||
|
||||
/**
|
||||
* 准备获取图包下载链接
|
||||
*
|
||||
* @param storeProductId
|
||||
* @return
|
||||
*/
|
||||
List<PicPackSimpleDTO> prepareGetPicPackDownloadUrl(Long storeProductId);
|
||||
|
||||
/**
|
||||
* 获取图包下载链接(提供给前端请求使用)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import com.github.pagehelper.PageInfo;
|
|||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.XktBaseEntity;
|
||||
import com.ruoyi.common.core.page.Page;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
|
|
@ -635,33 +634,6 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
.setStoreProdId(x.getId()).setProdArtNum(x.getProdArtNum())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
@Override
|
||||
public List<PicPackSimpleDTO> prepareGetPicPackDownloadUrl(Long storeProductId) {
|
||||
Assert.notNull(storeProductId);
|
||||
List<StoreProductFile> productFiles = storeProdFileMapper.selectList(Wrappers.lambdaQuery(StoreProductFile.class)
|
||||
.eq(StoreProductFile::getStoreProdId, storeProductId)
|
||||
.in(StoreProductFile::getFileType, FileType.picPackValues())
|
||||
.eq(XktBaseEntity::getDelFlag, UNDELETED));
|
||||
if (CollUtil.isEmpty(productFiles)) {
|
||||
return ListUtil.empty();
|
||||
}
|
||||
// 商品下载量+1
|
||||
redisCache.valueIncr(CacheConstants.PRODUCT_STATISTICS_DOWNLOAD_COUNT, storeProductId);
|
||||
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 -> {
|
||||
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());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
@Override
|
||||
public PicPackInfoDTO getPicPackDownloadUrl(PicPackReqDTO picPackReqDTO) {
|
||||
|
|
@ -739,6 +711,8 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public StoreProdPcDownloadInfoResDTO getPcDownloadInfo(Long storeProdId) {
|
||||
// 商品下载量+1
|
||||
redisCache.valueIncr(CacheConstants.PRODUCT_STATISTICS_DOWNLOAD_COUNT, storeProdId);
|
||||
StoreProdPcDownloadInfoResDTO downloadInfo = this.storeProdMapper.selectDownloadProdInfo(storeProdId);
|
||||
// 获取下载图包
|
||||
return downloadInfo.setFileList(this.storeProdFileMapper.selectDownloadFileList(storeProdId));
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectDownloadFileList">
|
||||
SELECT
|
||||
sf.id AS fileId,
|
||||
sf.file_name,
|
||||
sf.file_url,
|
||||
sf.file_size,
|
||||
|
|
|
|||
Loading…
Reference in New Issue