Authored by chenchao

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

... ... @@ -8,13 +8,15 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CouponViewMapper {
List<Coupon> selectByAssociatedPrd(@Param("productId") Integer productId,
List<Coupon> selectByAssociatedPrd(@Param("businessClient")String businessClient,
@Param("productId") Integer productId,
@Param("positionType") int positionType,
@Param("currentTime") int currentTime,
@Param("offset")int offset,
@Param("limit")int limit);
int selectCntByAssociatedPrd(@Param("productId") Integer productId,
int selectCntByAssociatedPrd(@Param("businessClient")String businessClient,
@Param("productId") Integer productId,
@Param("positionType") int positionType,
@Param("currentTime") int currentTime);
... ...
... ... @@ -4,12 +4,13 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.annotations.Param;
@Data
@Builder
@NoArgsConstructor@AllArgsConstructor
public class CouponQueryParamOfUseLimitType {
private String businessClient;
private Integer productId;
private int positionType;
private Integer couponType;
... ...
... ... @@ -53,6 +53,7 @@
AND cdp.position_type= #{positionType} AND cdp.`visibility`=1
AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`)
and receive_start_time <![CDATA[ <= ]]> #{currentTime}
AND `business_client` LIKE CONCAT('%',#{businessClient},'%')
ORDER BY coupon_type,use_limit_type,`use_limit_value` DESC
limit #{offset},#{limit}
</select>
... ... @@ -67,6 +68,7 @@
AND cdp.position_type= #{positionType} AND cdp.`visibility`=1
AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`)
and receive_start_time <![CDATA[ <= ]]> #{currentTime}
AND `business_client` LIKE CONCAT('%',#{businessClient},'%')
</select>
<sql id="query_prd_limit">
... ... @@ -87,6 +89,7 @@
AND cdp.position_type= #{positionType} AND cdp.`visibility`=1
AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`)
and receive_start_time <![CDATA[ <= ]]> #{currentTime}
AND `business_client` LIKE CONCAT('%',#{businessClient},'%')
ORDER BY `use_limit_value` DESC
limit #{offset},#{limit}
</select>
... ...
... ... @@ -69,14 +69,14 @@ public class CollectiveCouponService {
final int currentDT = DateUtil.getCurrentTimeSecond();
final int positionType = PositionType.PRD_DETAIL.getCode();
int total = couponViewMapper.selectCntByAssociatedPrd(prdId,positionType,currentDT);
int total = couponViewMapper.selectCntByAssociatedPrd(req.getBusinessClient(),prdId,positionType,currentDT);
if(total == 0){
logger.warn("queryCouponListOfPrdDetail find total number zero, {}", req);
return couponInfoListBuilder.build();
}
int totalPage = PageHelper.getPageTotal(total, limit);
final int offset = PageHelper.getOffsetOfMysql(pageNum, limit);
List<Coupon> datas= couponViewMapper.selectByAssociatedPrd(prdId, positionType,currentDT,offset,limit);
List<Coupon> datas= couponViewMapper.selectByAssociatedPrd(req.getBusinessClient(),prdId, positionType,currentDT,offset,limit);
//when user login, show user coupon
final Integer uid = req.getUid();
... ... @@ -179,6 +179,7 @@ public class CollectiveCouponService {
.productId(req.getProductId())
.positionType(positionType)
.currentTime(currentDT)
.businessClient(req.getBusinessClient())
.offset(offset)
.limit(1)
.build();
... ...