zoujiajian před 1 rokem
rodič
revize
005c1dcb5f

+ 1 - 3
netflix-dao/src/main/resources/mapper/CouponUserMapper.xml

@@ -319,9 +319,7 @@
     <select id="selectNoLoginRecommendCouponReduce" resultType="com.cyksj.model.entity.Coupon">
         select c.id,
                c.discount,
-               c.reduce_money,
-               cu.valid_start_time,
-               cu.valid_end_time,
+               c.reduce_money
                if(type = 'discount', sku.price * (1 - c.discount), c.reduce_money) as couponMoney
         from coupon c
                  inner join coupon_recommend cr on cr.coupon_id = c.id

+ 26 - 1
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -653,6 +653,13 @@ public class GoodsDonController {
 							}
 						}
 						List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
+						if (type == HomeManagementConfig.Type.vg) {
+							//未登录
+							if (fUid == null) {
+								//推荐优惠券商品最低折扣
+								setHomeConfigGoodsCouponMoney(homeManagementFrontViews);
+							}
+						}
 						//实物推荐多语言
 						if (language.get() && type == HomeManagementConfig.Type.rg) {
 							backInfoTranslationsFrontService.getHomeConfigRealGoodsLanguage(homeManagementFrontViews, lang);
@@ -1645,7 +1652,7 @@ public class GoodsDonController {
 
 
 	/**
-	 * 未登录 推荐优惠券
+	 * 未登录 分类下平台推荐优惠券
 	 */
 	private void setGoodsCouponMoney(GoodsFrontListCategoryView data) {
 		//寻找对应最低规格的推荐优惠券
@@ -1660,4 +1667,22 @@ public class GoodsDonController {
 		}
 	}
 
+	/**
+	 * 未登录 首页推荐推荐优惠券
+	 */
+	private void setHomeConfigGoodsCouponMoney(List<HomeManagementFrontView> homeManagementFrontViews) {
+		//寻找对应最低规格的推荐优惠券
+		homeManagementFrontViews.forEach(data->{
+			Coupon coupon = couponUserMapper.selectNoLoginRecommendCouponReduce(data.getGoodsId(), data.getPrice());
+			if (coupon != null) {
+				data.setDiscount(coupon.getDiscount());
+				data.setReduceMoney(coupon.getReduceMoney());
+				data.setDiscountPrice(data.getPrice().subtract(coupon.getCouponMoney()));
+				data.setValidEndTime(coupon.getValidEndTime());
+				data.setCouponId(coupon.getId());
+				data.setSource(1);
+			}
+		});
+	}
+
 }