Просмотр исходного кода

平台详情增加视频、推荐平台

zoujiajian 3 лет назад
Родитель
Сommit
69987e3d9e
20 измененных файлов с 573 добавлено и 87 удалено
  1. 7 4
      netflix-common/src/main/java/com/cyksj/common/util/Jsons.java
  2. 0 3
      netflix-dao/src/main/java/com/cyksj/mapper/OrderDonMapper.java
  3. 23 0
      netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDon.java
  4. 5 0
      netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDonSku.java
  5. 17 0
      netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSpuInsert.java
  6. 16 0
      netflix-dao/src/main/java/com/cyksj/model/manage/views/GoodsDonViewer.java
  7. 155 0
      netflix-dao/src/main/java/com/cyksj/model/manage/views/OrderDonSearchView.java
  8. 28 5
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSkuFrontView.java
  9. 40 0
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSpecFrontView.java
  10. 108 5
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonViews.java
  11. 4 4
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsFrontListView.java
  12. 3 3
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsHomePageView.java
  13. 56 0
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsRecommendViews.java
  14. 0 15
      netflix-dao/src/main/resources/mapper/OrderDonMapper.xml
  15. 23 15
      netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsGoodsDonServiceImpl.java
  16. 9 6
      netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsGoodsDonSpecServiceImpl.java
  17. 2 2
      netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java
  18. 36 20
      netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java
  19. 36 2
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonController.java
  20. 5 3
      netflix-web/src/main/java/com/cyksj/web/controller/payment/OrderController.java

+ 7 - 4
netflix-common/src/main/java/com/cyksj/common/util/Jsons.java

@@ -4,10 +4,7 @@ package com.cyksj.common.util;
 import com.fasterxml.jackson.databind.*;
 import com.fasterxml.jackson.databind.type.TypeFactory;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @author valor
@@ -163,6 +160,12 @@ public class Jsons {
         return parser().convertValue(o, javaType);
     }
 
+
+    public static <T> Set<T> parseSet(String json, Class<T> clazz) throws Exception {
+        JavaType type = parser().getTypeFactory().constructCollectionType(Set.class, clazz);
+        return parser().readValue(json, type);
+    }
+
     /**
      * parse json to ArrayList.
      *

+ 0 - 3
netflix-dao/src/main/java/com/cyksj/mapper/OrderDonMapper.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.cyksj.model.entity.OrderDon;
 import com.cyksj.model.entity.RealGoodsInterestUser;
 import com.cyksj.model.excel.ExcelOrderDonInfo;
-import com.cyksj.model.manage.views.OrderDonView;
 import com.cyksj.model.views.BrokenLineObjView;
 import com.cyksj.model.views.ChannelPopularizeView;
 import com.cyksj.model.views.ChannelStatisticsView;
@@ -30,8 +29,6 @@ public interface OrderDonMapper extends BaseMapper<OrderDon> {
 
 	void updateHasPaymentInterestRealGoodsPayTime();
 
-	OrderDonView getOrderDetail(Long orderId);
-
 	BrokenLineObjView selectPlatBrokenLineMoney(@Param("first") String first, @Param("end") String end);
 
 	BrokenLineObjView selectPersonDistributeBrokenLine(@Param("userId") Long userId, @Param("first") String first, @Param("end") String end);

+ 23 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDon.java

@@ -9,6 +9,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * @author chan
@@ -143,6 +144,28 @@ public class GoodsDon extends BaseEntity {
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private GoodsDon.SpecialType specialType;
 
+    /**
+     * 视频
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private String video;
+
+    /**
+     * 推荐标题
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private String recommendTitle;
+
+    @TableField(exist = false)
+    @DbIgnore
+    private List<Long> recommendGoodsList;
+
+    /**
+     * 推荐平台
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private String recommendGoods;
+
     @TableField(exist = false)
     @DbIgnore
     private BigDecimal price;

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDonSku.java

@@ -28,6 +28,11 @@ public class GoodsDonSku extends BaseEntity {
      */
     private String specIds;
 
+    /**
+     * 重复校验规格ids
+     */
+    private String dupSpecIds;
+
     /**
      * 商品规格 value
      */

+ 17 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSpuInsert.java

@@ -5,6 +5,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
+import java.util.List;
 
 /**
  * @author chan
@@ -105,4 +106,20 @@ public class ReqGoodsSpuInsert {
     private String payDesc;
 
     private GoodsDon.SpecialType specialType;
+
+
+    /**
+     * 视频
+     */
+    private String video;
+
+    /**
+     * 推荐标题
+     */
+    private String recommendTitle;
+
+    /**
+     * 推荐平台
+     */
+    private List<Long> recommendGoodsList;
 }

+ 16 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/GoodsDonViewer.java

@@ -150,5 +150,21 @@ public class GoodsDonViewer {
     @DbIgnore
     private List<GoodsDonSku> skus;
 
+    @DbField("g.video")
+    private String video;
 
+    /**
+     * 推荐标题
+     */
+    @DbField("g.recommend_title")
+    private String recommendTitle;
+
+    /**
+     * 推荐平台
+     */
+    @DbField("g.recommend_goods")
+    private String recommendGoods;
+
+    @DbIgnore
+    private List<Long> recommendGoodsList;
 }

+ 155 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/OrderDonSearchView.java

@@ -0,0 +1,155 @@
+package com.cyksj.model.manage.views;
+
+import com.cyksj.model.entity.GoodsDon;
+import com.cyksj.model.entity.OrderDon;
+import com.cyksj.model.entity.OrderDonWaybill;
+import com.cyksj.model.views.GoodsDonSkuView;
+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 lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/*
+ *项目名: netflix
+ *文件名: OrderDonSearchView
+ *创建者: JavaZou
+ *创建时间:2023/7/28 16:21
+ */
+@Getter
+@Setter
+@SearchBean(tables = "(select * from order_don :orderId:) o left join goods_don_sku sku on o.sku_id = sku.id " +
+		"left join goods_don g on g.id = sku.goods_id " +
+		"left join order_don_transport odt on odt.order_id = o.id")
+public class OrderDonSearchView {
+	@DbField("o.id")
+	private Long id;
+
+	@DbField("o.relation_id")
+	private Long relationId;
+
+	@DbField("g.type")
+	private Integer goodsDonType;
+
+	@DbField("g.second_type")
+	private Integer secondType;
+
+	@DbField("o.order_no")
+	private String orderNo;
+
+	@DbField("g.logo")
+	private String logo;
+
+	@DbField("g.title")
+	private String title;
+
+	@DbField("g.id")
+	private Long goodsId;
+
+	@DbField("g.pay_desc")
+	private String payDesc;
+
+	@DbField("sku.is_benefits")
+	private Boolean isBenefits;
+
+	@DbField("sku.benefits_list")
+	@JsonIgnore
+	private String benefitsList;
+
+	@DbField("sku.spec_val")
+	private String specVal;
+
+	@DbField("sku.months")
+	private Integer months;
+
+	@DbField("o.user_id")
+	@JsonIgnore
+	private Long userId;
+
+	@DbField("o.money")
+	private BigDecimal money;
+
+	@DbField("o.refund_money")
+	@JsonIgnore
+	private BigDecimal refundMoney;
+
+	@DbField("o.balance")
+	private BigDecimal balance;
+
+	@DbField("o.coupon_money")
+	private BigDecimal couponMoney;
+
+	@DbField("o.refund_desc")
+	private String refundDesc;
+
+	@DbField("o.status")
+	private OrderDon.Status status;
+
+	@DbField("o.type")
+	private OrderDon.Type type;
+
+	@DbField("o.num")
+	private Integer num;
+
+	@DbField("o.created_time")
+	private Date createdTime;
+
+	@DbField("o.pay_time")
+	private Date payTime;
+
+	/**
+	 * 收货人
+	 */
+	@DbField("odt.receiver")
+	private String receiver;
+
+	/**
+	 * 手机号
+	 */
+	@DbField("odt.phone")
+	private String phone;
+
+	/**
+	 * 省份
+	 */
+	@DbField("odt.province")
+	private String province;
+
+	/**
+	 * 城市
+	 */
+	@DbField("odt.city")
+	private String city;
+
+	/**
+	 * 区/县
+	 */
+	@DbField("odt.district")
+	private String district;
+
+	/**
+	 * 详细地址
+	 */
+	@DbField("odt.address")
+	private String address;
+
+	@DbField("g.special_type")
+	private GoodsDon.SpecialType specialType;
+
+	@DbIgnore
+	private OrderDonWaybill waybill;
+
+	/**
+	 * 是否可领取实物购买权益
+	 */
+	@DbIgnore
+	private Boolean isHasBenefits;
+
+	@DbIgnore
+	private List<GoodsDonSkuView> benefitsViews;
+}

+ 28 - 5
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonFrontSkuView.java → netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSkuFrontView.java

@@ -1,7 +1,7 @@
 package com.cyksj.model.views;
 
+import com.ejlchina.searcher.bean.DbField;
 import com.ejlchina.searcher.bean.SearchBean;
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -9,19 +9,22 @@ import java.math.BigDecimal;
 
 /*
  *项目名: netflix
- *文件名: GoodsDonFrontSkuView
+ *文件名: GoodsDonSkuFrontView
  *创建者: JavaZou
  *创建时间:2023/4/6 17:58
  */
 @Getter
 @Setter
 @SearchBean(tables = "goods_don_sku")
-public class GoodsDonFrontSkuView {
+public class GoodsDonSkuFrontView {
 
 	private Long id;
 
 	private Long goodsId;
 
+
+	private String subTitle;
+
 	/**
 	 * 商品规格 ids
 	 */
@@ -37,11 +40,30 @@ public class GoodsDonFrontSkuView {
 	 */
 	private String specJson;
 
+	/**
+	 * 规格说明信息
+	 */
+	private String notifyText;
+
+	/**
+	 * 商品预览图
+	 */
+	private String picture;
+
+	/**
+	 * 商品详情图
+	 */
+	private String detail;
+
+	/**
+	 * 标签
+	 */
+	private String tags;
+
 
 	/**
 	 * true 上架 / false 下架
 	 */
-	@JsonIgnore
 	private Boolean status;
 
 	/**
@@ -59,5 +81,6 @@ public class GoodsDonFrontSkuView {
 	 */
 	private Integer days;
 
-	private String notifyText;
+	@DbField("case when spec_val like '%月%' and spec_val not like '%年%' then 0 when spec_val like '%季%' then 1 when spec_val like '%半年%' then 2 when spec_val like '%年%' then 3 else 66 end")
+	private Integer orderBy;
 }

+ 40 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSpecFrontView.java

@@ -0,0 +1,40 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+/*
+ *项目名: netflix
+ *文件名: GoodsDonSpecFrontView
+ *创建者: JavaZou
+ *创建时间:2023/7/26 14:36
+ */
+@Getter
+@Setter
+@SearchBean(tables = "goods_don_spec")
+public class GoodsDonSpecFrontView {
+	private Long id;
+
+	private Long goodsId;
+
+	/**
+	 * 商品总规格 json
+	 */
+	private String specsJson;
+
+	/**
+	 * 规格属性值最大id
+	 */
+	private Long maxId;
+
+	/**
+	 * 商品规格数量
+	 */
+	private Integer specNumber;
+
+	/**
+	 * 属性id - 整体 映射
+	 */
+	private String specMapping;
+}

+ 108 - 5
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonViews.java

@@ -1,13 +1,12 @@
 package com.cyksj.model.views;
 
 import com.cyksj.model.entity.GoodsDon;
-import com.cyksj.model.entity.GoodsDonSku;
-import com.cyksj.model.entity.GoodsDonSpec;
 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;
 
 /**
@@ -17,11 +16,115 @@ import java.util.List;
 
 @Getter
 @Setter
-public class GoodsDonViews extends GoodsDon {
+@SearchBean(tables = "goods_don")
+public class GoodsDonViews {
+
+    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;
 
     @DbIgnore
-    private List<GoodsDonSku> skuList;
+    private List<GoodsDonSkuFrontView> skuList;
 
     @DbIgnore
-    private GoodsDonSpec specs;
+    private GoodsDonSpecFrontView specs;
 }

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

@@ -73,19 +73,19 @@ public class GoodsFrontListView {
 	/**
 	 * 最低规格价格
 	 */
-	@DbIgnore
+	@DbField("g.min_price")
 	private BigDecimal price;
 
 	/**
 	 * 最低规格月份
 	 */
-	@DbIgnore
+	@DbField("g.min_months")
 	private Integer months;
 
 	/**
 	 * 最低规格天数
 	 */
-	@DbIgnore
+	@DbField("g.min_days")
 	private Integer days;
 
 	/**
@@ -108,7 +108,7 @@ public class GoodsFrontListView {
 	private String notifyMsg;
 
 	@DbIgnore
-	private List<GoodsDonFrontSkuView> skuList;
+	private List<GoodsDonSkuFrontView> skuList;
 
 	@DbIgnore
 	private GoodsDonSpec specs;

+ 3 - 3
netflix-dao/src/main/java/com/cyksj/model/views/GoodsHomePageView.java

@@ -62,19 +62,19 @@ public class GoodsHomePageView {
 	/**
 	 * 最低规格价格
 	 */
-	@DbIgnore
+	@DbField("g.min_price")
 	private BigDecimal price;
 
 	/**
 	 * 最低规格月份
 	 */
-	@DbIgnore
+	@DbField("g.min_months")
 	private Integer months;
 
 	/**
 	 * 最低规格天数
 	 */
-	@DbIgnore
+	@DbField("g.min_days")
 	private Integer days;
 
 	/**

+ 56 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GoodsRecommendViews.java

@@ -0,0 +1,56 @@
+package com.cyksj.model.views;
+
+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 lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/*
+ *项目名: netflix
+ *文件名: GoodsRecommendViews
+ *创建者: JavaZou
+ *创建时间:2023/7/26 13:37
+ */
+@Getter
+@Setter
+@SearchBean(tables = "goods_don g",
+		where = "g.deleted is true and g.status is true")
+public class GoodsRecommendViews {
+	@DbField("g.id")
+	private Long goodsId;
+
+	@DbField("g.title")
+	private String title;
+
+	@DbField("g.logo")
+	private String logo;
+
+	@DbField("g.img")
+	private String img;
+
+	@DbField("g.tags")
+	private String tags;
+
+	@DbField("g.type")
+	private Integer type;
+
+	@DbField("g.min_months")
+	private Integer months;
+
+	@DbField("g.min_days")
+	private Integer days;
+
+	@DbField("g.min_price")
+	private BigDecimal price;
+
+	@JsonIgnore
+	@DbField("g.virtual_sold")
+	private Integer virtualSold;
+
+	@DbIgnore
+	private Integer sold;
+}

+ 0 - 15
netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

@@ -71,21 +71,6 @@
                 select id from `order_don` where user_id = s.user_id and goods_id = s.goods_id and status !='close')
     </select>
 
-    <select id="getOrderDetail" resultType="com.cyksj.model.manage.views.OrderDonView">
-        select od.*,
-               gdk.spec_val,
-               gd.title,
-               gd.logo,
-               gd.second_type,
-               gd.type as goodsDonType,
-               gd.pay_desc,
-               gd.special_type
-        from `order_don` od
-                 left join `goods_don_sku` gdk on gdk.id = od.sku_id
-                 left join `goods_don` gd on gd.id = od.goods_id
-        where od.id = #{orderId}
-    </select>
-
     <select id="selectPlatBrokenLineMoney" resultType="com.cyksj.model.views.BrokenLineObjView">
         select min(curdate) as firstDate,
                max(curdate) as lastDate

+ 23 - 15
netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsGoodsDonServiceImpl.java

@@ -3,7 +3,7 @@ package com.cyksj.service.mange.goods;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.cyksj.mapper.GoodsDonMapper;
 import com.cyksj.model.entity.GoodsDon;
-import com.cyksj.model.views.GoodsDonFrontSkuView;
+import com.cyksj.model.views.GoodsDonSkuFrontView;
 import com.cyksj.service.mange.CmsGoodsDonService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.util.MapUtils;
@@ -27,26 +27,34 @@ public class CmsGoodsDonServiceImpl extends ServiceImpl<GoodsDonMapper, GoodsDon
 	@Override
 	public void updateGoodsSkuPrice(Long goodsId, GoodsDon goods) {
 		goods = Optional.ofNullable(goods).orElse(goodsDonMapper.selectById(goodsId));
-		List<GoodsDonFrontSkuView> skuViews = beanSearcher.searchAll(GoodsDonFrontSkuView.class, MapUtils.builder()
-				.field(GoodsDonFrontSkuView::getGoodsId, goodsId)
-				.field(GoodsDonFrontSkuView::getStatus, true)
-				.orderBy(GoodsDonFrontSkuView::getPrice).asc().onlySelect(GoodsDonFrontSkuView::getPrice, GoodsDonFrontSkuView::getMonths, GoodsDonFrontSkuView::getDays)
+		List<GoodsDonSkuFrontView> skuViews = beanSearcher.searchAll(GoodsDonSkuFrontView.class, MapUtils.builder()
+				.field(GoodsDonSkuFrontView::getGoodsId, goodsId)
+				.field(GoodsDonSkuFrontView::getStatus, true)
+				.orderBy(GoodsDonSkuFrontView::getPrice).asc().onlySelect(GoodsDonSkuFrontView::getPrice, GoodsDonSkuFrontView::getMonths, GoodsDonSkuFrontView::getDays)
 				.build());
 		if (!skuViews.isEmpty()) {
-			GoodsDonFrontSkuView min = skuViews.get(0);
+			GoodsDonSkuFrontView min = skuViews.get(0);
+			goods.setMinPrice(min.getPrice());
+			if (min.getDays() == null) {
+				min.setDays(0);
+			}
+			if (min.getMonths() == null) {
+				min.setMonths(0);
+			}
+			goods.setMinMonths(min.getMonths());
+			goods.setMinDays(min.getDays());
 			if (skuViews.size() == 1) {
-				goods.setMinPrice(min.getPrice());
-				goods.setMinMonths(min.getMonths());
-				goods.setMinDays(min.getDays());
-
 				goods.setMaxPrice(min.getPrice());
 				goods.setMaxMonths(min.getMonths());
+				goods.setMaxDays(min.getDays());
 			} else {
-				GoodsDonFrontSkuView max = skuViews.get(skuViews.size() - 1);
-				goods.setMinPrice(min.getPrice());
-				goods.setMinMonths(min.getMonths());
-				goods.setMinDays(min.getDays());
-
+				GoodsDonSkuFrontView max = skuViews.get(skuViews.size() - 1);
+				if (max.getDays() == null) {
+					max.setDays(0);
+				}
+				if (max.getMonths() == null) {
+					max.setMonths(0);
+				}
 				goods.setMaxPrice(max.getPrice());
 				goods.setMaxMonths(max.getMonths());
 				goods.setMaxDays(max.getDays());

+ 9 - 6
netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsGoodsDonSpecServiceImpl.java

@@ -19,7 +19,6 @@ import com.cyksj.model.manage.request.ReqGoodsSkuSpec;
 import com.cyksj.model.manage.request.ReqGoodsSpecSingle;
 import com.cyksj.model.request.CombinationSkuReq;
 import com.cyksj.service.mange.CmsGoodsDonSpecService;
-import com.cyksj.service.sys.SysConfigService;
 import com.fasterxml.jackson.databind.JavaType;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -44,8 +43,6 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 
 	private final GoodsDonSkuMapper goodsDonSkuMapper;
 
-	private final SysConfigService sysConfigService;
-
 	@Override
 	public void insertOrUpdateSkuSpec(ReqGoodsSkuInsert insert) throws Exception {
 		GoodsDon goods = goodsDonMapper.selectById(insert.getGoodsId());
@@ -200,14 +197,20 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
 				goodsDonSku.setGoodsId(insert.getGoodsId());
 			}
 			BeanUtil.copyProperties(sku, goodsDonSku);
-			GoodsDonSku specIds_exists = goodsDonSkuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class).eq(GoodsDonSku::getSpecIds, specIds)
+			String specIdsStr = Jsons.toJson(ids);
+			//升序
+			Arrays.sort(ids);
+			String dupSpecIds = Jsons.toJson(ids);
+			GoodsDonSku specIds_exists = goodsDonSkuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class)
+					.and(qr -> qr.eq(GoodsDonSku::getDupSpecIds, dupSpecIds).or().eq(GoodsDonSku::getSpecIds, specIdsStr))
 					.eq(GoodsDonSku::getGoodsId, goods.getId())
 					.last("limit 1"));
 			if (specIds_exists != null) {
-				log.info("库中存在相同二级分类的规格,spec_ids:{}", specIds);
+				log.info("库中存在相同二级分类的规格,spec_ids:{}", dupSpecIds);
 				continue;
 			}
-			goodsDonSku.setSpecIds(Jsons.toJson(ids));
+			goodsDonSku.setSpecIds(specIdsStr);
+			goodsDonSku.setDupSpecIds(dupSpecIds);
 			goodsDonSku.setSpecVal(specVal);
 			goodsDonSku.setSpecJson(specJson);
 			if (goods.getType() == 1) {

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -82,8 +82,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 			}
 			if (isLoginPopularize != null && isLoginPopularize) {
 				GoodsDonViews views = beanSearcher.searchFirst(GoodsDonViews.class, MapUtils.builder().field(GoodsDonViews::getId, ticket.getGoodsId()).build());
-				views.setSpecs(beanSearcher.searchFirst(GoodsDonSpec.class, MapUtils.builder().field(GoodsDonSpec::getGoodsId, views.getId()).build()));
-				views.setSkuList(beanSearcher.searchAll(GoodsDonSku.class, MapUtils.builder().field(GoodsDonSku::getGoodsId, views.getId()).field(GoodsDonSku::getStatus, true).build()));
+				views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
+				views.setSkuList(beanSearcher.searchAll(GoodsDonSkuFrontView.class, MapUtils.builder().field(GoodsDonSkuFrontView::getGoodsId, views.getId()).field(GoodsDonSkuFrontView::getStatus, true).build()));
 				ticket.setGoodsDonViews(views);
 			}
 			if (ticket.getMonths() != null && ticket.getMonths() >= 300) {

+ 36 - 20
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -179,19 +179,10 @@ public class GoodsDonController {
         DateTime now = DateTime.now();
         list.forEach(data -> {
             data.setSpecs(beanSearcher.searchFirst(GoodsDonSpec.class, MapUtils.builder().field(GoodsDonSpec::getGoodsId, data.getId()).build()));
-            data.setSkuList(beanSearcher.searchAll(GoodsDonFrontSkuView.class, MapUtils.builder().field(GoodsDonFrontSkuView::getGoodsId, data.getId()).field(GoodsDonFrontSkuView::getStatus, true).orderBy(GoodsDonFrontSkuView::getPrice).asc().build()));
+            data.setSkuList(beanSearcher.searchAll(GoodsDonSkuFrontView.class, MapUtils.builder().field(GoodsDonSkuFrontView::getGoodsId, data.getId()).field(GoodsDonSkuFrontView::getStatus, true).orderBy(GoodsDonSkuFrontView::getPrice).asc().build()));
             Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
                     .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
             data.setSold(sold + data.getVirtualSold());
-
-            Optional.ofNullable(data.getSkuList()).ifPresent(skuList -> {
-                if (skuList.size() > 0) {
-                    GoodsDonFrontSkuView donFrontSkuView = skuList.get(0);
-                    data.setPrice(donFrontSkuView.getPrice());
-                    data.setMonths(donFrontSkuView.getMonths());
-                    data.setDays(donFrontSkuView.getDays());
-                }
-            });
             OrderCommentFrontView comments = beanSearcher.searchFirst(OrderCommentFrontView.class, MapUtils.builder()
                     .field(OrderCommentFrontView::getGoodsId, data.getId())
                     .orderBy(OrderCommentFrontView::getCommentTime).desc()
@@ -234,12 +225,6 @@ public class GoodsDonController {
             Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
                     .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
             data.setSold(sold + data.getVirtualSold());
-            GoodsDonFrontSkuView skuView = beanSearcher.searchFirst(GoodsDonFrontSkuView.class, MapUtils.builder().field(GoodsDonFrontSkuView::getGoodsId, data.getId()).field(GoodsDonFrontSkuView::getStatus, true).orderBy(GoodsDonFrontSkuView::getPrice).asc().build());
-            if (skuView != null) {
-                data.setPrice(skuView.getPrice());
-                data.setMonths(skuView.getMonths());
-                data.setDays(skuView.getDays());
-            }
             data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1));
         });
         redisService.setNx(h5CacheKey, dataList, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
@@ -283,17 +268,48 @@ public class GoodsDonController {
     public Result<GoodsDonViews> getDetail(@PathVariable Long id) {
         GoodsDonViews views = beanSearcher.searchFirst(GoodsDonViews.class, MapUtils.builder().field(GoodsDonViews::getId, id).build());
 
-        views.setSpecs(beanSearcher.searchFirst(GoodsDonSpec.class, MapUtils.builder().field(GoodsDonSpec::getGoodsId, views.getId()).build()));
+        views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
         MapBuilder builder = MapUtils.builder().field(GoodsDonSku::getGoodsId, views.getId()).field(GoodsDonSku::getStatus, true);
 
-        GoodsDonSkuView goodsDonSkuView = beanSearcher.searchFirst(GoodsDonSkuView.class, MapUtils.builder().field(GoodsDonSkuView::getGoodsId, id).build());
-        if (goodsDonSkuView != null && goodsDonSkuView.getType() == 1) {
+        if (views.getType() == 1) {
             builder.orderBy(GoodsDonSku::getOrderBy).asc();
         }
-        views.setSkuList(beanSearcher.searchAll(GoodsDonSku.class, builder.build()));
+        views.setSkuList(beanSearcher.searchAll(GoodsDonSkuFrontView.class, builder.build()));
         return GatewayResponse.SUCCESS.newBuilder().toResult(views);
     }
 
+    /**
+     * 获取商品推荐平台
+     */
+    @GetMapping("/get/recommend/{id}")
+    public Result<List<GoodsRecommendViews>> getRecommendGoodsByGid(@PathVariable Long id) throws Exception {
+        String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "recommend:" + id;
+        Object value = redisService.get(key);
+        if (value != null) {
+            List<GoodsRecommendViews> goodsRecommendViews = Jsons.parseList(value.toString(), GoodsRecommendViews.class);
+            return GatewayResponse.SUCCESS.newBuilder().toResult(goodsRecommendViews);
+        }
+        if (value == null) {
+            GoodsDon goodsDon = beanSearcher.searchFirst(GoodsDon.class, MapUtils.builder()
+                    .field(GoodsDon::getId, id)
+                    .field(GoodsDon::getStatus, true)
+                    .field(GoodsDon::getDeleted, true)
+                    .build());
+            if (goodsDon != null && StrUtil.isNotEmpty(goodsDon.getRecommendGoods())) {
+                List<Long> recommend_gidList = Jsons.parseList(goodsDon.getRecommendGoods(), Long.class);
+                List<GoodsRecommendViews> goodsRecommendViews = beanSearcher.searchAll(GoodsRecommendViews.class, MapUtils.builder().field(GoodsRecommendViews::getGoodsId, recommend_gidList).op(Operator.InList).build());
+                goodsRecommendViews.forEach(data->{
+                    Integer sold = registerOrderDonMapper.selectCount(Wrappers.lambdaQuery(RegisterOrderDon.class)
+                            .eq(RegisterOrderDon::getGoodsId, data.getGoodsId()).notIn(RegisterOrderDon::getStatus, Constant.noOrderStatus));
+                    data.setSold(sold + data.getVirtualSold());
+                });
+                redisService.setNx(key, Jsons.toJson(goodsRecommendViews), 60 * 15l);
+                return GatewayResponse.SUCCESS.newBuilder().toResult(goodsRecommendViews);
+            }
+        }
+        return GatewayResponse.SUCCESS.newBuilder().toResult();
+    }
+
     /**
      * 获取商品多规格列表
      */

+ 36 - 2
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonController.java

@@ -2,8 +2,11 @@ package com.cyksj.web.controller.manage.goods;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import com.cyksj.common.annotation.Log;
 import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.common.util.Jsons;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.BusinessType;
 import com.cyksj.enums.GatewayResponse;
@@ -22,6 +25,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -56,8 +60,11 @@ public class CmsGoodsDonController {
      * 商品详情
      */
     @GetMapping("/get/{id}")
-    public Result<GoodsDonViewer> getById(@PathVariable Long id) {
+    public Result<GoodsDonViewer> getById(@PathVariable Long id) throws Exception {
         GoodsDonViewer goodsDonViewer = beanSearcher.searchFirst(GoodsDonViewer.class, MapUtils.builder().field(GoodsDonViewer::getId, id).build());
+        if (StrUtil.isNotBlank(goodsDonViewer.getRecommendGoods())) {
+            goodsDonViewer.setRecommendGoodsList(Jsons.parseList(goodsDonViewer.getRecommendGoods(), Long.class));
+        }
         List<GoodsDonSku> goodsDonSkus = beanSearcher.searchAll(GoodsDonSku.class, MapUtils.builder().field(GoodsDonSku::getGoodsId, id).build());
         goodsDonViewer.setSkus(goodsDonSkus);
         return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDonViewer);
@@ -82,7 +89,11 @@ public class CmsGoodsDonController {
         // 新增商品
         GoodsDon goods = new GoodsDon();
         BeanUtil.copyProperties(spu, goods);
-
+        if (StrUtil.isNotEmpty(goods.getRecommendTitle())) {
+            if (CollUtil.isEmpty(spu.getRecommendGoodsList())) {
+                throw BusinessRuntimeException.getInstance("请选择推荐的对应平台");
+            }
+        }
         goodsDonService.save(goods);
         Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
         redisService.del(keys.toArray(String[]::new));
@@ -101,6 +112,29 @@ public class CmsGoodsDonController {
         if (spu.getSpecialType() == null) {
             goods.setSpecialType(null);
         }
+        if (StrUtil.isNotEmpty(goods.getRecommendTitle())) {
+            if (CollUtil.isEmpty(spu.getRecommendGoodsList())) {
+                throw BusinessRuntimeException.getInstance("请选择推荐的对应平台");
+            }
+        }
+        if (CollUtil.isNotEmpty(spu.getRecommendGoodsList())) {
+            Set<Long> re_goodsIds = new HashSet<>(spu.getRecommendGoodsList());
+            //去除自己
+            re_goodsIds.remove(spu.getId());
+            goods.setRecommendGoods(Jsons.toJson(re_goodsIds));
+        }
+        if (StrUtil.isEmpty(goods.getRecommendTitle())) {
+            goods.setRecommendTitle(null);
+        }
+        if (StrUtil.isEmpty(goods.getVideo())) {
+            goods.setVideo(null);
+        }
+        if (CollUtil.isNotEmpty(spu.getRecommendGoodsList())) {
+            Set<Long> re_goodsIds = new HashSet<>(spu.getRecommendGoodsList());
+            //去除自己
+            re_goodsIds.remove(spu.getId());
+            goods.setRecommendGoods(Jsons.toJson(re_goodsIds));
+        }
         goodsDonService.updateById(goods);
         Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
         redisService.del(keys.toArray(String[]::new));

+ 5 - 3
netflix-web/src/main/java/com/cyksj/web/controller/payment/OrderController.java

@@ -23,13 +23,13 @@ import com.cyksj.mapper.market.task.UserBindDetailMapper;
 import com.cyksj.model.dto.AliPayParams;
 import com.cyksj.model.dto.H5JsPayParams;
 import com.cyksj.model.entity.*;
+import com.cyksj.model.manage.views.OrderDonSearchView;
 import com.cyksj.model.manage.views.OrderDonView;
 import com.cyksj.model.request.AlipayOrderDonReq;
 import com.cyksj.model.request.OrderPayRequest;
 import com.cyksj.model.response.AliPayTradeStatus;
 import com.cyksj.model.views.GoodsDonSkuView;
 import com.cyksj.model.views.OrderCommentView;
-import com.cyksj.redis.RedisService;
 import com.cyksj.service.order.OrderDonService;
 import com.cyksj.service.paypal.PayPalService;
 import com.cyksj.service.paypal.PaypalPayConfigService;
@@ -393,11 +393,13 @@ public class OrderController {
     }
 
     @GetMapping("/get/order/status/{orderId}")
-    public Result<OrderDonView> getOrderStatusById(@PathVariable Long orderId) {
+    public Result<OrderDonSearchView> getOrderStatusById(@PathVariable Long orderId) {
         if (orderId < 1) {
             throw BusinessRuntimeException.getInstance("订单不存在");
         }
-        OrderDonView orderDonView = orderDonMapper.getOrderDetail(orderId);
+        OrderDonSearchView orderDonView = beanSearcher.searchFirst(OrderDonSearchView.class, MapUtils.builder()
+                .put("orderId", String.format("where id = %s", orderId))
+                .build());
         if (orderDonView == null) {
             throw BusinessRuntimeException.getInstance("订单不存在");
         }