zoujiajian 3 năm trước cách đây
mục cha
commit
f9ef525760

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

@@ -106,37 +106,31 @@ public class GoodsDon extends BaseEntity {
     /**
      * 最小规格价格
      */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private BigDecimal minPrice;
 
     /**
      * 最小规格价格月份
      */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Integer minMonths;
 
     /**
      * 最小规格 天数
      */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Integer minDays;
 
     /**
      * 最大规格价格
      */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private BigDecimal maxPrice;
 
     /**
      * 最大规格价格月份
      */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Integer maxMonths;
 
     /**
      * 最大规格 天数
      */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Integer maxDays;
 
     /**

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

@@ -1,7 +1,9 @@
 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;
 
@@ -44,4 +46,11 @@ public class GoodsRecommendViews {
 
 	@DbField("g.min_price")
 	private BigDecimal price;
+
+	@JsonIgnore
+	@DbField("g.virtual_sold")
+	private Integer virtualSold;
+
+	@DbIgnore
+	private Integer sold;
 }

+ 16 - 8
netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsGoodsDonServiceImpl.java

@@ -34,19 +34,27 @@ public class CmsGoodsDonServiceImpl extends ServiceImpl<GoodsDonMapper, GoodsDon
 				.build());
 		if (!skuViews.isEmpty()) {
 			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 {
 				GoodsDonSkuFrontView max = skuViews.get(skuViews.size() - 1);
-				goods.setMinPrice(min.getPrice());
-				goods.setMinMonths(min.getMonths());
-				goods.setMinDays(min.getDays());
-
+				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());

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

@@ -298,6 +298,11 @@ public class GoodsDonController {
             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);
             }