diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponChannelController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponChannelController.java index e30db9ebe..474c6b5a3 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponChannelController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponChannelController.java @@ -52,7 +52,7 @@ public class WxCouponChannelController extends BaseController { } wxCouponChannel.setTenantId(getUser().getTenantId()); wxCouponChannel.setSortColumns(WxCouponChannel.Field.Id_DESC); - final PageInfo page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize ,false); + final PageInfo page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); return new ResultData(page); } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java index 921759ce3..2a728e600 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java @@ -39,13 +39,8 @@ public class WxCouponChannelController extends BaseController { wxCouponChannel.setTenantId(getTenantId()); wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); wxCouponChannel.setSortColumns(WxCouponChannel.Field.CreateDate_DESC); - PageInfo page; - if (wxCouponChannel.getTargetAd() != null - && wxCouponChannel.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) - page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize,true); - else - page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize,false); - return new ResultData(page); + + return new ResultData(wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize)); } } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java index fb1ef3c18..f1d85e99e 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java @@ -1,5 +1,6 @@ package com.iformall.domain.vo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxMerchant; @@ -8,30 +9,27 @@ import javax.persistence.Transient; import java.io.Serializable; import java.math.BigDecimal; import java.text.DecimalFormat; +import java.util.List; /** * Created by syf on 2018/8/22. */ +@JsonIgnoreProperties(value = {"handler"}) public class WxCouponChannelVo extends WxCouponChannel implements Serializable { private static final long serialVersionUID = 1L; /*总库存**/ @io.swagger.annotations.ApiModelProperty(value="总库存",name="inventory") private Integer inventory; - /*剩余库存**/ @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") private Integer remainInventory; - /*封面图**/ @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") private String coverImg; - - /*券名称**/ @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") private String title; - /*副标题**/ @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") private String subTitle; @@ -48,9 +46,13 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { @io.swagger.annotations.ApiModelProperty(value="单位0:钱分,1:小时",name="unit") private Integer unit; - /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ - @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") - private Integer type; + /*限领张数**/ + @io.swagger.annotations.ApiModelProperty(value="限领张数",name="useLimitQuantity") + private Integer useLimitQuantity; + + /*1.主动领取2.定向投放**/ + @io.swagger.annotations.ApiModelProperty(value="1.主动领取2.定向投放",name="sendType") + private Integer sendType; @Transient private String salePriceStr; @@ -61,17 +63,9 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { @Transient private String priceStr; - @Transient - private String merchantName; - - /*限领张数**/ - @io.swagger.annotations.ApiModelProperty(value="限领张数",name="useLimitQuantity") - private Integer useLimitQuantity; - - /*1.主动领取2.定向投放**/ - @io.swagger.annotations.ApiModelProperty(value="1.主动领取2.定向投放",name="sendType") - private Integer sendType; - + /*发券商户信息*/ + @io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList") + private List merchantVoList; @Transient private Integer gameWeight; @@ -197,36 +191,11 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { this.priceStr = priceStr; } - public String getMerchantName() { - return merchantName; + public List getMerchantVoList() { + return merchantVoList; } - public void setMerchantName(String merchantName) { - this.merchantName = merchantName; + public void setMerchantVoList(List merchantVoList) { + this.merchantVoList = merchantVoList; } - - - public WxCouponChannelVo(){} - public WxCouponChannelVo setWxCoupon (WxCoupon wxCoupon){ - this.coverImg=wxCoupon.getCoverImg(); - this.inventory=wxCoupon.getInventory(); - this.remainInventory=wxCoupon.getRemainInventory(); - this.price=wxCoupon.getPrice(); - this.unit=wxCoupon.getUnit(); - this.salePrice=wxCoupon.getSalePrice(); - this.sendType=wxCoupon.getSendType(); - this.useLimitQuantity=wxCoupon.getUseLimitQuantity(); - this.usePrice=wxCoupon.getUsePrice(); - this.subTitle=wxCoupon.getSubTitle(); - this.title=wxCoupon.getSubTitle(); - this.type=wxCoupon.getType(); - return this; - } - - public WxCouponChannelVo setWxMerchant (WxMerchant wxMerchant){ - - this.merchantName=wxMerchant.getName(); - return this; - } - } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java index d519cf5dd..e9fd0fb61 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java @@ -12,7 +12,6 @@ public interface WxCouponChannelMapper extends CommonMapper findVoList(WxCouponChannel wxCouponChannel); - List findVoListForCouponChannel2(WxCouponChannel wxCouponChannel); void updateStatusByCouponId(WxCouponChannel wxCouponChannel); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java index 37d3d3d3b..ccfdaee5e 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java @@ -28,7 +28,7 @@ public interface WxCouponChannelService { * @param pageSize * @return */ - PageInfo listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize, boolean couponChannel2); + PageInfo listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize); /** * 根据实体查询Vo分页列表 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java index ee1b7771d..98811669a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -191,53 +191,20 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { * @return */ @Override - public PageInfo listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize, boolean couponChannel2) { + public PageInfo listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize) { List wxCouponChannelVoList = new ArrayList<>(); PageHelper.startPage(pageIndex, pageSize); - if (couponChannel2) - wxCouponChannelVoList = wxCouponChannelMapper.findVoListForCouponChannel2(record); - else - wxCouponChannelVoList = wxCouponChannelMapper.findVoList(record); - if(wxCouponChannelVoList.isEmpty()){ - return new PageInfo<>(wxCouponChannelVoList); - } - List couponIds = wxCouponChannelVoList.stream().map(p->p.getCouponId()).distinct().collect(Collectors.toList()); - WxCoupon wxCoupon = new WxCoupon(); - wxCoupon.setIds(couponIds); - List wxCoupons = wxCouponService.findList(wxCoupon); - Map couponNamesMap = wxCoupons.stream().collect(Collectors.toMap(WxCoupon::getId,p->p)); - for (WxCouponChannelVo wxcouponVo:wxCouponChannelVoList) { - if(couponNamesMap.get(wxcouponVo.getCouponId())!=null){ - wxcouponVo.setWxCoupon(couponNamesMap.get(wxcouponVo.getCouponId())); - //WxMerchant wxMerchant = new WxMerchant(); - //wxMerchant.setId(wxcouponVo.getMerchantId()); - //wxMerchant = wxMerchantMapper.selectByPrimaryKey(wxMerchant); - //if (wxMerchant != null) - // wxcouponVo.setWxMerchant(wxMerchant); - //PENG TODO - } - } + + wxCouponChannelVoList = wxCouponChannelMapper.findVoList(record); + return new PageInfo<>(wxCouponChannelVoList); } @Override public List listAPI(WxCouponChannel record) { List wxCouponChannelVoList = new ArrayList<>(); - wxCouponChannelVoList = wxCouponChannelMapper.findVoList(record); - if(wxCouponChannelVoList.isEmpty()){ - return wxCouponChannelVoList; - } - List couponIds = wxCouponChannelVoList.stream().map(p->p.getCouponId()).distinct().collect(Collectors.toList()); - WxCoupon wxCoupon = new WxCoupon(); - wxCoupon.setIds(couponIds); - List wxCoupons = wxCouponService.findList(wxCoupon); - Map couponNamesMap = wxCoupons.stream().collect(Collectors.toMap(WxCoupon::getId,p->p)); - for (WxCouponChannelVo wxcouponVo:wxCouponChannelVoList) { - if(couponNamesMap.get(wxcouponVo.getCouponId())!=null){ - wxcouponVo.setWxCoupon(couponNamesMap.get(wxcouponVo.getCouponId())); - } - } - return wxCouponChannelVoList; + return wxCouponChannelMapper.findVoList(record); + } } diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index 58dedba55..63a7ae0a7 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -18,70 +18,67 @@ - `id`,`tenant_id`,`coupon_id`,`coupon_status`,`type`,`title`,`target_ad`,`business`,`begin_time`,`end_time`,`status`,`create_date`,`update_date`,`sub_target_id` + cc.`id`,cc.`tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`,cc.`target_ad`,cc.`business`,cc.`begin_time`,cc.`end_time`,cc.`status`,cc.`create_date`,cc.`update_date`,cc.`sub_target_id` where 1 = 1 - and `id` = #{id} + and cc.`id` = #{id} - and `tenant_id` = #{tenantId} + and cc.`tenant_id` = #{tenantId} - and `coupon_id` = #{couponId} + and cc.`coupon_id` = #{couponId} - and `type` = #{type} + and cc.`type` = #{type} - and `title` like concat('%', #{title},'%') + and cc.`title` like concat('%', #{title},'%') - and `target_ad` = #{targetAd} + and cc.`target_ad` = #{targetAd} - and `business` = #{business} + and cc.`business` = #{business} - - and `begin_time` = #{beginTime} - - - - and `end_time` = #{endTime} + + and cc.`begin_time` < now() + and cc.`end_time` > now() - and `status` = #{status} + and cc.`status` = #{status} - and `create_date` = #{createDate} + and cc.`create_date` = #{createDate} - and `update_date` = #{updateDate} + and cc.`update_date` = #{updateDate} - and `sub_target_id` = #{subTargetId} + and cc.`sub_target_id` = #{subTargetId} - and id in + and cc.id in #{idItem} - and coupon_id in + and cc.coupon_id in #{couponIdsItem} @@ -90,11 +87,12 @@ + @@ -102,6 +100,10 @@ update wx_coupon_channel set status=#{status} where tenant_id=#{tenantId} and coupon_id=#{couponId} + + , + c.remain_inventory,c.inventory,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.use_limit_quantity,c.send_type + @@ -114,89 +116,34 @@ + + + + + + + + + + + + + + + - - -