master:店铺装修调优;
parent
da6405f247
commit
aa7257fc68
|
|
@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -27,43 +26,24 @@ public class StoreHomeDecorationVO {
|
|||
@ApiModelProperty(value = "模板编号", required = true)
|
||||
private Integer templateNum;
|
||||
@ApiModelProperty(value = "档口首页装修大轮播图")
|
||||
private List<BigBannerVO> bigBannerList;
|
||||
private List<DecorationVO> bigBannerList;
|
||||
@ApiModelProperty(value = "档口首页装修其它图部分")
|
||||
private List<DecorationVO> decorationList;
|
||||
|
||||
@Data
|
||||
public static class BigBannerVO {
|
||||
public static class DecorationVO {
|
||||
@ApiModelProperty(value = "业务类型ID,如果选择:不跳转 不传,选择:跳转店铺,传storeId,选择:跳转商品,传storeProdId")
|
||||
private Long bizId;
|
||||
@ApiModelProperty(value = "业务名称")
|
||||
private String bizName;
|
||||
@ApiModelProperty(value = "跳转类型 1. 不跳转 2. 跳转店铺 3. 跳转商品")
|
||||
private Integer jumpType;
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
@ApiModelProperty(value = "文件路径")
|
||||
private String fileUrl;
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private BigDecimal fileSize;
|
||||
@ApiModelProperty(value = "文件类型 1轮播大图")
|
||||
private Integer fileType;
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer orderNum;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DecorationVO {
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private Long bizId;
|
||||
@ApiModelProperty(value = "业务名称")
|
||||
private String bizName;
|
||||
@ApiModelProperty(value = "跳转类型")
|
||||
private Integer jumpType;
|
||||
@ApiModelProperty(value = "文件类型 2轮播小图 3店家推荐 4人气爆款 5当季新品 6销量排行")
|
||||
private Integer fileType;
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer orderNum;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class StoreHomeDecorationDTO {
|
|||
private Long bizId;
|
||||
@ApiModelProperty(value = "业务名称")
|
||||
private String bizName;
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
@ApiModelProperty(value = "跳转类型")
|
||||
private Integer jumpType;
|
||||
@ApiModelProperty(value = "文件类型 2轮播小图 3店家推荐 4人气爆款 5当季新品 6销量排行")
|
||||
private Integer fileType;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class StoreHomeDecorationResDTO {
|
|||
@ApiModelProperty(value = "档口首页装修模板Num")
|
||||
private Integer templateNum;
|
||||
@ApiModelProperty(value = "档口首页装修大轮播图")
|
||||
private List<DecorationDTO> bannerList;
|
||||
private List<DecorationDTO> bigBannerList;
|
||||
@ApiModelProperty(value = "档口首页装修其它图部分")
|
||||
private List<DecorationDTO> decorationList;
|
||||
|
||||
|
|
@ -30,24 +30,18 @@ public class StoreHomeDecorationResDTO {
|
|||
@ApiModel(value = "档口首页各模块")
|
||||
@Accessors(chain = true)
|
||||
public static class DecorationDTO {
|
||||
|
||||
@ApiModelProperty(value = "业务ID")
|
||||
private Long bizId;
|
||||
@ApiModelProperty(value = "业务名称")
|
||||
private String bizName;
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private Integer jumpType;
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
@ApiModelProperty(value = "文件路径")
|
||||
private String fileUrl;
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private BigDecimal fileSize;
|
||||
@ApiModelProperty(value = "文件类型 1轮播大图")
|
||||
private Integer fileType;
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer orderNum;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|||
import com.ruoyi.xkt.domain.*;
|
||||
import com.ruoyi.xkt.dto.storeHomepage.*;
|
||||
import com.ruoyi.xkt.dto.storeProduct.StoreProdPriceAndMainPicAndTagDTO;
|
||||
import com.ruoyi.xkt.dto.storeProductFile.StoreProdMainPicDTO;
|
||||
import com.ruoyi.xkt.enums.AdDisplayType;
|
||||
import com.ruoyi.xkt.enums.FileType;
|
||||
import com.ruoyi.xkt.enums.HomepageJumpType;
|
||||
import com.ruoyi.xkt.enums.HomepageType;
|
||||
import com.ruoyi.xkt.mapper.*;
|
||||
|
|
@ -111,6 +113,7 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
|
|||
.orElseThrow(() -> new ServiceException("文件不存在", HttpStatus.ERROR));
|
||||
Map<Long, SysFile> fileMap = fileList.stream().collect(Collectors.toMap(SysFile::getId, Function.identity()));
|
||||
Map<Long, StoreProduct> storeProdMap = new HashMap<>();
|
||||
Map<Long, String> mainPicMap = new HashMap<>();
|
||||
// 档口商品ID列表
|
||||
List<Long> storeProdIdList = homeList.stream()
|
||||
.filter(x -> Objects.equals(x.getJumpType(), HomepageJumpType.JUMP_PRODUCT.getValue())).map(StoreHomepage::getBizId).collect(Collectors.toList());
|
||||
|
|
@ -121,6 +124,10 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
|
|||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("档口商品不存在", HttpStatus.ERROR));
|
||||
storeProdMap = storeProdList.stream().collect(Collectors.toMap(StoreProduct::getId, Function.identity()));
|
||||
// 查找排名第一个商品主图列表
|
||||
List<StoreProdMainPicDTO> mainPicList = this.prodFileMapper.selectMainPicByStoreProdIdList(storeProdIdList, FileType.MAIN_PIC.getValue(), ORDER_NUM_1);
|
||||
mainPicMap = CollectionUtils.isEmpty(mainPicList) ? new HashMap<>() : mainPicList.stream()
|
||||
.collect(Collectors.toMap(StoreProdMainPicDTO::getStoreProdId, StoreProdMainPicDTO::getFileUrl));
|
||||
}
|
||||
Map<Long, StoreProduct> finalStoreProdMap = storeProdMap;
|
||||
// 轮播图
|
||||
|
|
@ -131,26 +138,20 @@ public class StoreHomepageServiceImpl implements IStoreHomepageService {
|
|||
? (finalStoreProdMap.containsKey(x.getBizId()) ? finalStoreProdMap.get(x.getBizId()).getProdArtNum() : null)
|
||||
: (ObjectUtils.isEmpty(x.getBizId()) ? null : store.getStoreName()));
|
||||
if (fileMap.containsKey(x.getFileId())) {
|
||||
decorationDTO.setFileType(x.getFileType()).setFileName(fileMap.get(x.getFileId()).getFileName())
|
||||
.setFileUrl(fileMap.get(x.getFileId()).getFileUrl()).setFileSize(fileMap.get(x.getFileId()).getFileSize());
|
||||
decorationDTO.setFileType(x.getFileType()).setFileUrl(fileMap.get(x.getFileId()).getFileUrl());
|
||||
}
|
||||
return decorationDTO;
|
||||
}).collect(Collectors.toList());
|
||||
// 其它图部分
|
||||
Map<Long, String> finalMainPicMap = mainPicMap;
|
||||
List<StoreHomeDecorationResDTO.DecorationDTO> decorList = homeList.stream().filter(x -> !Objects.equals(x.getFileType(), HomepageType.SLIDING_PICTURE.getValue()))
|
||||
.map(x -> {
|
||||
StoreHomeDecorationResDTO.DecorationDTO decorationDTO = BeanUtil.toBean(x, StoreHomeDecorationResDTO.DecorationDTO.class)
|
||||
.setBizName(finalStoreProdMap.containsKey(x.getBizId()) ? finalStoreProdMap.get(x.getBizId()).getProdArtNum() : null);
|
||||
if (fileMap.containsKey(x.getFileId())) {
|
||||
decorationDTO.setFileType(x.getFileType()).setFileName(fileMap.get(x.getFileId()).getFileName())
|
||||
.setFileUrl(fileMap.get(x.getFileId()).getFileUrl()).setFileSize(fileMap.get(x.getFileId()).getFileSize());
|
||||
}
|
||||
return decorationDTO;
|
||||
})
|
||||
.map(x -> BeanUtil.toBean(x, StoreHomeDecorationResDTO.DecorationDTO.class)
|
||||
.setBizName(finalStoreProdMap.containsKey(x.getBizId()) ? finalStoreProdMap.get(x.getBizId()).getProdArtNum() : null)
|
||||
.setFileType(x.getFileType()).setFileUrl(finalMainPicMap.get(x.getBizId())))
|
||||
.collect(Collectors.toList());
|
||||
return new StoreHomeDecorationResDTO() {{
|
||||
setTemplateNum(store.getTemplateNum());
|
||||
setBannerList(bigBannerList);
|
||||
setBigBannerList(bigBannerList);
|
||||
setDecorationList(decorList);
|
||||
}};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue