Authored by chenchao

fix 【商品详情页面展示优惠券】后台新增一个优惠券,设置为闲鱼端,在ufo商品详情页面能够正常展示

@@ -8,13 +8,15 @@ import org.apache.ibatis.annotations.Param; @@ -8,13 +8,15 @@ import org.apache.ibatis.annotations.Param;
8 import java.util.List; 8 import java.util.List;
9 9
10 public interface CouponViewMapper { 10 public interface CouponViewMapper {
11 - List<Coupon> selectByAssociatedPrd(@Param("productId") Integer productId, 11 + List<Coupon> selectByAssociatedPrd(@Param("businessClient")String businessClient,
  12 + @Param("productId") Integer productId,
12 @Param("positionType") int positionType, 13 @Param("positionType") int positionType,
13 @Param("currentTime") int currentTime, 14 @Param("currentTime") int currentTime,
14 @Param("offset")int offset, 15 @Param("offset")int offset,
15 @Param("limit")int limit); 16 @Param("limit")int limit);
16 17
17 - int selectCntByAssociatedPrd(@Param("productId") Integer productId, 18 + int selectCntByAssociatedPrd(@Param("businessClient")String businessClient,
  19 + @Param("productId") Integer productId,
18 @Param("positionType") int positionType, 20 @Param("positionType") int positionType,
19 @Param("currentTime") int currentTime); 21 @Param("currentTime") int currentTime);
20 22
@@ -4,12 +4,13 @@ import lombok.AllArgsConstructor; @@ -4,12 +4,13 @@ import lombok.AllArgsConstructor;
4 import lombok.Builder; 4 import lombok.Builder;
5 import lombok.Data; 5 import lombok.Data;
6 import lombok.NoArgsConstructor; 6 import lombok.NoArgsConstructor;
  7 +import org.apache.ibatis.annotations.Param;
7 8
8 @Data 9 @Data
9 @Builder 10 @Builder
10 @NoArgsConstructor@AllArgsConstructor 11 @NoArgsConstructor@AllArgsConstructor
11 public class CouponQueryParamOfUseLimitType { 12 public class CouponQueryParamOfUseLimitType {
12 - 13 + private String businessClient;
13 private Integer productId; 14 private Integer productId;
14 private int positionType; 15 private int positionType;
15 private Integer couponType; 16 private Integer couponType;
@@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
53 AND cdp.position_type= #{positionType} AND cdp.`visibility`=1 53 AND cdp.position_type= #{positionType} AND cdp.`visibility`=1
54 AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`) 54 AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`)
55 and receive_start_time <![CDATA[ <= ]]> #{currentTime} 55 and receive_start_time <![CDATA[ <= ]]> #{currentTime}
  56 + AND `business_client` LIKE CONCAT('%',#{businessClient},'%')
56 ORDER BY coupon_type,use_limit_type,`use_limit_value` DESC 57 ORDER BY coupon_type,use_limit_type,`use_limit_value` DESC
57 limit #{offset},#{limit} 58 limit #{offset},#{limit}
58 </select> 59 </select>
@@ -67,6 +68,7 @@ @@ -67,6 +68,7 @@
67 AND cdp.position_type= #{positionType} AND cdp.`visibility`=1 68 AND cdp.position_type= #{positionType} AND cdp.`visibility`=1
68 AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`) 69 AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`)
69 and receive_start_time <![CDATA[ <= ]]> #{currentTime} 70 and receive_start_time <![CDATA[ <= ]]> #{currentTime}
  71 + AND `business_client` LIKE CONCAT('%',#{businessClient},'%')
70 </select> 72 </select>
71 73
72 <sql id="query_prd_limit"> 74 <sql id="query_prd_limit">
@@ -87,6 +89,7 @@ @@ -87,6 +89,7 @@
87 AND cdp.position_type= #{positionType} AND cdp.`visibility`=1 89 AND cdp.position_type= #{positionType} AND cdp.`visibility`=1
88 AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`) 90 AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`)
89 and receive_start_time <![CDATA[ <= ]]> #{currentTime} 91 and receive_start_time <![CDATA[ <= ]]> #{currentTime}
  92 + AND `business_client` LIKE CONCAT('%',#{businessClient},'%')
90 ORDER BY `use_limit_value` DESC 93 ORDER BY `use_limit_value` DESC
91 limit #{offset},#{limit} 94 limit #{offset},#{limit}
92 </select> 95 </select>
@@ -69,14 +69,14 @@ public class CollectiveCouponService { @@ -69,14 +69,14 @@ public class CollectiveCouponService {
69 final int currentDT = DateUtil.getCurrentTimeSecond(); 69 final int currentDT = DateUtil.getCurrentTimeSecond();
70 final int positionType = PositionType.PRD_DETAIL.getCode(); 70 final int positionType = PositionType.PRD_DETAIL.getCode();
71 71
72 - int total = couponViewMapper.selectCntByAssociatedPrd(prdId,positionType,currentDT); 72 + int total = couponViewMapper.selectCntByAssociatedPrd(req.getBusinessClient(),prdId,positionType,currentDT);
73 if(total == 0){ 73 if(total == 0){
74 logger.warn("queryCouponListOfPrdDetail find total number zero, {}", req); 74 logger.warn("queryCouponListOfPrdDetail find total number zero, {}", req);
75 return couponInfoListBuilder.build(); 75 return couponInfoListBuilder.build();
76 } 76 }
77 int totalPage = PageHelper.getPageTotal(total, limit); 77 int totalPage = PageHelper.getPageTotal(total, limit);
78 final int offset = PageHelper.getOffsetOfMysql(pageNum, limit); 78 final int offset = PageHelper.getOffsetOfMysql(pageNum, limit);
79 - List<Coupon> datas= couponViewMapper.selectByAssociatedPrd(prdId, positionType,currentDT,offset,limit); 79 + List<Coupon> datas= couponViewMapper.selectByAssociatedPrd(req.getBusinessClient(),prdId, positionType,currentDT,offset,limit);
80 //when user login, show user coupon 80 //when user login, show user coupon
81 81
82 final Integer uid = req.getUid(); 82 final Integer uid = req.getUid();
@@ -179,6 +179,7 @@ public class CollectiveCouponService { @@ -179,6 +179,7 @@ public class CollectiveCouponService {
179 .productId(req.getProductId()) 179 .productId(req.getProductId())
180 .positionType(positionType) 180 .positionType(positionType)
181 .currentTime(currentDT) 181 .currentTime(currentDT)
  182 + .businessClient(req.getBusinessClient())
182 .offset(offset) 183 .offset(offset)
183 .limit(1) 184 .limit(1)
184 .build(); 185 .build();