Browse Source

Merge branch 'real_goods_sku'

# Conflicts:
#	netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSkuFrontView.java
#	netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java
#	netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSkuController.java
zoujiajian 3 năm trước cách đây
mục cha
commit
f024ff74b6
29 tập tin đã thay đổi với 990 bổ sung253 xóa
  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. 1 1
      netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDonSpec.java
  6. 2 0
      netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuInsert.java
  7. 8 1
      netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuSpec.java
  8. 5 2
      netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSpecSingle.java
  9. 17 0
      netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSpuInsert.java
  10. 16 0
      netflix-dao/src/main/java/com/cyksj/model/manage/views/GoodsDonViewer.java
  11. 155 0
      netflix-dao/src/main/java/com/cyksj/model/manage/views/OrderDonSearchView.java
  12. 23 0
      netflix-dao/src/main/java/com/cyksj/model/request/CombinationSkuReq.java
  13. 28 5
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSkuFrontView.java
  14. 40 0
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonSpecFrontView.java
  15. 108 5
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonViews.java
  16. 4 4
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsFrontListView.java
  17. 3 3
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsHomePageView.java
  18. 56 0
      netflix-dao/src/main/java/com/cyksj/model/views/GoodsRecommendViews.java
  19. 0 15
      netflix-dao/src/main/resources/mapper/OrderDonMapper.xml
  20. 13 4
      netflix-service/src/main/java/com/cyksj/service/mange/CmsGoodsDonSpecService.java
  21. 23 15
      netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsGoodsDonServiceImpl.java
  22. 332 2
      netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsGoodsDonSpecServiceImpl.java
  23. 1 1
      netflix-service/src/main/java/com/cyksj/service/order/impl/UserRealOrderBenefitsImpl.java
  24. 2 2
      netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java
  25. 37 22
      netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java
  26. 36 2
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonController.java
  27. 39 158
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSkuController.java
  28. 1 1
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSpecController.java
  29. 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

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

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

@@ -21,7 +21,7 @@ public class GoodsDonSpec extends BaseEntity {
     /**
      * 规格属性值最大id
      */
-    private Integer maxId;
+    private Long maxId;
 
     /**
      * 商品规格数量

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuInsert.java

@@ -15,6 +15,8 @@ import java.util.List;
 @Getter
 @Setter
 public class ReqGoodsSkuInsert {
+    private Long id;
+
     @NotNull(message = "请指定商品spu.")
     private Long goodsId;
 

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

@@ -3,6 +3,7 @@ package com.cyksj.model.manage.request;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -12,6 +13,8 @@ import java.util.List;
 @Getter
 @Setter
 public class ReqGoodsSkuSpec {
+    private Long id;
+
     private String key;
 
     private List<Node> values;
@@ -19,8 +22,12 @@ public class ReqGoodsSkuSpec {
     @Getter
     @Setter
     public static class Node {
-        private Integer id;
+        private Long id;
 
         private String value;
+
+        private BigDecimal price;
+
+        private String benefitsList;
     }
 }

+ 5 - 2
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSpecSingle.java

@@ -20,7 +20,10 @@ public class ReqGoodsSpecSingle {
     private Long goodsId;
 
     @NotNull(message = "缺少规格属性id")
-    private Integer id;
+    private Long id;
+
+    @NotNull(message = "缺少总规格属性id")
+    private Long keyId;
 
     @NotBlank(message = "缺少规格名")
     private String key;
@@ -28,5 +31,5 @@ public class ReqGoodsSpecSingle {
     @NotBlank(message = "缺少属性名.")
     private String name;
 
-    private Integer maxId;
+    private Long maxId;
 }

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

+ 23 - 0
netflix-dao/src/main/java/com/cyksj/model/request/CombinationSkuReq.java

@@ -0,0 +1,23 @@
+package com.cyksj.model.request;
+
+import com.cyksj.model.manage.request.ReqGoodsSkuSpec;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/*
+ *项目名: netflix
+ *文件名: CombinationSkuReq
+ *创建者: JavaZou
+ *创建时间:2023/7/25 9:46
+ */
+@Getter
+@Setter
+public class CombinationSkuReq {
+	private Long id;
+
+	private String key;
+
+	private List<ReqGoodsSkuSpec.Node> values;
+}

+ 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,8 +1,8 @@
 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;
 
@@ -11,19 +11,22 @@ import java.util.List;
 
 /*
  *项目名: 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
 	 */
@@ -39,11 +42,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;
 
 	/**
@@ -61,7 +83,8 @@ 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;
 
 	private Boolean isDp;
 

+ 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

+ 13 - 4
netflix-service/src/main/java/com/cyksj/service/mange/CmsGoodsDonSpecService.java

@@ -1,11 +1,12 @@
 package com.cyksj.service.mange;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.cyksj.mapper.GoodsDonSpecMapper;
+import com.cyksj.model.entity.GoodsDon;
 import com.cyksj.model.entity.GoodsDonSpec;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
+import com.cyksj.model.manage.request.ReqGoodsSkuInsert;
+import com.cyksj.model.request.CombinationSkuReq;
+
+import java.util.List;
 
 /**
  * @author chan
@@ -13,4 +14,12 @@ import org.springframework.stereotype.Service;
  */
 public interface CmsGoodsDonSpecService extends IService<GoodsDonSpec> {
 
+	/**
+	 * 新增或编辑规格spec
+	 */
+	void insertOrUpdateSkuSpec(ReqGoodsSkuInsert insert) throws Exception;
+
+	void skuAppend(ReqGoodsSkuInsert insert, GoodsDon goods) throws Exception;
+
+	void combinationSku(Long goodsId, List<CombinationSkuReq> combinations) throws Exception;
 }

+ 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());

+ 332 - 2
netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsGoodsDonSpecServiceImpl.java

@@ -1,19 +1,349 @@
 package com.cyksj.service.mange.goods;
 
-import com.baomidou.mybatisplus.extension.service.IService;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.common.snowflake.Sequence;
+import com.cyksj.common.util.Jsons;
+import com.cyksj.mapper.GoodsDonMapper;
+import com.cyksj.mapper.GoodsDonSkuMapper;
 import com.cyksj.mapper.GoodsDonSpecMapper;
+import com.cyksj.model.entity.GoodsDon;
+import com.cyksj.model.entity.GoodsDonSku;
 import com.cyksj.model.entity.GoodsDonSpec;
+import com.cyksj.model.manage.request.ReqGoodsSkuInsert;
+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.fasterxml.jackson.databind.JavaType;
+import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
 /**
  * @author chan
  * @date 2022/9/27 5:19 PM
  */
 @Slf4j
 @Service
-public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,GoodsDonSpec> implements CmsGoodsDonSpecService {
+@RequiredArgsConstructor
+public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper, GoodsDonSpec> implements CmsGoodsDonSpecService {
+	private final static Sequence SEQUENCE = new Sequence(0);
+
+	private final GoodsDonMapper goodsDonMapper;
+
+	private final GoodsDonSkuMapper goodsDonSkuMapper;
+
+	@Override
+	public void insertOrUpdateSkuSpec(ReqGoodsSkuInsert insert) throws Exception {
+		GoodsDon goods = goodsDonMapper.selectById(insert.getGoodsId());
+		if (null == goods) {
+			throw new RuntimeException("找不到商品spu.");
+		}
+		GoodsDonSpec loveSpec = this.getOne(Wrappers.lambdaQuery(GoodsDonSpec.class).eq(GoodsDonSpec::getGoodsId, insert.getGoodsId()));
+		if (null != loveSpec) {
+			throw new RuntimeException("该商品已新增总规格, 请点击编辑并追加该商品的sku.");
+		}
+
+		List<ReqGoodsSkuSpec> specs = insert.getSpecs();
+		if (null == specs || specs.isEmpty()) {
+			throw new RuntimeException("缺少商品总规格.");
+		}
+
+		// 属性最大id
+		Long maxId = 0l;
+		// 统计总属性数
+		Long total = 0l;
+		// 判断id是否有重复
+		Map<Long, ReqGoodsSpecSingle> map = null;
+		// 规格数量
+		int specNumber = specs.size();
+
+		for (ReqGoodsSkuSpec spec : specs) {
+			if (spec.getId() == null) {
+				spec.setId(SEQUENCE.nextId());
+			}
+			if (StringUtils.isBlank(spec.getKey())) {
+				throw new RuntimeException("存在空白规格名.");
+			}
+
+			List<ReqGoodsSkuSpec.Node> values = spec.getValues();
+			if (null == values || values.isEmpty()) {
+				throw new RuntimeException("规格[" + spec.getKey() + "]中缺少属性.");
+			}
+			total += values.size();
+			for (ReqGoodsSkuSpec.Node e : values) {
+				if (null == e.getId() || e.getId() < 0) {
+					e.setId(SEQUENCE.nextId());
+				}
+				if (StringUtils.isBlank(e.getValue())) {
+					throw new RuntimeException("规格[" + spec.getKey() + "]中存在空白属性.");
+				}
+				if (e.getId() > maxId) {
+					maxId = e.getId();
+				}
+
+				if (goods.getType() == 2 && (e.getPrice() == null || e.getPrice().compareTo(BigDecimal.ZERO) < 0)) {
+					throw BusinessRuntimeException.getInstance("实物规格:{0}对应价格错误", e.getValue());
+				}
+
+				if (null == map) {
+					map = new HashMap<>(16);
+				}
+
+				ReqGoodsSpecSingle single = new ReqGoodsSpecSingle();
+				single.setId(e.getId());
+				single.setKeyId(spec.getId());
+				single.setKey(spec.getKey());
+				single.setName(e.getValue());
+				map.put(e.getId(), single);
+			}
+		}
+
+		if (map.size() != total) {
+			throw new RuntimeException("规格中存在重复id.");
+		}
+
+		GoodsDonSpec spec = new GoodsDonSpec();
+		spec.setGoodsId(insert.getGoodsId());
+		spec.setMaxId(maxId);
+		spec.setSpecsJson(Jsons.toJson(specs));
+		spec.setSpecNumber(specNumber);
+		spec.setSpecMapping(Jsons.toJson(map));
+		if (insert.getId() != null) {
+			this.updateById(spec);
+			return;
+		}
+		this.save(spec);
+	}
+
+	@Override
+	public void skuAppend(ReqGoodsSkuInsert insert, GoodsDon goods) throws Exception {
+
+		GoodsDonSpec loveSpec = this.getOne(Wrappers.lambdaQuery(GoodsDonSpec.class).eq(GoodsDonSpec::getGoodsId, insert.getGoodsId()));
+		if (null == loveSpec) {
+			throw new RuntimeException("该商品未设置总规格, 请设置总规格.");
+		}
+
+		List<ReqGoodsSkuInsert.Sku> skus = insert.getSkus();
+		if (null == skus || skus.isEmpty()) {
+			throw new RuntimeException("参数错误.");
+		}
+		int specNumber = loveSpec.getSpecNumber();
+
+		JavaType type = Jsons.javaType().constructMapType(HashMap.class, Integer.class, ReqGoodsSpecSingle.class);
+		Map<Integer, ReqGoodsSpecSingle> map = Jsons.parseObject(loveSpec.getSpecMapping(), type);
+
+		StringBuilder builder = new StringBuilder();
+		List<ReqGoodsSpecSingle> specList = null;
+		GoodsDonSku goodsDonSku = null;
+
+		// 判断属性是否属于同一个key
+		Set<String> set = null;
+
+		for (ReqGoodsSkuInsert.Sku sku : insert.getSkus()) {
+			// 跳过空值的sku
+			// 解析sku的规格属性
+			final String specIds = sku.getSpecIds();
+			if (StringUtils.isBlank(specIds)) {
+				throw new RuntimeException("请选择商品的规格.");
+			}
+			int[] ids = Jsons.parseObject(specIds, int[].class);
+//            if (ids.length != specNumber) {
+//                throw new RuntimeException("sku规格数量 与 总规格数量 不一致.");
+//            }
+
+			// init
+			builder.delete(0, builder.length());
+			if (null == specList) {
+				specList = new ArrayList<>(specNumber);
+			} else {
+				specList.clear();
+			}
+			if (null == set) {
+				int capacity = (specNumber + 1) * 4 / 3 + 1;
+				set = new HashSet<>(capacity);
+			} else {
+				set.clear();
+			}
+
+			for (int id : ids) {
+				ReqGoodsSpecSingle single = map.get(id);
+				if (null == single) {
+					throw new RuntimeException("总规格属性id中 不存在 sku中的id.");
+				}
+				builder.append(single.getName()).append(';');
+				specList.add(single);
+				set.add(single.getKey());
+			}
+//            if (set.size() != specNumber) {
+//                throw new RuntimeException("sku中存在多个属性属于同一个规格.");
+//            }
+
+			String specVal = builder.toString();
+			String specJson = Jsons.toJson(specList);
+
+			if (null == goodsDonSku) {
+				goodsDonSku = new GoodsDonSku();
+				goodsDonSku.setGoodsId(insert.getGoodsId());
+			}
+			BeanUtil.copyProperties(sku, goodsDonSku);
+			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:{}", dupSpecIds);
+				continue;
+			}
+			goodsDonSku.setSpecIds(specIdsStr);
+			goodsDonSku.setDupSpecIds(dupSpecIds);
+			goodsDonSku.setSpecVal(specVal);
+			goodsDonSku.setSpecJson(specJson);
+			if (goods.getType() == 1) {
+				if (sku.getMonths() != null && sku.getMonths() > 0 && sku.getDays() != null && sku.getDays() > 0)
+					throw BusinessRuntimeException.getInstance("续费天数和续费月数不能同时存在");
+				if (sku.getMonths() == null && sku.getDays() == null)
+					throw BusinessRuntimeException.getInstance("请输入对应续费时间");
+			}
+			goodsDonSkuMapper.insert(goodsDonSku);
+
+		}
+	}
+
+	@Override
+	public void combinationSku(Long goodsId, List<CombinationSkuReq> combinations) throws Exception {
+		GoodsDon goodsDon = goodsDonMapper.selectById(goodsId);
+		if (goodsDon == null) throw BusinessRuntimeException.getInstance("平台不存在");
+		if (goodsDon.getType() != 2) {
+			throw BusinessRuntimeException.getInstance("暂只支持实物规格");
+		}
+		GoodsDonSpec loveSpec = this.getOne(Wrappers.lambdaQuery(GoodsDonSpec.class).eq(GoodsDonSpec::getGoodsId, goodsId));
+		if (null == loveSpec) {
+			throw new RuntimeException("该商品未设置总规格, 请设置总规格.");
+		}
+		String specsJson = loveSpec.getSpecsJson();
+		List<ReqGoodsSkuSpec> specsList = Jsons.parseList(specsJson, ReqGoodsSkuSpec.class);
+		Map<Long, List<ReqGoodsSkuSpec>> specValueMap = specsList.stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec::getId));
+		if (combinations.isEmpty()) {
+			throw BusinessRuntimeException.getInstance("请选择对应的规格组合");
+		}
+		List<ReqGoodsSkuInsert.Sku> skus = new LinkedList<>();
+		ReqGoodsSkuInsert reqGoodsSkuInsert = new ReqGoodsSkuInsert();
+		reqGoodsSkuInsert.setGoodsId(goodsId);
+		List<List<Long>> specIdLists = new LinkedList<>();
+		CombinationSkuReq request = combinations.get(0);
+		if (request.getId() == null) {
+			throw BusinessRuntimeException.getInstance("传入的总规格属性id不存在");
+		}
+		List<ReqGoodsSkuSpec> reqGoodsSkuSpecs = specValueMap.get(request.getId());
+		if (reqGoodsSkuSpecs == null) {
+			throw BusinessRuntimeException.getInstance("传入的id:{0}总规格属性不存在", request.getId());
+		}
+		Map<Long, List<ReqGoodsSkuSpec.Node>> nodeIdMap = reqGoodsSkuSpecs.get(0).getValues().stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec.Node::getId));
+		if (CollUtil.isNotEmpty(request.getValues())) {
+			unifiedHandleCombinationSku(combinations, request.getValues(), specValueMap, nodeIdMap, specIdLists, skus);
+		} else {
+			ReqGoodsSkuSpec reqGoodsSkuSpec = reqGoodsSkuSpecs.get(0);
+			unifiedHandleCombinationSku(combinations,reqGoodsSkuSpec.getValues(),specValueMap, nodeIdMap,specIdLists,skus);
+		}
+		reqGoodsSkuInsert.setSkus(skus);
+		skuAppend(reqGoodsSkuInsert, goodsDon);
+	}
+
+	public void unifiedHandleCombinationSku(List<CombinationSkuReq> combinations, List<ReqGoodsSkuSpec.Node> values, Map<Long, List<ReqGoodsSkuSpec>> specValueMap, Map<Long, List<ReqGoodsSkuSpec.Node>> nodeIdMap, List<List<Long>> specIdLists, List<ReqGoodsSkuInsert.Sku> skus) throws Exception {
+		for (ReqGoodsSkuSpec.Node node_value : values) {
+			ReqGoodsSkuInsert.Sku sku = new ReqGoodsSkuInsert.Sku();
+			sku.setPrice(BigDecimal.ZERO);
+			List<Long> specIds = new LinkedList<>();
+			unifiedHandleSecondCombinationSku(node_value, nodeIdMap, sku, specIds);
+			recurCombinationSku(combinations, combinations.size(), 1, 1, specIds, specIdLists, sku, specValueMap, skus);
+		}
+	}
+
+
+	public void unifiedHandleSecondCombinationSku(ReqGoodsSkuSpec.Node temp_node, Map<Long, List<ReqGoodsSkuSpec.Node>> nodeIdMap, ReqGoodsSkuInsert.Sku sku, List<Long> specIds) {
+		List<ReqGoodsSkuSpec.Node> nodes = nodeIdMap.get(temp_node.getId());
+		if (CollUtil.isEmpty(nodes)) {
+			throw BusinessRuntimeException.getInstance("{0}规格不存在", temp_node.getValue());
+		}
+		ReqGoodsSkuSpec.Node node = nodes.get(0);
+		BigDecimal price = node.getPrice();
+		if (price == null && node.getValue().contains("无")) {
+			price = BigDecimal.ZERO;
+		}
+		if (price == null) {
+			throw BusinessRuntimeException.getInstance("该实物子规格:{0}未配置价格", node.getValue());
+		}
+		sku.setPrice(sku.getPrice().add(price));
+		specIds.add(temp_node.getId());
+		if (node.getValue().contains("套餐")) {
+			if (StrUtil.isNotEmpty(node.getBenefitsList())) {
+				sku.setIsBenefits(true);
+				sku.setBenefitsList(node.getBenefitsList());
+			}
+		}
+	}
+
+	/**
+	 * @param combinations 传入的组合数据
+	 * @param total        总共需要组合的大小
+	 * @param has          已有组合数大小
+	 * @param start        下一个组合数组下表
+	 * @param specIds      组合规格ids
+	 * @param sku          待插入库中的sku
+	 * @param specValueMap 总规格库中对应values
+	 */
+	private void recurCombinationSku(List<CombinationSkuReq> combinations, Integer total, Integer has, Integer start, List<Long> specIds, List<List<Long>> specIdLists, ReqGoodsSkuInsert.Sku sku, Map<Long, List<ReqGoodsSkuSpec>> specValueMap, List<ReqGoodsSkuInsert.Sku> skus) throws Exception {
+		if (has == total) {
+			if (specIdLists.contains(specIds)) {
+				return;
+			}
+			sku.setSpecIds(Jsons.toJson(specIds));
+			skus.add(sku);
+			return;
+		}
+		CombinationSkuReq request = combinations.get(start);
+		if (request.getId() == null) {
+			throw BusinessRuntimeException.getInstance("总规格属性id不存在");
+		}
+		List<ReqGoodsSkuSpec> reqGoodsSkuSpecs = specValueMap.get(request.getId());
+		if (reqGoodsSkuSpecs == null) {
+			throw BusinessRuntimeException.getInstance("{0}总规格属性不存在", request.getKey());
+		}
+		ReqGoodsSkuSpec reqGoodsSkuSpec = reqGoodsSkuSpecs.get(0);
+		Map<Long, List<ReqGoodsSkuSpec.Node>> nodeIdMap = reqGoodsSkuSpec.getValues().stream().collect(Collectors.groupingBy(ReqGoodsSkuSpec.Node::getId));
+		if (CollUtil.isNotEmpty(request.getValues())) {
+			createNewSkuAndRecurCombination(combinations, request.getValues(), nodeIdMap, has, start, specIds, specIdLists, sku, specValueMap, skus);
+			return;
+		}
+		createNewSkuAndRecurCombination(combinations, reqGoodsSkuSpec.getValues(), nodeIdMap, has, start, specIds, specIdLists, sku, specValueMap, skus);
+	}
 
+	/**
+	 * 新的规格 递归
+	 */
+	public void createNewSkuAndRecurCombination(List<CombinationSkuReq> combinations, List<ReqGoodsSkuSpec.Node> values, Map<Long, List<ReqGoodsSkuSpec.Node>> nodeIdMap, Integer has, Integer start, List<Long> specIds, List<List<Long>> specIdLists, ReqGoodsSkuInsert.Sku sku, Map<Long, List<ReqGoodsSkuSpec>> specValueMap, List<ReqGoodsSkuInsert.Sku> skus) throws Exception {
+		for (ReqGoodsSkuSpec.Node node_value : values) {
+			BigDecimal last_price = sku.getPrice();
+			unifiedHandleSecondCombinationSku(node_value, nodeIdMap, sku, specIds);
+			recurCombinationSku(combinations, combinations.size(), has + 1, start + 1, specIds, specIdLists, sku, specValueMap, skus);
+			specIds.remove(node_value.getId());
+			sku = new ReqGoodsSkuInsert.Sku();
+			sku.setPrice(last_price);
+		}
+	}
 }

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/UserRealOrderBenefitsImpl.java

@@ -59,8 +59,8 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
 		Boolean isReceivedAll = true;
 		for (GoodsDonSku sku : skuIds) {
 			Long skuId = sku.getId();
-			Long goodsId = sku.getGoodsId();
 			sku = goodsDonSkuMapper.selectById(skuId);
+			Long goodsId = sku.getGoodsId();
 //			List<GroupsRelationView> relationViewList = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
 //					.field(GroupsRelationView::getGoodsId, goodsId)
 //					.field(GroupsRelationView::getUserId, userId)

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

@@ -93,8 +93,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) {

+ 37 - 22
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -179,7 +179,7 @@ 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()));
             data.getSkuList().forEach(sku -> {
                 if (sku.getIsDp()) {
                     List<GoodsDiscountPlusPurchaseRelationFrontView> dpSkuViews = beanSearcher.searchAll(GoodsDiscountPlusPurchaseRelationFrontView.class, MapUtils.builder().field(GoodsDiscountPlusPurchaseRelationFrontView::getSkuId, sku.getId()).build());
@@ -189,15 +189,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());
-
-            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()
@@ -240,12 +231,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());
@@ -289,25 +274,55 @@ 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();
         }
-        List<GoodsDonSku> goodsDonSkus = beanSearcher.searchAll(GoodsDonSku.class, builder.build());
-        goodsDonSkus.forEach(sku -> {
+        views.setSkuList(beanSearcher.searchAll(GoodsDonSkuFrontView.class, builder.build()));
+        views.getSkuList().forEach(sku -> {
             if (sku.getIsDp()) {
                 sku.setDpSkuViews(beanSearcher.searchAll(GoodsDiscountPlusPurchaseRelationFrontView.class, MapUtils.builder()
                         .field(GoodsDiscountPlusPurchaseRelationFrontView::getSkuId, sku.getId())
                         .build()));
             }
         });
-        views.setSkuList(goodsDonSkus);
         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;
@@ -23,6 +26,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;
 
@@ -57,8 +61,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());
         if (goodsDonViewer.getType() == 1) {
             goodsDonSkus.forEach(sku -> {
@@ -92,7 +99,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));
@@ -111,6 +122,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));

+ 39 - 158
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSkuController.java

@@ -1,10 +1,12 @@
 package com.cyksj.web.controller.manage.goods;
 
+import com.baomidou.mybatisplus.core.toolkit.Assert;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.common.annotation.Log;
 import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.common.snowflake.Sequence;
 import com.cyksj.common.util.Jsons;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.BusinessType;
@@ -15,23 +17,27 @@ import com.cyksj.model.entity.GoodsDonSpec;
 import com.cyksj.model.manage.request.ReqGoodsSkuInsert;
 import com.cyksj.model.manage.request.ReqGoodsSkuSpec;
 import com.cyksj.model.manage.request.ReqGoodsSpecSingle;
+import com.cyksj.model.request.CombinationSkuReq;
 import com.cyksj.model.views.GoodsDonSkuView;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.mange.CmsGoodsDonService;
 import com.cyksj.service.mange.CmsGoodsDonSkuService;
 import com.cyksj.service.mange.CmsGoodsDonSpecService;
+import com.cyksj.service.sys.SysConfigService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.util.MapUtils;
-import com.fasterxml.jackson.databind.JavaType;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.*;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
 
 /**
  * @author chan
@@ -56,6 +62,10 @@ public class CmsGoodsDonSkuController {
 
     private final RedisService redisService;
 
+    private final SysConfigService sysConfigService;
+
+    private final static Sequence SEQUENCE = new Sequence(0);
+
 
     /**
      * 新增 商品spec & sku
@@ -63,75 +73,23 @@ public class CmsGoodsDonSkuController {
     @PostMapping(value = "/post/spec-sku")
     @Log(module = "平台管理/新增商品sku&spec", businessType = BusinessType.POST, isSaveRequestData = true)
     public Result<String> skuInsert(@Validated @RequestBody ReqGoodsSkuInsert insert) throws Exception{
+        goodsDonSpecService.insertOrUpdateSkuSpec(insert);
 
-        GoodsDon goods = goodsDonService.getById(insert.getGoodsId());
-        if (null == goods) {
-            throw new RuntimeException("找不到商品spu.");
-        }
-        GoodsDonSpec loveSpec = goodsDonSpecService.getOne(Wrappers.lambdaQuery(GoodsDonSpec.class).eq(GoodsDonSpec::getGoodsId,insert.getGoodsId()));
-        if (null != loveSpec) {
-            throw new RuntimeException("该商品已新增总规格, 请点击编辑并追加该商品的sku.");
-        }
-
-        List<ReqGoodsSkuSpec> specs = insert.getSpecs();
-        if (null == specs || specs.isEmpty()) {
-            throw new RuntimeException("缺少商品总规格.");
-        }
-
-        // 属性最大id
-        int maxId = 0;
-        // 统计总属性数
-        int total = 0;
-        // 判断id是否有重复
-        Map<Integer, ReqGoodsSpecSingle> map = null;
-        // 规格数量
-        int specNumber = specs.size();
-
-        for (ReqGoodsSkuSpec spec : specs) {
-            if (StringUtils.isBlank(spec.getKey())) {
-                throw new RuntimeException("存在空白规格名.");
-            }
-
-            List<ReqGoodsSkuSpec.Node> values = spec.getValues();
-            if (null == values || values.isEmpty()) {
-                throw new RuntimeException("规格[" + spec.getKey() + "]中缺少属性.");
-            }
-            total += values.size();
-            for (ReqGoodsSkuSpec.Node e : values) {
-                if (null == e.getId() || e.getId() < 0) {
-                    throw new RuntimeException("规格[" + spec.getKey() + "]中自定义id必须大于0.");
-                }
-                if (StringUtils.isBlank(e.getValue())) {
-                    throw new RuntimeException("规格[" + spec.getKey() + "]中存在空白属性.");
-                }
-                if (e.getId() > maxId) {
-                    maxId = e.getId();
-                }
-
-                if (null == map) {
-                    map = new HashMap<>(16);
-                }
-
-                ReqGoodsSpecSingle single = new ReqGoodsSpecSingle();
-                single.setId(e.getId());
-                single.setKey(spec.getKey());
-                single.setName(e.getValue());
-                map.put(e.getId(), single);
-            }
-        }
+        return GatewayResponse.SUCCESS.newBuilder().toResult();
+    }
 
-        if (map.size() != total) {
-            throw new RuntimeException("规格中存在重复id.");
+    /**
+     * 更新 spec
+     */
+    @PutMapping("/update/spec")
+    public Result<String> updateGoodsSpec(@Validated @RequestBody ReqGoodsSkuInsert insert) throws Exception {
+        Long id = insert.getId();
+        Assert.notNull(id, "规格属性id不存在");
+        GoodsDonSpec spec = goodsDonSpecService.getById(id);
+        if (spec == null || !spec.getGoodsId().equals(insert.getGoodsId())) {
+            throw BusinessRuntimeException.getInstance("规格不存在");
         }
-
-        GoodsDonSpec spec = new GoodsDonSpec();
-        spec.setGoodsId(insert.getGoodsId());
-        spec.setMaxId(maxId);
-        spec.setSpecsJson(Jsons.toJson(specs));
-        spec.setSpecNumber(specNumber);
-        spec.setSpecMapping(Jsons.toJson(map));
-        goodsDonSpecService.save(spec);
-
+        goodsDonSpecService.insertOrUpdateSkuSpec(insert);
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
 
@@ -147,93 +105,7 @@ public class CmsGoodsDonSkuController {
         if (null == goods) {
             throw new RuntimeException("找不到商品spu.");
         }
-        GoodsDonSpec loveSpec = goodsDonSpecService.getOne(Wrappers.lambdaQuery(GoodsDonSpec.class).eq(GoodsDonSpec::getGoodsId,insert.getGoodsId()));
-        if (null == loveSpec) {
-            throw new RuntimeException("该商品未设置总规格, 请设置总规格.");
-        }
-
-        List<ReqGoodsSkuInsert.Sku> skus = insert.getSkus();
-        if (null == skus || skus.isEmpty()) {
-            throw new RuntimeException("参数错误.");
-        }
-        int specNumber = loveSpec.getSpecNumber();
-
-        JavaType type = Jsons.javaType().constructMapType(HashMap.class, Integer.class, ReqGoodsSpecSingle.class);
-        Map<Integer, ReqGoodsSpecSingle> map = Jsons.parseObject(loveSpec.getSpecMapping(), type);
-
-        StringBuilder builder = new StringBuilder();
-        List<ReqGoodsSpecSingle> specList = null;
-        GoodsDonSku goodsDonSku = null;
-
-        // 判断属性是否属于同一个key
-        Set<String> set = null;
-
-        for (ReqGoodsSkuInsert.Sku sku : insert.getSkus()) {
-            // 跳过空值的sku
-            // 解析sku的规格属性
-            final String specIds = sku.getSpecIds();
-            if (StringUtils.isBlank(specIds)) {
-                throw new RuntimeException("请选择商品的规格.");
-            }
-            int[] ids = Jsons.parseObject(specIds, int[].class);
-            if (ids.length != specNumber) {
-                throw new RuntimeException("sku规格数量 与 总规格数量 不一致.");
-            }
-
-            // init
-            builder.delete(0, builder.length());
-            if (null == specList) {
-                specList = new ArrayList<>(specNumber);
-            } else {
-                specList.clear();
-            }
-            if (null == set) {
-                int capacity = (specNumber + 1) * 4 / 3 + 1;
-                set = new HashSet<>(capacity);
-            } else {
-                set.clear();
-            }
-
-            for (int id : ids) {
-                ReqGoodsSpecSingle single = map.get(id);
-                if (null == single) {
-                    throw new RuntimeException("总规格属性id中 不存在 sku中的id.");
-                }
-                builder.append(single.getName()).append(';');
-                specList.add(single);
-                set.add(single.getKey());
-            }
-            if (set.size() != specNumber) {
-                throw new RuntimeException("sku中存在多个属性属于同一个规格.");
-            }
-
-            String specVal = builder.toString();
-            String specJson = Jsons.toJson(specList);
-
-            if (null == goodsDonSku) {
-                goodsDonSku = new GoodsDonSku();
-                goodsDonSku.setGoodsId(insert.getGoodsId());
-            }
-            BeanUtil.copyProperties(sku,goodsDonSku);
-            goodsDonSku.setSpecIds(specIds);
-            goodsDonSku.setSpecVal(specVal);
-            goodsDonSku.setSpecJson(specJson);
-            if (goods.getType() == 1) {
-                if (sku.getMonths() != null && sku.getMonths() > 0 && sku.getDays() != null && sku.getDays() > 0) {
-                    throw BusinessRuntimeException.getInstance("续费天数和续费月数不能同时存在");
-                }
-                if (sku.getMonths() == null && sku.getDays() == null)
-                    throw BusinessRuntimeException.getInstance("请输入对应续费时间");
-            }
-            if (CollUtil.isNotEmpty(sku.getDpSku())) {
-                goodsDonSku.setIsDp(true);
-            }
-            goodsDonSkuService.save(goodsDonSku);
-            if (CollUtil.isNotEmpty(sku.getDpSku())) {
-                goodsDonSkuService.handleDiscountPurchaseGoods(goodsDonSku, sku.getDpSku());
-            }
-
-        }
+        goodsDonSpecService.skuAppend(insert, goods);
         //给平台更新额外属性
         goodsDonService.updateGoodsSkuPrice(goods.getId(), goods);
         Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "*");
@@ -251,9 +123,8 @@ public class CmsGoodsDonSkuController {
         Long goodsId = sku.getGoodsId();
         GoodsDon goods = goodsDonService.getById(goodsId);
         if (goods.getType() == 1) {
-            if (sku.getMonths() != null && sku.getMonths() > 0 && sku.getDays() != null && sku.getDays() > 0) {
+            if (sku.getMonths() != null && sku.getMonths() > 0 && sku.getDays() != null && sku.getDays() > 0)
                 throw BusinessRuntimeException.getInstance("续费天数和续费月数不能同时存在");
-            }
             if (sku.getMonths() == null && sku.getDays() == null)
                 throw BusinessRuntimeException.getInstance("请输入对应续费时间");
         }
@@ -291,6 +162,16 @@ public class CmsGoodsDonSkuController {
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
 
+    /**
+     * 新 生成排列组合规格
+     */
+    @PostMapping("/post/combination/{goodsId}")
+    @Transactional(rollbackFor = Throwable.class)
+    public Result<String> postCombinationSku(@PathVariable Long goodsId, @RequestBody List<CombinationSkuReq> combinations) throws Exception {
+        goodsDonSpecService.combinationSku(goodsId, combinations);
+        return GatewayResponse.SUCCESS.newBuilder().toResult("新增规格成功");
+    }
+
     /**
      * 获取平台规格列表
      */

+ 1 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonSpecController.java

@@ -72,7 +72,7 @@ public class CmsGoodsDonSpecController {
         String specsJson = Jsons.toJson(specs);
 
         JavaType type = Jsons.javaType().constructMapType(HashMap.class, Integer.class, ReqGoodsSpecSingle.class);
-        Map<Integer, ReqGoodsSpecSingle> map = Jsons.parseObject(v2spec.getSpecMapping(), type);
+        Map<Long, ReqGoodsSpecSingle> map = Jsons.parseObject(v2spec.getSpecMapping(), type);
         map.put(specSingle.getId(), specSingle);
         String specMapping = Jsons.toJson(map);
 

+ 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("订单不存在");
         }