| @@ -1,5 +1,7 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | import javax.persistence.Table; | ||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| @@ -195,9 +197,41 @@ public class WxCoupon implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="砍价参与人数",name="pressJoinCount") | @io.swagger.annotations.ApiModelProperty(value="砍价参与人数",name="pressJoinCount") | ||||
| @Transient | @Transient | ||||
| private Integer pressJoinCount; | private Integer pressJoinCount; | ||||
| /**商场补贴**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商场补贴",name="sumSubsidy") | |||||
| @Transient | |||||
| private Integer sumSubsidy; | |||||
| /**核销比**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="核销比",name="paymentRate") | |||||
| @Transient | |||||
| private String paymentRate; | |||||
| //营销分析-----end----- | //营销分析-----end----- | ||||
| public Integer getSumSubsidy() { | |||||
| return sumSubsidy; | |||||
| } | |||||
| public void setSumSubsidy(Integer sumSubsidy) { | |||||
| this.sumSubsidy = sumSubsidy; | |||||
| } | |||||
| public String getPaymentRate() { | |||||
| return paymentRate; | |||||
| } | |||||
| public void setPaymentRate(String paymentRate) { | |||||
| if(StringUtils.isNotBlank(paymentRate)) { | |||||
| if ("0.00".equals(paymentRate)) { | |||||
| this.paymentRate = "0%"; | |||||
| } else { | |||||
| this.paymentRate = paymentRate + "%"; | |||||
| } | |||||
| } | |||||
| } | |||||
| public Integer getPressSendCount() { | public Integer getPressSendCount() { | ||||
| return pressSendCount; | return pressSendCount; | ||||
| } | } | ||||
| @@ -64,7 +64,7 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| List<WxCoupon> pressSendHistory(WxCoupon wxCoupon); | List<WxCoupon> pressSendHistory(WxCoupon wxCoupon); | ||||
| List<WxCoupon> pressSuccHistory(WxCoupon wxCoupon); | List<WxCoupon> pressSuccHistory(WxCoupon wxCoupon); | ||||
| List<WxCoupon> pressPaymentHistory(WxCoupon wxCoupon); | List<WxCoupon> pressPaymentHistory(WxCoupon wxCoupon); | ||||
| Double pressSuccRate(WxCoupon wxCoupon); | |||||
| String pressSuccRate(WxCoupon wxCoupon); | |||||
| // Long sumSubsidy(WxCoupon wxCoupon); | // Long sumSubsidy(WxCoupon wxCoupon); | ||||
| Long sumJoin(WxCoupon wxCoupon); | Long sumJoin(WxCoupon wxCoupon); | ||||
| } | } | ||||
| @@ -170,7 +170,7 @@ public interface WxCouponService { | |||||
| * 砍价转化率 | * 砍价转化率 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Double pressSuccRate(WxCoupon wxCoupon); | |||||
| String pressSuccRate(WxCoupon wxCoupon); | |||||
| /** | /** | ||||
| * 商场补贴金额 | * 商场补贴金额 | ||||
| * @return | * @return | ||||
| @@ -417,9 +417,13 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Double pressSuccRate(WxCoupon wxCoupon) { | |||||
| Double count = wxCouponMapper.pressSuccRate(wxCoupon); | |||||
| return (count==null)?0l:count; | |||||
| public String pressSuccRate(WxCoupon wxCoupon) { | |||||
| String count = wxCouponMapper.pressSuccRate(wxCoupon); | |||||
| if ("0.00".equals(count)) { | |||||
| return "0%"; | |||||
| } else { | |||||
| return count + "%"; | |||||
| } | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -41,6 +41,9 @@ | |||||
| <result column="press_count" property="pressSendCount"/> | <result column="press_count" property="pressSendCount"/> | ||||
| <result column="press_succ_count" property="pressSuccCount"/> | <result column="press_succ_count" property="pressSuccCount"/> | ||||
| <result column="join_count" property="pressJoinCount"/> | <result column="join_count" property="pressJoinCount"/> | ||||
| <result column="sum_subsidy" property="sumSubsidy"/> | |||||
| <result column="payment_rate" property="paymentRate"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| @@ -762,7 +765,24 @@ | |||||
| (select count(wop.id) from wx_coupon wc | (select count(wop.id) from wx_coupon wc | ||||
| left join wx_order wo on wo.product_id = wc.id | left join wx_order wo on wo.product_id = wc.id | ||||
| left join wx_order_press wop on wop.order_id = wo.id | left join wx_order_press wop on wop.order_id = wo.id | ||||
| where wc.id = c.id) as join_count | |||||
| where wc.id = c.id) as join_count, | |||||
| round( | |||||
| (select count(wco.id) xcount from wx_coupon wc | |||||
| left join wx_coupon_order wco on wco.coupon_id = wc.id | |||||
| where wc.type = 8 and wco.coupon_order_status = 1 | |||||
| and wc.id = c.id) | |||||
| / | |||||
| (select count(wop.id) from wx_coupon wc | |||||
| left join wx_order wo on wo.product_id = wc.id | |||||
| left join wx_order_press wop on wop.order_id = wo.id | |||||
| where wop.first = 1 and wc.id = c.id) | |||||
| *100,2) as payment_rate, | |||||
| (select sum(wc.subsidy_num) from wx_coupon wc | |||||
| left join wx_order wo on wo.product_id = wc.id | |||||
| where wo.order_status = 7 and wc.id = c.id) as sum_subsidy | |||||
| from wx_coupon c where c.type = 8 | from wx_coupon c where c.type = 8 | ||||
| <if test="id != null"> | <if test="id != null"> | ||||
| and c.id = #{id} | and c.id = #{id} | ||||
| @@ -862,7 +882,7 @@ | |||||
| and wco.create_date between #{startdate} and #{enddate} | and wco.create_date between #{startdate} and #{enddate} | ||||
| group by xtime | group by xtime | ||||
| </select> | </select> | ||||
| <select id="pressSuccRate" parameterType="com.iformall.domain.po.WxCoupon" resultType="java.lang.Double"> | |||||
| <select id="pressSuccRate" parameterType="com.iformall.domain.po.WxCoupon" resultType="java.lang.String"> | |||||
| select | select | ||||
| round( | round( | ||||
| (select count(wo.id) from wx_coupon wc | (select count(wo.id) from wx_coupon wc | ||||