Browse Source

优惠券增加商品图片展示

zyj
sj 2 years ago
parent
commit
50c1f73901
  1. 19
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponIssueServiceImpl.java
  2. 2
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueMapper.java
  3. 7
      zsw-bxg/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponIssueQueryVo.java

19
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponIssueServiceImpl.java

@ -27,7 +27,10 @@ import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueDto;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStoreCouponIssueMapper;
import co.yixiang.modules.activity.vo.YxStoreCouponIssueQueryVo;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.service.YxStoreProductService;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
@ -59,6 +62,7 @@ public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl<YxStoreCoupon
private final YxStoreCouponUserService storeCouponUserService;
private final YxStoreCouponIssueUserService storeCouponIssueUserService;
private final YxStoreProductService yxStoreProductService;
@Autowired
private ApplicationEventPublisher publisher;
@ -122,6 +126,21 @@ public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl<YxStoreCoupon
.selecCoupontList(pageModel,type,productId);
for (YxStoreCouponIssueQueryVo couponIssue : list) {
Long count = this.couponCount(couponIssue.getId(),uid);
String[] idList=couponIssue.getProductId().split(",");
List<String> needIdlist;
if (idList.length>3){
needIdlist= Arrays.asList(Arrays.copyOf(idList, 3));
}else {
needIdlist= Arrays.asList(idList);
}
List<String> imageList=new ArrayList<>();
needIdlist.forEach(id->{
YxStoreProduct yxStoreProduct=yxStoreProductService.getById(id);
if (ObjectUtil.isNotEmpty(yxStoreProduct)&& StringUtils.isNotBlank(yxStoreProduct.getImage())){
imageList.add(yxStoreProductService.getById(id).getImage());
}
});
couponIssue.setImage(imageList);
if(count > 0){
couponIssue.setIsUse(true);
}else{

2
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreCouponIssueMapper.java

@ -28,7 +28,7 @@ public interface YxStoreCouponIssueMapper extends CoreMapper<YxStoreCouponIssue>
@Select("<script>select A.cid,A.end_time as endTime,A.start_time as startTime,A.cname,A.ctype," +
"A.is_permanent as isPermanent,A.remain_count as remainCount," +
"A.total_count as totalCount,A.id,B.coupon_price as couponPrice," +
"B.use_min_price as useMinPrice" +
"B.use_min_price as useMinPrice,B.product_id as productId" +
" from yx_store_coupon_issue A left join yx_store_coupon B " +
"on A.cid = B.id " +
"where A.status =1 <if test='type == 1'> AND B.type = #{type} AND FIND_IN_SET(#{productId},product_id)</if> " +

7
zsw-bxg/src/main/java/co/yixiang/modules/activity/vo/YxStoreCouponIssueQueryVo.java

@ -7,6 +7,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* <p>
@ -32,6 +33,12 @@ public class YxStoreCouponIssueQueryVo implements Serializable {
@ApiModelProperty(value = "优惠券类别")
private Integer ctype;
@ApiModelProperty(value = "可用商品id")
private String productId;
@ApiModelProperty(value = "商品轮播图")
private List<String> image;
@ApiModelProperty(value = "优惠券领取开启时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
private Date startTime;

Loading…
Cancel
Save