From c9acf3683d1363e0ad9550173e7807a370281669 Mon Sep 17 00:00:00 2001 From: luozukai Date: Sat, 16 Mar 2019 17:08:13 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=90=A5=E9=94=80=E5=88=86=E6=9E=90][?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0][=E5=8D=A1=E8=90=A5=E9=94=80=E5=88=97?= =?UTF-8?q?=E8=A1=A8]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/domain/po/WxCoupon.java | 34 +++++++++++++++++++ .../com/iformall/mapper/WxCouponMapper.java | 2 +- .../com/iformall/service/WxCouponService.java | 2 +- .../service/impl/WxCouponServiceImpl.java | 10 ++++-- .../main/resources/mapper/WxCouponMapper.xml | 24 +++++++++++-- 5 files changed, 65 insertions(+), 7 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java index ed8be3115..d9cb09b63 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java @@ -1,5 +1,7 @@ package com.iformall.domain.po; +import org.apache.commons.lang3.StringUtils; + import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Transient; @@ -195,9 +197,41 @@ public class WxCoupon implements Serializable { @io.swagger.annotations.ApiModelProperty(value="砍价参与人数",name="pressJoinCount") @Transient 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----- + 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() { return pressSendCount; } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java index bd6340454..7f6cf6a25 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java @@ -64,7 +64,7 @@ public interface WxCouponMapper extends CommonMapper { List pressSendHistory(WxCoupon wxCoupon); List pressSuccHistory(WxCoupon wxCoupon); List pressPaymentHistory(WxCoupon wxCoupon); - Double pressSuccRate(WxCoupon wxCoupon); + String pressSuccRate(WxCoupon wxCoupon); // Long sumSubsidy(WxCoupon wxCoupon); Long sumJoin(WxCoupon wxCoupon); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java index 2c4645823..10cae0939 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java @@ -170,7 +170,7 @@ public interface WxCouponService { * 砍价转化率 * @return */ - Double pressSuccRate(WxCoupon wxCoupon); + String pressSuccRate(WxCoupon wxCoupon); /** * 商场补贴金额 * @return diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 6675c83f1..1ce8d92bb 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -417,9 +417,13 @@ public class WxCouponServiceImpl implements WxCouponService { } @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 diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index c76eacbae..658f2169c 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -41,6 +41,9 @@ + + + @@ -762,7 +765,24 @@ (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 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 and c.id = #{id} @@ -862,7 +882,7 @@ and wco.create_date between #{startdate} and #{enddate} group by xtime - select round( (select count(wo.id) from wx_coupon wc