瀏覽代碼

fix 获取pc实物配置

zoujiajian 2 年之前
父節點
當前提交
4052b14b31

+ 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;
+}

+ 4 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuSpec.java

@@ -24,6 +24,10 @@ 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;
+}

+ 4 - 0
netflix-dao/src/main/java/com/cyksj/model/views/HomeManagementFrontView.java

@@ -1,5 +1,6 @@
 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;
@@ -154,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)
+						.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;
+	}
+}

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

@@ -21,6 +21,7 @@ import com.cyksj.mapper.SysConfigMapper;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.views.*;
 import com.cyksj.redis.RedisService;
+import com.cyksj.service.goods.GoodsDonFrontService;
 import com.cyksj.service.shop.YhShopFrontService;
 import com.cyksj.web.util.StpUserUtil;
 import com.ejlchina.searcher.BeanSearcher;
@@ -59,6 +60,8 @@ public class GoodsDonController {
 
     private final GoodsDonSkuMapper goodsDonSkuMapper;
 
+    private final GoodsDonFrontService goodsDonFrontService;
+
     private final RedisService redisService;
 
     private final SysConfigMapper sysConfigMapper;
@@ -485,6 +488,24 @@ public class GoodsDonController {
         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);
+    }
+
 
     public List<Long> getFilterGoodsIds() {
         //过滤杭州Ai ChatGPT平台