Ver a proveniência

[A端][需求]:couponchannel接口调整适应多商户券

release_toaliyun_real
hupeng há 7 anos
ascendente
cometimento
b05c10a47e
7 ficheiros alterados com 72 adições e 195 eliminações
  1. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/WxCouponChannelController.java
  2. +2
    -7
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java
  3. +17
    -48
      mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java
  4. +0
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java
  5. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java
  6. +6
    -39
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  7. +45
    -98
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml

+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/WxCouponChannelController.java Ver ficheiro

@@ -52,7 +52,7 @@ public class WxCouponChannelController extends BaseController {
}
wxCouponChannel.setTenantId(getUser().getTenantId());
wxCouponChannel.setSortColumns(WxCouponChannel.Field.Id_DESC);
final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize ,false);
final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize);
return new ResultData(page);
}



+ 2
- 7
mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java Ver ficheiro

@@ -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<WxCouponChannelVo> 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));
}

}

+ 17
- 48
mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java Ver ficheiro

@@ -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<WxMerchantVo> 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<WxMerchantVo> getMerchantVoList() {
return merchantVoList;
}

public void setMerchantName(String merchantName) {
this.merchantName = merchantName;
public void setMerchantVoList(List<WxMerchantVo> 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;
}

}

+ 0
- 1
mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java Ver ficheiro

@@ -12,7 +12,6 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str
int countCoupon(WxCouponChannel wxCouponChannel);

List<WxCouponChannelVo> findVoList(WxCouponChannel wxCouponChannel);
List<WxCouponChannelVo> findVoListForCouponChannel2(WxCouponChannel wxCouponChannel);

void updateStatusByCouponId(WxCouponChannel wxCouponChannel);



+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java Ver ficheiro

@@ -28,7 +28,7 @@ public interface WxCouponChannelService {
* @param pageSize
* @return
*/
PageInfo<WxCouponChannelVo> listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize, boolean couponChannel2);
PageInfo<WxCouponChannelVo> listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize);

/**
* 根据实体查询Vo分页列表


+ 6
- 39
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Ver ficheiro

@@ -191,53 +191,20 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
* @return
*/
@Override
public PageInfo<WxCouponChannelVo> listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize, boolean couponChannel2) {
public PageInfo<WxCouponChannelVo> listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize) {
List<WxCouponChannelVo> 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<Long> couponIds = wxCouponChannelVoList.stream().map(p->p.getCouponId()).distinct().collect(Collectors.toList());
WxCoupon wxCoupon = new WxCoupon();
wxCoupon.setIds(couponIds);
List<WxCoupon> wxCoupons = wxCouponService.findList(wxCoupon);
Map<Long,WxCoupon> 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<WxCouponChannelVo> listAPI(WxCouponChannel record) {
List<WxCouponChannelVo> wxCouponChannelVoList = new ArrayList<>();
wxCouponChannelVoList = wxCouponChannelMapper.findVoList(record);
if(wxCouponChannelVoList.isEmpty()){
return wxCouponChannelVoList;
}
List<Long> couponIds = wxCouponChannelVoList.stream().map(p->p.getCouponId()).distinct().collect(Collectors.toList());
WxCoupon wxCoupon = new WxCoupon();
wxCoupon.setIds(couponIds);
List<WxCoupon> wxCoupons = wxCouponService.findList(wxCoupon);
Map<Long,WxCoupon> 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);

}

}

+ 45
- 98
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml Ver ficheiro

@@ -18,70 +18,67 @@
</resultMap>

<sql id="allColumns">
`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`
</sql>

<sql id="dynamicWhereConditions">
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
and cc.`id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
and cc.`tenant_id` = #{tenantId}
</if>

<if test=" null != couponId ">
and `coupon_id` = #{couponId}
and cc.`coupon_id` = #{couponId}
</if>

<if test=" null != type ">
and `type` = #{type}
and cc.`type` = #{type}
</if>

<if test=" null != title ">
and `title` like concat('%', #{title},'%')
and cc.`title` like concat('%', #{title},'%')
</if>

<if test=" null != targetAd ">
and `target_ad` = #{targetAd}
and cc.`target_ad` = #{targetAd}
</if>

<if test=" null != business ">
and `business` = #{business}
and cc.`business` = #{business}
</if>

<if test=" null != beginTime ">
and `begin_time` = #{beginTime}
</if>

<if test=" null != endTime ">
and `end_time` = #{endTime}
<if test=" null != beginTime and null != endTime and null != targetAd and 2 == targetAd">
and cc.`begin_time` &lt; now()
and cc.`end_time` &gt; now()
</if>

<if test=" null != status ">
and `status` = #{status}
and cc.`status` = #{status}
</if>

<if test=" null != createDate ">
and `create_date` = #{createDate}
and cc.`create_date` = #{createDate}
</if>

<if test=" null != updateDate ">
and `update_date` = #{updateDate}
and cc.`update_date` = #{updateDate}
</if>
<if test=" null != subTargetId ">
and `sub_target_id` = #{subTargetId}
and cc.`sub_target_id` = #{subTargetId}
</if>
<if test=" null != ids ">
and id in
and cc.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != couponIds ">
and coupon_id in
and cc.coupon_id in
<foreach collection="couponIds" index="index" item="couponIdsItem" open="(" separator="," close=")">
#{couponIdsItem}
</foreach>
@@ -90,11 +87,12 @@
</sql>

<select id="findList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_coupon_channel
select <include refid="allColumns" /> from wx_coupon_channel cc
<include refid="dynamicWhereConditions" />
</select>

<select id="findListByCouponIds" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_coupon_channel
select <include refid="allColumns" /> from wx_coupon_channel cc
<include refid="dynamicWhereConditions" />
</select>

@@ -102,6 +100,10 @@
update wx_coupon_channel set status=#{status} where tenant_id=#{tenantId} and coupon_id=#{couponId}
</update>

<sql id="allVoColumns">
<include refid="allColumns" />,
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
</sql>

<resultMap id="CouponChannelVoMap" type="com.iformall.domain.vo.WxCouponChannelVo">
<id column="id" jdbcType="BIGINT" property="id" />
@@ -114,89 +116,34 @@
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="sub_target_id" jdbcType="BIGINT" property="subTargetId" />

<result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/>
<result column="inventory" jdbcType="INTEGER" property="inventory"/>
<result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
<result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
<result column="use_price" jdbcType="INTEGER" property="usePrice"/>
<result column="price" jdbcType="INTEGER" property="price"/>
<result column="unit" jdbcType="INTEGER" property="unit"/>
<result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
<result column="send_type" jdbcType="INTEGER" property="sendType"/>

<collection column="{productId=coupon_id}" property="merchantVoList"
ofType="com.iformall.domain.vo.WxMerchantVo"
javaType="java.util.ArrayList"
select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantVoList" >
</collection>
</resultMap>


<select id="findVoList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap">
select <include refid="allColumns" /> from wx_coupon_channel
select <include refid="allVoColumns" />
from wx_coupon_channel cc
left join wx_coupon c on cc.coupon_id = c.id
<include refid="dynamicWhereConditions" />
</select>

<select id="findVoListForCouponChannel2" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap">
select <include refid="allColumns" /> from wx_coupon_channel
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != couponId ">
and `coupon_id` = #{couponId}
</if>

<if test=" null != type ">
and `type` = #{type}
</if>

<if test=" null != title ">
and `title` like concat('%', #{title},'%')
</if>

<if test=" null != targetAd ">
and `target_ad` = #{targetAd}
</if>

<if test=" null != business ">
and `business` = #{business}
</if>

<if test=" null != beginTime ">
and `begin_time` = #{beginTime}
</if>

<if test=" null != targetAd and 2 == targetAd">
and `begin_time` &lt; now()
and `end_time` &gt; now()
</if>

<if test=" null != endTime ">
and `end_time` = #{endTime}
</if>

<if test=" null != status ">
and `status` = #{status}
</if>

<if test=" null != createDate ">
and `create_date` = #{createDate}
</if>

<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>
<if test=" null != subTargetId ">
and `sub_target_id` = #{subTargetId}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != couponIds ">
and coupon_id in
<foreach collection="couponIds" index="index" item="couponIdsItem" open="(" separator="," close=")">
#{couponIdsItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</select>


<select id="countCoupon" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="java.lang.Integer">
select count(distinct coupon_id) from wx_coupon_channel
<include refid="dynamicWhereConditions" />


Carregando…
Cancelar
Guardar