浏览代码

pc首页配置推荐

zoujiajian 2 年之前
父节点
当前提交
e2c7c7e9dd

+ 28 - 0
netflix-dao/src/main/java/com/cyksj/model/dto/RealGoodsConfigDto.java

@@ -0,0 +1,28 @@
+package com.cyksj.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 项目名: yhlxj
+ * 文件名: RealGoodsConfigDto
+ * 创建者: JavaZou
+ * 创建时间:2023/10/19 17:16
+ */
+@Getter
+@Setter
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class RealGoodsConfigDto {
+	private Long id;
+
+	private String title;
+
+	private String logo;
+
+	private String tags;
+
+	private BigDecimal price;
+}

+ 1 - 15
netflix-dao/src/main/java/com/cyksj/model/entity/HomeManagementConfig.java

@@ -1,7 +1,5 @@
 package com.cyksj.model.entity;
 
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
-import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -30,18 +28,6 @@ public class HomeManagementConfig extends BaseEntity{
 
 	private Boolean status;
 
-	/**
-	 * 定时上下架状态 默认null
-	 */
-	@TableField(updateStrategy = FieldStrategy.IGNORED)
-	private Boolean preStatus;
-
-	/**
-	 * 定时上下架时间
-	 */
-	@TableField(updateStrategy = FieldStrategy.IGNORED)
-	private Long time;
-
 	private Boolean deleted;
 
 	private AdType adType;
@@ -73,4 +59,4 @@ public class HomeManagementConfig extends BaseEntity{
 			this.desc = desc;
 		}
 	}
-}
+}

+ 5 - 1
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuSpec.java

@@ -24,8 +24,12 @@ public class ReqGoodsSkuSpec {
 
         private String value;
 
+        private Boolean hide;
+
+        private String logo;
+
         private BigDecimal price;
 
         private String benefitsList;
     }
-}
+}

+ 142 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonDetailFrontView.java

@@ -0,0 +1,142 @@
+package com.cyksj.model.views;
+
+import com.cyksj.model.entity.GoodsDon;
+import com.ejlchina.searcher.bean.DbIgnore;
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 项目名: yhlxj
+ * 文件名: GoodsDonDetailFrontView
+ * 创建者: JavaZou
+ * 创建时间:2023/10/19 17:42
+ */
+@Getter
+@Setter
+@SearchBean(tables = "goods_don",
+		where = "deleted is true and status is true")
+public class GoodsDonDetailFrontView {
+	private Integer id;
+
+	/**
+	 * 标签
+	 */
+	private String tags;
+
+	/**
+	 * 商品名称
+	 */
+	private String title;
+
+	/**
+	 * 缩略图
+	 */
+	private String logo;
+
+	/**
+	 * 背景图
+	 */
+	private String img;
+
+	/**
+	 * 详情
+	 */
+	private String detail;
+
+	/**
+	 * 描述
+	 */
+	private String remark;
+
+	private Integer type;
+
+	/**
+	 * 分类
+	 * 1、AI  2、流媒体
+	 */
+	private Integer category;
+
+	/**
+	 * 二级分类
+	 * 虚物品 1邀请制 2非邀请制
+	 */
+	private Integer secondType;
+
+	private String banner;
+
+	/**
+	 * 最小规格价格
+	 */
+	private BigDecimal minPrice;
+
+	/**
+	 * 最小规格价格月份
+	 */
+	private Integer minMonths;
+
+	/**
+	 * 最小规格 天数
+	 */
+	private Integer minDays;
+
+	/**
+	 * 最大规格价格
+	 */
+	private BigDecimal maxPrice;
+
+	/**
+	 * 最大规格价格月份
+	 */
+	private Integer maxMonths;
+
+	/**
+	 * 最大规格 天数
+	 */
+	private Integer maxDays;
+
+	/**
+	 * 付款说明
+	 */
+	private String payDesc;
+
+	/**
+	 * 特殊类型
+	 */
+	private GoodsDon.SpecialType specialType;
+
+	/**
+	 * 视频
+	 */
+	private String video;
+
+	/**
+	 * 推荐标题
+	 */
+	private String recommendTitle;
+
+	/**
+	 * 推荐平台
+	 */
+	private String recommendGoods;
+
+	private Boolean isSp;
+
+	@DbIgnore
+	private List<GoodsDonSkuFrontView> skuList;
+
+	@DbIgnore
+	private GoodsDonSpecFrontView specs;
+
+	@DbIgnore
+	private String giftCards;
+
+	@DbIgnore
+	private List<GoodsSkuGiftCardView> giftCardsView;
+
+	@DbIgnore
+	private OrderCommentFrontView comments;
+}

+ 24 - 5
netflix-dao/src/main/java/com/cyksj/model/views/HomeManagementFrontView.java

@@ -1,11 +1,13 @@
 package com.cyksj.model.views;
 
+import com.cyksj.model.dto.RealGoodsConfigDto;
 import com.cyksj.model.entity.GoodsDon;
 import com.cyksj.model.entity.GoodsDonSpec;
 import com.cyksj.model.entity.HomeManagementConfig;
 import com.ejlchina.searcher.bean.DbField;
 import com.ejlchina.searcher.bean.DbIgnore;
 import com.ejlchina.searcher.bean.SearchBean;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import lombok.Getter;
 import lombok.Setter;
@@ -47,6 +49,9 @@ public class HomeManagementFrontView {
 	@DbField("hc.type")
 	private HomeManagementConfig.Type type;
 
+	@DbField("hc.ad_type")
+	private HomeManagementConfig.AdType adType;
+
 	@DbField("hc.pic")
 	private String pic;
 
@@ -71,15 +76,19 @@ public class HomeManagementFrontView {
 	@DbField("g.img")
 	private String goodsImg;
 
-	@DbField("g.match_img")
-	private String matchImg;
-
 	/**
 	 * 类型
 	 */
 	@DbField("g.type")
 	private Integer goodsType;
 
+	/**
+	 * 分类
+	 * 1、AI  2、流媒体
+	 */
+	@DbField("g.category")
+	private Long category;
+
 	@DbField("g.second_type")
 	private Integer secondType;
 
@@ -107,9 +116,16 @@ public class HomeManagementFrontView {
 	/**
 	 * 已售
 	 */
-	@DbField("g.virtual_sold")
+	@DbIgnore
 	private Integer sold;
 
+	/**
+	 * 虚拟销量
+	 */
+	@DbField("g.virtual_sold")
+	@JsonIgnore
+	private Integer virtualSold;
+
 	@DbIgnore
 	private BigDecimal specificPrice;
 
@@ -139,4 +155,7 @@ public class HomeManagementFrontView {
 
 	@DbIgnore
 	private OrderCommentFrontView comments;
-}
+
+	@DbIgnore
+	private List<RealGoodsConfigDto> subInfoList;
+}

+ 15 - 0
netflix-service/src/main/java/com/cyksj/service/goods/GoodsDonFrontService.java

@@ -0,0 +1,15 @@
+package com.cyksj.service.goods;
+
+import com.cyksj.model.views.HomeManagementFrontView;
+
+import java.util.List;
+
+/**
+ * 项目名: yhlxj
+ * 文件名: GoodsDonFrontService
+ * 创建者: JavaZou
+ * 创建时间:2023/10/19 17:53
+ */
+public interface GoodsDonFrontService {
+	List<HomeManagementFrontView> getRealGoodsConfig() throws Exception;
+}

+ 104 - 0
netflix-service/src/main/java/com/cyksj/service/goods/impl/GoodsDonFrontServiceImpl.java

@@ -0,0 +1,104 @@
+package com.cyksj.service.goods.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.cyksj.common.util.Jsons;
+import com.cyksj.mapper.GoodsDonSpecMapper;
+import com.cyksj.model.dto.RealGoodsConfigDto;
+import com.cyksj.model.entity.GoodsDonSpec;
+import com.cyksj.model.entity.HomeManagementConfig;
+import com.cyksj.model.manage.request.ReqGoodsSkuSpec;
+import com.cyksj.model.views.GoodsDonDetailFrontView;
+import com.cyksj.model.views.HomeManagementFrontView;
+import com.cyksj.service.goods.GoodsDonFrontService;
+import com.ejlchina.searcher.BeanSearcher;
+import com.ejlchina.searcher.param.Operator;
+import com.ejlchina.searcher.util.MapUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 项目名: yhlxj
+ * 文件名: GoodsDonFrontServiceImpl
+ * 创建者: JavaZou
+ * 创建时间:2023/10/19 17:53
+ */
+@Service
+@RequiredArgsConstructor
+public class GoodsDonFrontServiceImpl implements GoodsDonFrontService {
+
+	private final BeanSearcher beanSearcher;
+
+	private final GoodsDonSpecMapper goodsDonSpecMapper;
+
+	@Override
+	public List<HomeManagementFrontView> getRealGoodsConfig() throws Exception {
+		List<HomeManagementFrontView> realGoodsConfigList = beanSearcher.searchAll(HomeManagementFrontView.class, MapUtils.builder().field(HomeManagementFrontView::getType, HomeManagementConfig.Type.rg.name()).build());
+		Map<String, List<RealGoodsConfigDto>> map = new HashMap<>();
+		List<ReqGoodsSkuSpec> reqGoodsSkuSpecList = null;
+		for (HomeManagementFrontView realGoodsConfig : realGoodsConfigList) {
+			if (StrUtil.isEmpty(realGoodsConfig.getTitle())) {
+				continue;
+			}
+			boolean isCtRoute = realGoodsConfig.getTitle().contains("路由器");
+			boolean isCtApple = realGoodsConfig.getTitle().contains("Apple");
+			if (isCtRoute || isCtApple) {
+				List<RealGoodsConfigDto> subInfoList = new ArrayList<>();
+				String type = null;
+				if (CollUtil.isEmpty(reqGoodsSkuSpecList)) {
+					GoodsDonSpec goodsDonSpec = goodsDonSpecMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSpec.class)
+							.eq(GoodsDonSpec::getGoodsId, 15).last("limit 1")
+							.select(GoodsDonSpec::getSpecsJson));
+					reqGoodsSkuSpecList = Jsons.parseList(goodsDonSpec.getSpecsJson(), ReqGoodsSkuSpec.class);
+				}
+				if (CollUtil.isEmpty(realGoodsConfigList)) {
+					continue;
+				}
+				for (ReqGoodsSkuSpec reqGoodsSkuSpec : reqGoodsSkuSpecList) {
+					if (StrUtil.isEmpty(reqGoodsSkuSpec.getKey())) {
+						continue;
+					}
+					boolean subIsCtRoute = reqGoodsSkuSpec.getKey().contains("路由器");
+					boolean subIsCtApple = reqGoodsSkuSpec.getKey().contains("机顶盒");
+					if ((isCtRoute && subIsCtRoute) || (isCtApple && subIsCtApple)) {
+						List<ReqGoodsSkuSpec.Node> values = reqGoodsSkuSpec.getValues();
+						for (ReqGoodsSkuSpec.Node value : values) {
+							RealGoodsConfigDto subInfo = new RealGoodsConfigDto();
+							subInfo.setTitle(value.getValue());
+							subInfo.setLogo(value.getLogo());
+							subInfo.setPrice(value.getPrice());
+							subInfoList.add(subInfo);
+						}
+					}
+				}
+				realGoodsConfig.setSubInfoList(subInfoList);
+			}
+			if (realGoodsConfig.getTitle().contains("潮玩")) {
+				List<GoodsDonDetailFrontView> fashionGoodsList = beanSearcher.searchAll(GoodsDonDetailFrontView.class, MapUtils.builder().field(GoodsDonDetailFrontView::getType, 3)
+						.field(GoodsDonDetailFrontView::getId, 27).op(Operator.NotEqual)
+						.onlySelect(GoodsDonDetailFrontView::getTitle, GoodsDonDetailFrontView::getLogo, GoodsDonDetailFrontView::getMinPrice, GoodsDonDetailFrontView::getId, GoodsDonDetailFrontView::getTags)
+						.build());
+				if (CollUtil.isEmpty(fashionGoodsList)) {
+					continue;
+				}
+				List<RealGoodsConfigDto> subInfoList = new ArrayList<>();
+				for (GoodsDonDetailFrontView fashionGoods : fashionGoodsList) {
+					RealGoodsConfigDto subInfo = new RealGoodsConfigDto();
+					subInfo.setLogo(fashionGoods.getLogo());
+					subInfo.setTitle(fashionGoods.getTitle());
+					subInfo.setPrice(fashionGoods.getMinPrice());
+					subInfo.setTags(fashionGoods.getTags());
+					subInfoList.add(subInfo);
+				}
+				realGoodsConfig.setSubInfoList(subInfoList);
+			}
+		}
+		return realGoodsConfigList;
+	}
+}

+ 40 - 0
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -22,6 +22,7 @@ import com.cyksj.model.entity.*;
 import com.cyksj.model.request.ClickRecordReq;
 import com.cyksj.model.views.*;
 import com.cyksj.redis.RedisService;
+import com.cyksj.service.goods.GoodsDonFrontService;
 import com.cyksj.service.home.ClickRecordFrontService;
 import com.cyksj.service.shop.YhShopFrontService;
 import com.cyksj.web.util.StpUserUtil;
@@ -69,6 +70,8 @@ public class GoodsDonController {
 
 	private final YhShopFrontService yhShopFrontService;
 
+	private final GoodsDonFrontService goodsDonFrontService;
+
 	/**
      * 获取平台商品分类
      */
@@ -906,4 +909,41 @@ public class GoodsDonController {
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
 	}
+
+	/**
+	 * 获取pc广告配置
+	 */
+	@GetMapping("/get/pc/homeManage")
+	public Result<Map<String, List<HomeManagementFrontView>>> getPcHomeManagementFrontPage() {
+		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "pc:homeManage";
+		Object o = redisService.get(key);
+		if (o == null) {
+			MapBuilder builder = MapUtils.builder()
+					.field(HomeManagementFrontView::getAdType, List.of(HomeManagementConfig.AdType.pc.name(), HomeManagementConfig.AdType.pcSec.name(), HomeManagementConfig.AdType.pcDis.name())).op(Operator.InList);
+			List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
+			Map<HomeManagementConfig.AdType, List<HomeManagementFrontView>> map = homeManagementFrontViews.stream().collect(Collectors.groupingBy(HomeManagementFrontView::getAdType));
+			redisService.setNx(key, map, 50 * 60l);
+			o = redisService.get(key);
+		}
+		Map<String, List<HomeManagementFrontView>> map = Jsons.parseObject(o, Map.class);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(map);
+	}
+
+	/**
+	 * 获取pc实物配置
+	 */
+	@GetMapping("/get/pc/realGoodsConfig")
+	public Result<? extends Object> getPcRealGoodsConfig() throws Exception {
+		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "pc:realHomePage";
+		Object o = redisService.get(key);
+		List<HomeManagementFrontView> list = null;
+		if (o == null) {
+			list = goodsDonFrontService.getRealGoodsConfig();
+			redisService.setNx(key, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 300);
+		}
+		if (list == null && o != null) {
+			list = Jsons.parseList(o, HomeManagementFrontView.class);
+		}
+		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
+	}
 }