master:获取APP 广告调整;

pull/1121/head
liujiang 2025-05-22 00:05:24 +08:00
parent e2f1b1ec7a
commit 261d097d6c
24 changed files with 1037 additions and 15 deletions

View File

@ -4,6 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.core.controller.XktBaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.web.controller.xkt.vo.advertRound.app.index.APPIndexHotSaleRightFixVO;
import com.ruoyi.web.controller.xkt.vo.advertRound.app.index.APPIndexMidBrandVO;
import com.ruoyi.web.controller.xkt.vo.advertRound.app.category.APPCateVO;
import com.ruoyi.web.controller.xkt.vo.advertRound.app.own.APPOwnGuessLikeVO;
import com.ruoyi.web.controller.xkt.vo.advertRound.pc.PCDownloadVO;
import com.ruoyi.web.controller.xkt.vo.advertRound.pc.PCUserCenterVO;
import com.ruoyi.web.controller.xkt.vo.advertRound.pc.index.*;
import com.ruoyi.web.controller.xkt.vo.advertRound.pc.newArrival.*;
import com.ruoyi.web.controller.xkt.vo.advertRound.pc.store.PCStoreMidBannerVO;
@ -46,6 +52,11 @@ public class WebsiteController extends XktBaseController {
return R.ok(websiteService.search(BeanUtil.toBean(searchVO, IndexSearchDTO.class)));
}
// TODO APP 首页 热卖精选、人气爆品、新品榜 PC 首页 新品馆 列表
// TODO APP 首页 热卖精选、人气爆品、新品榜 PC 首页 新品馆 列表
// TODO APP 首页 热卖精选、人气爆品、新品榜 PC 首页 新品馆 列表
@ApiOperation(value = "PC 首页 顶部横向轮播图", httpMethod = "GET", response = R.class)
@GetMapping("/pc/index/top/left")
public R<List<PCIndexTopLeftBannerVO>> getPcIndexTopLeftBanner() {
@ -148,6 +159,52 @@ public class WebsiteController extends XktBaseController {
return R.ok(BeanUtil.copyToList(websiteService.getPicSearchList(), PicSearchAdvertVO.class));
}
/*@ApiOperation(value = "PC 搜索结果", httpMethod = "GET", response = R.class)
@GetMapping("pc/search-result")
public R<List<PicSearchAdvertVO>> getSearchResultList() {
return R.ok(BeanUtil.copyToList(websiteService.getSearchResultList(), PicSearchAdvertVO.class));
}*/
@ApiOperation(value = "PC 用户中心", httpMethod = "GET", response = R.class)
@GetMapping("/pc/user-center")
public R<List<PCUserCenterVO>> getPcUserCenterList() {
return R.ok(BeanUtil.copyToList(websiteService.getPcUserCenterList(), PCUserCenterVO.class));
}
@ApiOperation(value = "PC 用户中心", httpMethod = "GET", response = R.class)
@GetMapping("/pc/download")
public R<List<PCDownloadVO>> getPcDownloadList() {
return R.ok(BeanUtil.copyToList(websiteService.getPcDownloadList(), PCDownloadVO.class));
}
@ApiOperation(value = "APP 首页顶部轮播图", httpMethod = "GET", response = R.class)
@GetMapping("/app/top/banner")
public R<List<PCDownloadVO>> getAppIndexTopBanner() {
return R.ok(BeanUtil.copyToList(websiteService.getAppIndexTopBanner(), PCDownloadVO.class));
}
@ApiOperation(value = "APP 首页品牌好货", httpMethod = "GET", response = R.class)
@GetMapping("/app/mid/brand")
public R<List<APPIndexMidBrandVO>> getAppIndexMidBrand() {
return R.ok(BeanUtil.copyToList(websiteService.getAppIndexMidBrand(), APPIndexMidBrandVO.class));
}
@ApiOperation(value = "APP 首页热卖精选右侧固定位置", httpMethod = "GET", response = R.class)
@GetMapping("/app/hot-sale/right-fix")
public R<List<APPIndexHotSaleRightFixVO>> getAppIndexHotSaleRightFix() {
return R.ok(BeanUtil.copyToList(websiteService.getAppIndexHotSaleRightFix(), APPIndexHotSaleRightFixVO.class));
}
@ApiOperation(value = "APP 分类页", httpMethod = "GET", response = R.class)
@GetMapping("/app/cate")
public R<List<APPCateVO>> getAppCateList() {
return R.ok(BeanUtil.copyToList(websiteService.getAppCateList(), APPCateVO.class));
}
@ApiOperation(value = "APP 个人中心猜你喜欢", httpMethod = "GET", response = R.class)
@GetMapping("/app/own/guess-like")
public R<List<APPOwnGuessLikeVO>> getAppOwnGuessLikeList() {
return R.ok(BeanUtil.copyToList(websiteService.getAppOwnGuessLikeList(), APPOwnGuessLikeVO.class));
}
}

View File

@ -0,0 +1,31 @@
package com.ruoyi.web.controller.xkt.vo.advertRound.app.category;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("APP分类页")
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class APPCateVO {
@ApiModelProperty(value = "1推广图")
private Integer displayType;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "推广图路径")
private String fileUrl;
}

View File

@ -0,0 +1,33 @@
package com.ruoyi.web.controller.xkt.vo.advertRound.app.index;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("APP首页热卖精选右侧固定广告位")
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class APPIndexHotSaleRightFixVO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
}

View File

@ -0,0 +1,33 @@
package com.ruoyi.web.controller.xkt.vo.advertRound.app.index;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("APP首页品牌好货")
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class APPIndexMidBrandVO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
}

View File

@ -0,0 +1,29 @@
package com.ruoyi.web.controller.xkt.vo.advertRound.app.index;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("APP 首页顶部轮播图")
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@Accessors(chain = true)
public class APPIndexTopBannerVO {
@ApiModelProperty(value = "1推广图")
private Integer displayType;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "推广图路径")
private String fileUrl;
}

View File

@ -0,0 +1,38 @@
package com.ruoyi.web.controller.xkt.vo.advertRound.app.own;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.List;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("APP我的猜你喜欢")
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class APPOwnGuessLikeVO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
@ApiModelProperty(value = "标签列表")
private List<String> tagList;
}

View File

@ -0,0 +1,35 @@
package com.ruoyi.web.controller.xkt.vo.advertRound.pc;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("PC 下载页")
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PCDownloadVO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
@ApiModelProperty(value = "商品标题")
private String prodTitle;
}

View File

@ -0,0 +1,33 @@
package com.ruoyi.web.controller.xkt.vo.advertRound.pc;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("PC 搜索结果")
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PCSearchResultVO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
}

View File

@ -0,0 +1,35 @@
package com.ruoyi.web.controller.xkt.vo.advertRound.pc;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("PC 用户中心")
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PCUserCenterVO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
@ApiModelProperty(value = "商品标题")
private String prodTitle;
}

View File

@ -29,8 +29,9 @@ public class StoreFactoryVO {
private String facName;
@ApiModelProperty(value = "工厂地址")
private String facAddress;
@ApiModelProperty(value = "联系人")
private String facContact;
@ApiModelProperty(value = "工厂联系电话")
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确,请输入有效的中国大陆手机号")
private String facPhone;
@ApiModelProperty(value = "备注")
private String remark;

View File

@ -135,13 +135,40 @@ public class CacheConstants
*
*/
public static final String PIC_SEARCH = "pic_search";
/**
* PC
*/
public static final String PC_USER_CENTER = "pc_user_center";
/**
* PC
*/
public static final String PC_DOWNLOAD = "pc_download";
/**
* APP 广
*/
public static final String APP_ADVERT = "app_advert:";
/**
* APP
*/
public static final String APP_INDEX_TOP_BANNER = "app_index_top_banner";
/**
* APP
*/
public static final String APP_INDEX_MID_BRAND = "app_index_mid_brand";
/**
* APP
*/
public static final String APP_INDEX_HOT_SALE_RIGHT_FIX = "app_index_hot_sale_right_fix";
/**
* APP
*/
public static final String APP_CATE = "app_cate";
/**
* APP
*/
public static final String APP_OWN_GUESS_LIKE = "app_own_guess_like";
/**
*

View File

@ -78,7 +78,7 @@ public enum AdType {
// PC搜索结果
PC_SEARCH_RESULT(401, "电脑端搜索结果", "/url"),
// PC用户中心
// PC用户中心 18个位置
PC_USER_CENTER(402, "电脑端用户中心", "/url"),
// PC下载页
PC_DOWNLOAD(403, "电脑端下载页", "/url"),

View File

@ -24,43 +24,40 @@ public class StoreFactory extends XktBaseEntity {
*/
@TableId
private Long id;
/**
* store.id
*/
@Excel(name = "store.id")
private Long storeId;
/**
*
*/
@Excel(name = "工厂名称")
private String facName;
/**
*
*/
@Excel(name = "工厂地址")
private String facAddress;
/**
*
*/
private String facContact;
/**
*
*/
@Excel(name = "工厂联系电话")
private String facPhone;
/**
*
*/
private String remark;
/**
*
*/
@Excel(name = "工厂状态")
private String facStatus;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -0,0 +1,29 @@
package com.ruoyi.xkt.dto.advertRound.app.category;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("APP分类页")
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class APPCateDTO {
@ApiModelProperty(value = "1推广图")
private Integer displayType;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "推广图路径")
private String fileUrl;
}

View File

@ -0,0 +1,33 @@
package com.ruoyi.xkt.dto.advertRound.app.index;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("APP首页热卖精选右侧固定广告位")
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class APPIndexHotSaleRightFixDTO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
}

View File

@ -0,0 +1,33 @@
package com.ruoyi.xkt.dto.advertRound.app.index;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("APP首页品牌好货")
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class APPIndexMidBrandDTO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
}

View File

@ -0,0 +1,29 @@
package com.ruoyi.xkt.dto.advertRound.app.index;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("APP 首页顶部轮播图")
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@Accessors(chain = true)
public class APPIndexTopBannerDTO {
@ApiModelProperty(value = "1推广图")
private Integer displayType;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "推广图路径")
private String fileUrl;
}

View File

@ -0,0 +1,38 @@
package com.ruoyi.xkt.dto.advertRound.app.own;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.List;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("APP我的猜你喜欢列表")
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class APPOwnGuessLikeDTO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
@ApiModelProperty(value = "标签列表")
private List<String> tagList;
}

View File

@ -0,0 +1,37 @@
package com.ruoyi.xkt.dto.advertRound.pc;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("PC 下载页")
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@Accessors(chain = true)
public class PCDownloadDTO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
@ApiModelProperty(value = "商品标题")
private String prodTitle;
}

View File

@ -0,0 +1,37 @@
package com.ruoyi.xkt.dto.advertRound.pc;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("PC 用户中心")
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@Accessors(chain = true)
public class PCUserCenterDTO {
@ApiModelProperty(value = "2商品")
private Integer displayType;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "排序")
private Integer orderNum;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "商品第一张主图路径")
private String mainPicUrl;
@ApiModelProperty(value = "商品标题")
private String prodTitle;
}

View File

@ -26,6 +26,8 @@ public class StoreFactoryDTO {
private String facName;
@ApiModelProperty(value = "工厂地址")
private String facAddress;
@ApiModelProperty(value = "联系人")
private String facContact;
@ApiModelProperty(value = "工厂联系电话")
private String facPhone;
@ApiModelProperty("备注")

View File

@ -28,6 +28,8 @@ public class StoreFactoryResDTO {
private String facName;
@ApiModelProperty(value = "工厂地址")
private String facAddress;
@ApiModelProperty(value = "联系人")
private String facContact;
@ApiModelProperty(value = "工厂联系电话")
private String facPhone;
@ApiModelProperty("备注")

View File

@ -1,6 +1,13 @@
package com.ruoyi.xkt.service;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.xkt.dto.advertRound.app.category.APPCateDTO;
import com.ruoyi.xkt.dto.advertRound.app.index.APPIndexHotSaleRightFixDTO;
import com.ruoyi.xkt.dto.advertRound.app.index.APPIndexMidBrandDTO;
import com.ruoyi.xkt.dto.advertRound.app.index.APPIndexTopBannerDTO;
import com.ruoyi.xkt.dto.advertRound.app.own.APPOwnGuessLikeDTO;
import com.ruoyi.xkt.dto.advertRound.pc.PCDownloadDTO;
import com.ruoyi.xkt.dto.advertRound.pc.PCUserCenterDTO;
import com.ruoyi.xkt.dto.advertRound.pc.index.*;
import com.ruoyi.xkt.dto.advertRound.pc.newArrival.*;
import com.ruoyi.xkt.dto.advertRound.pc.store.PCStoreMidBannerDTO;
@ -146,4 +153,52 @@ public interface IWebsiteService {
*/
List<PicSearchAdvertDTO> getPicSearchList();
/**
* PC
*
* @return List<PCUserCenterDTO>
*/
List<PCUserCenterDTO> getPcUserCenterList();
/**
* PC
*
* @return List<PCDownloadDTO>
*/
List<PCDownloadDTO> getPcDownloadList();
/**
* APP
*
* @return List<APPIndexTopBannerDTO>
*/
List<APPIndexTopBannerDTO> getAppIndexTopBanner();
/**
* APP
*
* @return List<APPIndexMidBrandDTO>
*/
List<APPIndexMidBrandDTO> getAppIndexMidBrand();
/**
* APP
*
* @return List<APPIndexHotSaleRightFixDTO>
*/
List<APPIndexHotSaleRightFixDTO> getAppIndexHotSaleRightFix();
/**
* APP
*
* @return List<APPCateDTO>
*/
List<APPCateDTO> getAppCateList();
/**
* APP
*
* @return List<APPOwnGuessLikeDTO>
*/
List<APPOwnGuessLikeDTO> getAppOwnGuessLikeList();
}

View File

@ -14,6 +14,13 @@ import com.ruoyi.common.enums.AdType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.framework.es.EsClientWrapper;
import com.ruoyi.xkt.domain.*;
import com.ruoyi.xkt.dto.advertRound.app.category.APPCateDTO;
import com.ruoyi.xkt.dto.advertRound.app.index.APPIndexHotSaleRightFixDTO;
import com.ruoyi.xkt.dto.advertRound.app.index.APPIndexMidBrandDTO;
import com.ruoyi.xkt.dto.advertRound.app.index.APPIndexTopBannerDTO;
import com.ruoyi.xkt.dto.advertRound.app.own.APPOwnGuessLikeDTO;
import com.ruoyi.xkt.dto.advertRound.pc.PCDownloadDTO;
import com.ruoyi.xkt.dto.advertRound.pc.PCUserCenterDTO;
import com.ruoyi.xkt.dto.advertRound.pc.index.*;
import com.ruoyi.xkt.dto.advertRound.pc.newArrival.*;
import com.ruoyi.xkt.dto.advertRound.pc.store.PCStoreMidBannerDTO;
@ -302,8 +309,8 @@ public class WebsiteServiceImpl implements IWebsiteService {
if (CollectionUtils.isEmpty(cateSaleList)) {
return new ArrayList<>();
}
List<StoreProdPriceAndMainPicDTO> prodPriceAndMainPicList = this.storeProdMapper
.selectPriceAndMainPicList(cateSaleList.stream().map(CateSaleRankDTO::getStoreProdId).collect(Collectors.toList()));
List<StoreProdPriceAndMainPicDTO> prodPriceAndMainPicList = this.storeProdMapper.selectPriceAndMainPicList(cateSaleList.stream()
.map(CateSaleRankDTO::getStoreProdId).collect(Collectors.toList()));
// 档口商品的价格及商品主图map
Map<Long, StoreProdPriceAndMainPicDTO> prodPriceAndMainPicMap = prodPriceAndMainPicList.stream().collect(Collectors
.toMap(StoreProdPriceAndMainPicDTO::getStoreProdId, Function.identity()));
@ -1049,7 +1056,6 @@ public class WebsiteServiceImpl implements IWebsiteService {
* 广
*
* @return List<PicSearchAdvertDTO>
* @param count
*/
@Override
@Transactional(readOnly = true)
@ -1082,11 +1088,15 @@ public class WebsiteServiceImpl implements IWebsiteService {
// 商品标签
List<DailyProdTag> prodTagList = this.dailyProdTagMapper.selectList(new LambdaQueryWrapper<DailyProdTag>()
.eq(DailyProdTag::getDelFlag, Constants.UNDELETED).in(DailyProdTag::getStoreProdId, storeProdIdList));
Map<Long, List<String>> prodTagMap = prodTagList.stream().collect(Collectors.groupingBy(DailyProdTag::getStoreProdId, Collectors.mapping(DailyProdTag::getTag, Collectors.toList())));
Map<Long, List<String>> prodTagMap = prodTagList.stream().collect(Collectors.groupingBy(DailyProdTag::getStoreProdId, Collectors
.collectingAndThen(Collectors.toList(), list -> list.stream()
.sorted(Comparator.comparing(DailyProdTag::getType)).map(DailyProdTag::getTag).collect(Collectors.toList()))));
// 档口标签
List<DailyStoreTag> storeTagList = this.dailyStoreTagMapper.selectList(new LambdaQueryWrapper<DailyStoreTag>()
.eq(DailyStoreTag::getDelFlag, Constants.UNDELETED).in(DailyStoreTag::getStoreId, storeList.stream().map(Store::getId).collect(Collectors.toList())));
Map<Long, List<String>> storeTagMap = storeTagList.stream().collect(Collectors.groupingBy(DailyStoreTag::getStoreId, Collectors.mapping(DailyStoreTag::getTag, Collectors.toList())));
Map<Long, List<String>> storeTagMap = storeTagList.stream().collect(Collectors
.groupingBy(DailyStoreTag::getStoreId, Collectors.collectingAndThen(Collectors.toList(), list -> list.stream()
.sorted(Comparator.comparing(DailyStoreTag::getType)).map(DailyStoreTag::getTag).collect(Collectors.toList()))));
List<AdvertRound> launchingList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.LAUNCHING.getValue())).collect(Collectors.toList());
List<AdvertRound> expiredList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.EXPIRED.getValue())).collect(Collectors.toList());
// 从正在播放的图搜热款广告或者历史广告中筛选10条
@ -1097,6 +1107,374 @@ public class WebsiteServiceImpl implements IWebsiteService {
return picSearchList;
}
/**
* PC
*
* @return List<PCUserCenterDTO>
*/
@Override
@Transactional(readOnly = true)
public List<PCUserCenterDTO> getPcUserCenterList() {
// 从redis中获取 用户中心数据
List<PCUserCenterDTO> pcUserCenterList;
List<PCUserCenterDTO> redisList = redisCache.getCacheObject(CacheConstants.PC_ADVERT + CacheConstants.PC_USER_CENTER);
if (CollectionUtils.isNotEmpty(redisList)) {
return redisList;
}
List<AdvertRound> oneMonthList = this.getOneMonthAdvertList(Collections.singletonList(AdType.PC_USER_CENTER.getValue()));
if (CollectionUtils.isEmpty(oneMonthList)) {
return new ArrayList<>();
}
List<StoreProdPriceAndMainPicDTO> prodPriceAndMainPicList = this.storeProdMapper.selectPriceAndMainPicList(oneMonthList.stream()
.map(AdvertRound::getProdIdStr).map(Long::parseLong).collect(Collectors.toList()));
// 档口商品的价格及商品主图map
Map<Long, StoreProdPriceAndMainPicDTO> prodPriceAndMainPicMap = prodPriceAndMainPicList.stream().collect(Collectors
.toMap(StoreProdPriceAndMainPicDTO::getStoreProdId, Function.identity()));
List<AdvertRound> launchingList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.LAUNCHING.getValue())).collect(Collectors.toList());
List<AdvertRound> expiredList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.EXPIRED.getValue())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(launchingList)) {
pcUserCenterList = expiredList.stream().map(x -> this.getPcUserCenterDTO(x, prodPriceAndMainPicMap)).limit(18).collect(Collectors.toList());
for (int i = 0; i < pcUserCenterList.size(); i++) {
pcUserCenterList.get(i).setOrderNum(i + 1);
}
} else {
pcUserCenterList = launchingList.stream().map(x -> this.getPcUserCenterDTO(x, prodPriceAndMainPicMap)
.setOrderNum(this.positionToNumber(x.getPosition()))).limit(18).collect(Collectors.toList());
}
// 放到redis 中 过期时间1天
redisCache.setCacheObject(CacheConstants.PC_ADVERT + CacheConstants.PC_USER_CENTER, pcUserCenterList, 1, TimeUnit.DAYS);
return pcUserCenterList;
}
/**
* PC
*
* @return List<PCDownloadDTO>
*/
@Override
@Transactional(readOnly = true)
public List<PCDownloadDTO> getPcDownloadList() {
// 从redis中获取 下载页数据
List<PCDownloadDTO> pcDownloadList;
List<PCDownloadDTO> redisList = redisCache.getCacheObject(CacheConstants.PC_ADVERT + CacheConstants.PC_DOWNLOAD);
if (CollectionUtils.isNotEmpty(redisList)) {
return redisList;
}
List<AdvertRound> oneMonthList = this.getOneMonthAdvertList(Collections.singletonList(AdType.PC_DOWNLOAD.getValue()));
if (CollectionUtils.isEmpty(oneMonthList)) {
return new ArrayList<>();
}
List<StoreProdPriceAndMainPicDTO> prodPriceAndMainPicList = this.storeProdMapper.selectPriceAndMainPicList(oneMonthList.stream()
.map(AdvertRound::getProdIdStr).map(Long::parseLong).collect(Collectors.toList()));
Map<Long, StoreProdPriceAndMainPicDTO> prodPriceAndMainPicMap = prodPriceAndMainPicList.stream().collect(Collectors
.toMap(StoreProdPriceAndMainPicDTO::getStoreProdId, Function.identity()));
List<AdvertRound> launchingList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.LAUNCHING.getValue())).collect(Collectors.toList());
List<AdvertRound> expiredList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.EXPIRED.getValue())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(launchingList)) {
pcDownloadList = expiredList.stream().map(advertRound -> this.getPcDownload(advertRound, prodPriceAndMainPicMap)).limit(10).collect(Collectors.toList());
for (int i = 0; i < pcDownloadList.size(); i++) {
pcDownloadList.get(i).setOrderNum(i + 1);
}
} else {
pcDownloadList = launchingList.stream().map(advertRound -> this.getPcDownload(advertRound, prodPriceAndMainPicMap)
.setOrderNum(this.positionToNumber(advertRound.getPosition()))).limit(10).collect(Collectors.toList());
}
// 放到redis 中 过期时间1天
redisCache.setCacheObject(CacheConstants.PC_ADVERT + CacheConstants.PC_DOWNLOAD, pcDownloadList, 1, TimeUnit.DAYS);
return pcDownloadList;
}
/**
* APP
*
* @return List<APPIndexTopBannerDTO>
*/
@Override
@Transactional(readOnly = true)
public List<APPIndexTopBannerDTO> getAppIndexTopBanner() {
List<APPIndexTopBannerDTO> appIndexTopBannerList;
// 从redis中获取数据
List<APPIndexTopBannerDTO> redisList = redisCache.getCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_TOP_BANNER);
if (CollectionUtils.isNotEmpty(redisList)) {
return redisList;
}
List<AdvertRound> oneMonthList = this.getOneMonthAdvertList(Collections.singletonList(AdType.APP_HOME_TOP_BANNER.getValue()));
if (CollectionUtils.isEmpty(oneMonthList)) {
return new ArrayList<>();
}
Map<Long, SysFile> fileMap = fileMapper.selectList(new LambdaQueryWrapper<SysFile>().eq(SysFile::getDelFlag, Constants.UNDELETED)
.in(SysFile::getId, oneMonthList.stream().map(AdvertRound::getPicId).filter(ObjectUtils::isNotEmpty).collect(Collectors.toList())))
.stream().collect(Collectors.toMap(SysFile::getId, Function.identity()));
List<AdvertRound> launchingList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.LAUNCHING.getValue())).collect(Collectors.toList());
List<AdvertRound> expiredList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.EXPIRED.getValue())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(launchingList)) {
List<APPIndexTopBannerDTO> tempList = new ArrayList<>();
expiredList.stream().collect(Collectors.groupingBy(AdvertRound::getStoreId))
.forEach((storeId, list) -> {
AdvertRound advertRound = list.get(0);
tempList.add(new APPIndexTopBannerDTO().setDisplayType(AdDisplayType.PICTURE.getValue()).setStoreId(storeId)
.setFileUrl(ObjectUtils.isNotEmpty(fileMap.get(advertRound.getPicId())) ? fileMap.get(advertRound.getPicId()).getFileUrl() : ""));
});
appIndexTopBannerList = tempList.stream().limit(5).collect(Collectors.toList());
for (int i = 0; i < appIndexTopBannerList.size(); i++) {
appIndexTopBannerList.get(i).setOrderNum(i + 1);
}
} else {
appIndexTopBannerList = launchingList.stream().map(x -> new APPIndexTopBannerDTO().setDisplayType(AdDisplayType.PICTURE.getValue())
.setStoreId(x.getStoreId()).setOrderNum(this.positionToNumber(x.getPosition()))
.setFileUrl(ObjectUtils.isNotEmpty(fileMap.get(x.getPicId())) ? fileMap.get(x.getPicId()).getFileUrl() : ""))
.collect(Collectors.toList());
}
// 放到redis 中 过期时间1天
redisCache.setCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_TOP_BANNER, appIndexTopBannerList, 1, TimeUnit.DAYS);
return appIndexTopBannerList;
}
/**
* APP
*
* @return List<APPIndexMidBrandDTO>
*/
@Override
@Transactional(readOnly = true)
public List<APPIndexMidBrandDTO> getAppIndexMidBrand() {
List<APPIndexMidBrandDTO> appIndexMidBrandList;
// 从redis 中获取数据
List<APPIndexMidBrandDTO> redisList = redisCache.getCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_MID_BRAND);
if (CollectionUtils.isNotEmpty(redisList)) {
return redisList;
}
List<AdvertRound> oneMonthList = this.getOneMonthAdvertList(Collections.singletonList(AdType.APP_HOME_RECOMMEND_PRODUCT.getValue()));
if (CollectionUtils.isEmpty(oneMonthList)) {
return new ArrayList<>();
}
List<StoreProdPriceAndMainPicDTO> prodPriceAndMainPicList = this.storeProdMapper.selectPriceAndMainPicList(oneMonthList.stream()
.map(AdvertRound::getProdIdStr).map(Long::parseLong).collect(Collectors.toList()));
Map<Long, StoreProdPriceAndMainPicDTO> prodPriceAndMainPicMap = prodPriceAndMainPicList.stream().collect(Collectors
.toMap(StoreProdPriceAndMainPicDTO::getStoreProdId, Function.identity()));
List<AdvertRound> launchingList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.LAUNCHING.getValue())).collect(Collectors.toList());
List<AdvertRound> expiredList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.EXPIRED.getValue())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(launchingList)) {
appIndexMidBrandList = this.getAppIndexMidBrandList(expiredList, 5, prodPriceAndMainPicMap);
} else {
appIndexMidBrandList = launchingList.stream().map(x -> {
final Long storeProdId = Long.parseLong(x.getProdIdStr());
return new APPIndexMidBrandDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId).setOrderNum(this.positionToNumber(x.getPosition()))
.setPrice(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMinPrice() : null)
.setMainPicUrl(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMainPicUrl() : "");
}).limit(5).collect(Collectors.toList());
if (appIndexMidBrandList.size() < 5) {
appIndexMidBrandList.addAll(this.getAppIndexMidBrandList(expiredList, 5 - appIndexMidBrandList.size(), prodPriceAndMainPicMap));
}
}
for (int i = 0; i < appIndexMidBrandList.size(); i++) {
appIndexMidBrandList.get(i).setOrderNum(i + 1);
}
// 放到redis中过期时间为1天
redisCache.setCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_MID_BRAND, appIndexMidBrandList, 1, TimeUnit.DAYS);
return appIndexMidBrandList;
}
/**
* APP
*
* @param advertRoundList
* @param limitCount
* @param prodPriceAndMainPicMap map
* @return List<APPIndexMidBrandDTO>
*/
private List<APPIndexMidBrandDTO> getAppIndexMidBrandList(List<AdvertRound> advertRoundList, int limitCount, Map<Long, StoreProdPriceAndMainPicDTO> prodPriceAndMainPicMap) {
return advertRoundList.stream().map(x -> {
final Long storeProdId = Long.parseLong(x.getProdIdStr());
return new APPIndexMidBrandDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId)
.setPrice(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMinPrice() : null)
.setMainPicUrl(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMainPicUrl() : "");
}).limit(limitCount).collect(Collectors.toList());
}
/**
* APP
*
* @return List<APPIndexHotSaleRightFixDTO>
*/
@Override
@Transactional(readOnly = true)
public List<APPIndexHotSaleRightFixDTO> getAppIndexHotSaleRightFix() {
// 从redis中获取数据
List<APPIndexHotSaleRightFixDTO> appIndexHotSaleRightFixList;
// 从redis 中获取数据
List<APPIndexHotSaleRightFixDTO> redisList = redisCache.getCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_HOT_SALE_RIGHT_FIX);
if (CollectionUtils.isNotEmpty(redisList)) {
return redisList;
}
List<AdvertRound> oneMonthList = this.getOneMonthAdvertList(Collections.singletonList(AdType.APP_HOME_HOT_RECOMMEND_FIXED_PROD.getValue()));
if (CollectionUtils.isEmpty(oneMonthList)) {
return new ArrayList<>();
}
List<StoreProdPriceAndMainPicDTO> prodPriceAndMainPicList = this.storeProdMapper.selectPriceAndMainPicList(oneMonthList.stream()
.map(AdvertRound::getProdIdStr).map(Long::parseLong).collect(Collectors.toList()));
Map<Long, StoreProdPriceAndMainPicDTO> prodPriceAndMainPicMap = prodPriceAndMainPicList.stream().collect(Collectors
.toMap(StoreProdPriceAndMainPicDTO::getStoreProdId, Function.identity()));
List<AdvertRound> launchingList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.LAUNCHING.getValue())).collect(Collectors.toList());
List<AdvertRound> expiredList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.EXPIRED.getValue())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(launchingList)) {
appIndexHotSaleRightFixList = expiredList.stream().map(x -> {
Long storeProdId = Long.parseLong(x.getProdIdStr());
return new APPIndexHotSaleRightFixDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId)
.setMainPicUrl(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMainPicUrl() : "");
}).limit(5).collect(Collectors.toList());
for (int i = 0; i < appIndexHotSaleRightFixList.size(); i++) {
appIndexHotSaleRightFixList.get(i).setOrderNum(i + 1);
}
} else {
appIndexHotSaleRightFixList = launchingList.stream().map(x -> {
Long storeProdId = Long.parseLong(x.getProdIdStr());
return new APPIndexHotSaleRightFixDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId).setOrderNum(this.positionToNumber(x.getPosition()))
.setMainPicUrl(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMainPicUrl() : "");
}).limit(5).collect(Collectors.toList());
}
// 放到redis中有效期1天
redisCache.setCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_INDEX_HOT_SALE_RIGHT_FIX, appIndexHotSaleRightFixList, 1, TimeUnit.DAYS);
return appIndexHotSaleRightFixList;
}
/**
* APP
*
* @return List<APPCateDTO>
*/
@Override
@Transactional(readOnly = true)
public List<APPCateDTO> getAppCateList() {
List<APPCateDTO> appCateList;
// 从redis中获取数据
List<APPCateDTO> redisList = redisCache.getCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_CATE);
if (CollectionUtils.isNotEmpty(redisList)) {
return redisList;
}
List<AdvertRound> oneMonthList = this.getOneMonthAdvertList(Collections.singletonList(AdType.APP_CATEGORY_TOP_BANNER.getValue()));
if (CollectionUtils.isEmpty(oneMonthList)) {
return new ArrayList<>();
}
Map<Long, SysFile> fileMap = fileMapper.selectList(new LambdaQueryWrapper<SysFile>().eq(SysFile::getDelFlag, Constants.UNDELETED)
.in(SysFile::getId, oneMonthList.stream().map(AdvertRound::getPicId).filter(ObjectUtils::isNotEmpty).collect(Collectors.toList())))
.stream().collect(Collectors.toMap(SysFile::getId, Function.identity()));
List<AdvertRound> launchingList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.LAUNCHING.getValue())).collect(Collectors.toList());
List<AdvertRound> expiredList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.EXPIRED.getValue())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(launchingList)) {
List<APPCateDTO> tempList = new ArrayList<>();
expiredList.stream().collect(Collectors.groupingBy(AdvertRound::getStoreId))
.forEach((storeId, list) -> {
AdvertRound advertRound = list.get(0);
tempList.add(new APPCateDTO().setDisplayType(AdDisplayType.PICTURE.getValue()).setStoreId(advertRound.getStoreId())
.setFileUrl(ObjectUtils.isNotEmpty(fileMap.get(advertRound.getPicId())) ? fileMap.get(advertRound.getPicId()).getFileUrl() : ""));
});
appCateList = tempList.stream().limit(5).collect(Collectors.toList());
for (int i = 0; i < appCateList.size(); i++) {
appCateList.get(i).setOrderNum(i + 1);
}
} else {
appCateList = launchingList.stream().map(x -> new APPCateDTO().setDisplayType(AdDisplayType.PICTURE.getValue())
.setStoreId(x.getStoreId()).setOrderNum(this.positionToNumber(x.getPosition()))
.setFileUrl(ObjectUtils.isNotEmpty(fileMap.get(x.getPicId())) ? fileMap.get(x.getPicId()).getFileUrl() : ""))
.collect(Collectors.toList());
}
// 放到redis中有效期1天
redisCache.setCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_CATE, appCateList, 1, TimeUnit.DAYS);
return appCateList;
}
/**
* APP
*
* @return List<APPOwnGuessLikeDTO>
*/
@Override
@Transactional(readOnly = true)
public List<APPOwnGuessLikeDTO> getAppOwnGuessLikeList() {
List<APPOwnGuessLikeDTO> appOwnGuessLikeList;
// 从redis中获取缓存数据
List<APPOwnGuessLikeDTO> redisList = redisCache.getCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_OWN_GUESS_LIKE);
if (CollectionUtils.isNotEmpty(redisList)) {
return redisList;
}
List<AdvertRound> oneMonthList = this.getOneMonthAdvertList(Collections.singletonList(AdType.APP_USER_CENTER_GUESS_YOU_LIKE.getValue()));
if (CollectionUtils.isEmpty(oneMonthList)) {
return new ArrayList<>();
}
List<Long> storeProdIdList = oneMonthList.stream().map(AdvertRound::getProdIdStr).map(Long::parseLong).collect(Collectors.toList());
// 商品标签
List<DailyProdTag> prodTagList = this.dailyProdTagMapper.selectList(new LambdaQueryWrapper<DailyProdTag>()
.eq(DailyProdTag::getDelFlag, Constants.UNDELETED).in(DailyProdTag::getStoreProdId, storeProdIdList));
Map<Long, List<String>> prodTagMap = prodTagList.stream().collect(Collectors.groupingBy(DailyProdTag::getStoreProdId, Collectors
.collectingAndThen(Collectors.toList(), list -> list.stream()
.sorted(Comparator.comparing(DailyProdTag::getType)).map(DailyProdTag::getTag).collect(Collectors.toList()))));
List<StoreProdPriceAndMainPicDTO> prodPriceAndMainPicList = this.storeProdMapper.selectPriceAndMainPicList(oneMonthList.stream()
.map(AdvertRound::getProdIdStr).map(Long::parseLong).collect(Collectors.toList()));
Map<Long, StoreProdPriceAndMainPicDTO> prodPriceAndMainPicMap = prodPriceAndMainPicList.stream().collect(Collectors
.toMap(StoreProdPriceAndMainPicDTO::getStoreProdId, Function.identity()));
List<AdvertRound> launchingList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.LAUNCHING.getValue())).collect(Collectors.toList());
List<AdvertRound> expiredList = oneMonthList.stream().filter(x -> Objects.equals(x.getLaunchStatus(), AdLaunchStatus.EXPIRED.getValue())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(launchingList)) {
appOwnGuessLikeList = expiredList.stream().map(x -> {
final Long storeProdId = Long.parseLong(x.getProdIdStr());
return new APPOwnGuessLikeDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId)
.setTagList(ObjectUtils.isNotEmpty(prodTagMap.get(storeProdId)) ? prodTagMap.get(storeProdId) : null)
.setPrice(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMinPrice() : null)
.setProdArtNum(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getProdArtNum() : "")
.setMainPicUrl(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMainPicUrl() : "");
}).limit(20).collect(Collectors.toList());
for (int i = 0; i < appOwnGuessLikeList.size(); i++) {
appOwnGuessLikeList.get(i).setOrderNum(i + 1);
}
} else {
appOwnGuessLikeList = launchingList.stream().map(x -> {
final Long storeProdId = Long.parseLong(x.getProdIdStr());
return new APPOwnGuessLikeDTO().setDisplayType(AdDisplayType.PRODUCT.getValue()).setStoreProdId(storeProdId).setOrderNum(this.positionToNumber(x.getPosition()))
.setTagList(ObjectUtils.isNotEmpty(prodTagMap.get(storeProdId)) ? prodTagMap.get(storeProdId) : null)
.setPrice(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMinPrice() : null)
.setProdArtNum(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getProdArtNum() : "")
.setMainPicUrl(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMainPicUrl() : "");
}).limit(20).collect(Collectors.toList());
}
// 放到redis中有效期1天
redisCache.setCacheObject(CacheConstants.APP_ADVERT + CacheConstants.APP_OWN_GUESS_LIKE, appOwnGuessLikeList, 1, TimeUnit.DAYS);
return appOwnGuessLikeList;
}
/**
* PC
*
* @param advertRound 广
* @param prodPriceAndMainPicMap
* @return PCDownloadDTO
*/
private PCDownloadDTO getPcDownload(AdvertRound advertRound, Map<Long, StoreProdPriceAndMainPicDTO> prodPriceAndMainPicMap) {
final Long storeProdId = Long.parseLong(advertRound.getProdIdStr());
return new PCDownloadDTO().setDisplayType(AdDisplayType.PRODUCT.getValue())
.setPrice(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMinPrice() : null)
.setProdArtNum(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getProdArtNum() : "")
.setMainPicUrl(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMainPicUrl() : "");
}
/**
* PC 广
*
* @param advertRound
* @param prodPriceAndMainPicMap map
* @return PCUserCenterDTO
*/
private PCUserCenterDTO getPcUserCenterDTO(AdvertRound advertRound, Map<Long, StoreProdPriceAndMainPicDTO> prodPriceAndMainPicMap) {
final Long storeProdId = Long.parseLong(advertRound.getProdIdStr());
return new PCUserCenterDTO().setDisplayType(AdDisplayType.PRODUCT.getValue())
.setPrice(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMinPrice() : null)
.setProdArtNum(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getProdArtNum() : "")
.setMainPicUrl(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getMainPicUrl() : "")
.setProdTitle(ObjectUtils.isNotEmpty(prodPriceAndMainPicMap.get(storeProdId)) ? prodPriceAndMainPicMap.get(storeProdId).getProdTitle() : "");
}
/**
* 广
*