Aslee преди 3 години
родител
ревизия
367ee05e3d
променени са 2 файла, в които са добавени 10 реда и са изтрити 6 реда
  1. 3 1
      src/main/java/com/caimei/service/impl/ProductServiceImpl.java
  2. 7 5
      src/main/resources/mapper/CouponMapper.xml

+ 3 - 1
src/main/java/com/caimei/service/impl/ProductServiceImpl.java

@@ -70,7 +70,9 @@ public class ProductServiceImpl implements ProductService {
             //活动阶梯
             List<ActivityLadderVo> ladderList = productMapper.findActivityLadder(activityId, product.getProductId());
             if (ladderList != null && ladderList.size() > 0) {
-                product.setPrice(ladderList.get(0).getBuyPrice());
+                ActivityLadderVo ladder = ladderList.get(0);
+                // 没有起订量概念,默认显示购买1个商品的价格,若第一阶梯为一个商品,则取第一阶梯时间
+                product.setPrice(1 == ladder.getBuyNum() ? ladder.getBuyPrice() : product.getPrice());
             }
         }
         Integer discount = productMapper.findProductDiscount(product.getProductId(), userId);

+ 7 - 5
src/main/resources/mapper/CouponMapper.xml

@@ -79,15 +79,17 @@
                 (couponType = 1
                 or (couponType = 2 and chc.id in (select distinct couponId from cm_hehe_coupon_user where userId = #{userId}))
                 or (couponType = 3 and #{registerTime} <![CDATA[ >= ]]> startTime)
-                or (couponType = 4 and chc.id in (select group_concat(shareCouponIds) from cm_hehe_coupon_share where shareUserId = #{userId}))
-                or (couponType = 5 and chc.id in (select group_concat(consumeCouponIds) from cm_hehe_coupon_share where shareUserId = #{userId} and consumeFlag = 1))
+                or (couponType = 4 and FIND_IN_SET(chc.id , (select group_concat(shareCouponIds) from cm_hehe_coupon_share where shareUserId = #{userId})))
+                or (couponType = 5 and FIND_IN_SET(chc.id , (select group_concat(consumeCouponIds) from cm_hehe_coupon_share where shareUserId = #{userId} and consumeFlag = 1)))
                 )
             and if(receiveFlag = 1,
                     if(permanentFlag = 1,true,NOW() <![CDATA[ < ]]> endTime),
-                    NOW() <![CDATA[ < ]]> date_add(if(#{registerTime} <![CDATA[ >= ]]>
-                    startTime,#{registerTime},startTime),interval receivePeriod DAY)
+                    NOW() <![CDATA[ < ]]> date_add(
+                        if(couponType <![CDATA[ <= ]]> 3,
+                        if(#{registerTime} <![CDATA[ >= ]]> startTime,#{registerTime},startTime),
+                        (select if(couponType = 4,createTime,updateTime) from cm_hehe_coupon_share where FIND_IN_SET(chc.id,if(couponType = 4,shareCouponIds,consumeCouponIds)))),
+                        interval receivePeriod DAY)
                 )
-            )
         </if>
         <if test="couponType != null">
             and couponType = #{couponType}