ソースを参照

[营销分析][添加][卡营销列表]

release_toaliyun_real
luozukai 7年前
コミット
688ec543a8
7個のファイルの変更259行の追加22行の削除
  1. +4
    -3
      mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java
  2. +37
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
  3. +9
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  4. +32
    -0
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  5. +47
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java
  6. +40
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  7. +90
    -11
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

+ 4
- 3
mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java ファイルの表示

@@ -5,6 +5,7 @@ import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCoupon;
import com.iformall.enums.*;
import com.iformall.service.WxCouponService;
import com.iformall.utils.DateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -131,7 +132,7 @@ public class WxCouponController extends BaseController {
wxCoupon.setStartdate(c.getTime());
}
if(wxCoupon.getEnddate() == null){
wxCoupon.setEnddate(new Date());
wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"));
}
result.put("list",wxCouponService.findCountData(wxCoupon,pageNum,pageSize));
return new ResultData(result);
@@ -152,7 +153,7 @@ public class WxCouponController extends BaseController {
wxCoupon.setStartdate(c.getTime());
}
if(wxCoupon.getEnddate() == null){
wxCoupon.setEnddate(new Date());
wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"));
}
return new ResultData(wxCouponService.findCouponData(wxCoupon,pageNum,pageSize));
}
@@ -172,7 +173,7 @@ public class WxCouponController extends BaseController {
wxCoupon.setStartdate(c.getTime());
}
if(wxCoupon.getEnddate() == null){
wxCoupon.setEnddate(new Date());
wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"));
}
return new ResultData(wxCouponService.findPressData(wxCoupon,pageNum,pageSize));
}


+ 37
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java ファイルの表示

@@ -182,9 +182,46 @@ public class WxCoupon implements Serializable {
@io.swagger.annotations.ApiModelProperty(value="退款数量",name="backpayCount")
@Transient
private Integer backpayCount;

/**砍价发起次数**/
@io.swagger.annotations.ApiModelProperty(value="砍价发起次数",name="pressSendCount")
@Transient
private Integer pressSendCount;
/**砍价成功次数**/
@io.swagger.annotations.ApiModelProperty(value="砍价成功次数",name="pressSuccCount")
@Transient
private Integer pressSuccCount;
/**砍价参与人数**/
@io.swagger.annotations.ApiModelProperty(value="砍价参与人数",name="pressJoinCount")
@Transient
private Integer pressJoinCount;
//营销分析-----end-----


public Integer getPressSendCount() {
return pressSendCount;
}

public void setPressSendCount(Integer pressSendCount) {
this.pressSendCount = pressSendCount;
}

public Integer getPressSuccCount() {
return pressSuccCount;
}

public void setPressSuccCount(Integer pressSuccCount) {
this.pressSuccCount = pressSuccCount;
}

public Integer getPressJoinCount() {
return pressJoinCount;
}

public void setPressJoinCount(Integer pressJoinCount) {
this.pressJoinCount = pressJoinCount;
}

public Long getXcount() {
return xcount;
}


+ 9
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java ファイルの表示

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import com.iformall.domain.po.WxCoupon;

public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
List<WxCoupon> findPressData(WxCoupon wxCoupon);
List<WxCoupon> findCouponData(WxCoupon wxCoupon);
List<WxCoupon> findCountData(WxCoupon wxCoupon);
List<WxCoupon> findList(WxCoupon wxCoupon);
@@ -58,4 +59,12 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
Long findSumPriceSaleMoney(WxCoupon wxCoupon);
Long findSumPricePayMent(WxCoupon wxCoupon);
Long findSumSubsidyMoney(WxCoupon wxCoupon);

//-------砍价--------
List<WxCoupon> pressSendHistory(WxCoupon wxCoupon);
List<WxCoupon> pressSuccHistory(WxCoupon wxCoupon);
List<WxCoupon> pressPaymentHistory(WxCoupon wxCoupon);
Double pressSuccRate(WxCoupon wxCoupon);
// Long sumSubsidy(WxCoupon wxCoupon);
Long sumJoin(WxCoupon wxCoupon);
}

+ 32
- 0
mallinkService/src/main/java/com/iformall/service/WxCouponService.java ファイルの表示

@@ -149,4 +149,36 @@ public interface WxCouponService {
Long findSumPriceSaleMoney(WxCoupon wxCoupon);
Long findSumPricePayMent(WxCoupon wxCoupon);
Long findSumSubsidyMoney(WxCoupon wxCoupon);


/**
* 砍价发起次数走势
* @return
*/
List<WxCoupon> pressSendHistory(WxCoupon wxCoupon);
/**
* 砍价成功次数走势
* @return
*/
List<WxCoupon> pressSuccHistory(WxCoupon wxCoupon);
/**
* 砍价核销数量走势
* @return
*/
List<WxCoupon> pressPaymentHistory(WxCoupon wxCoupon);
/**
* 砍价转化率
* @return
*/
Double pressSuccRate(WxCoupon wxCoupon);
/**
* 商场补贴金额
* @return
*/
// Long sumSubsidy(WxCoupon wxCoupon);
/**
* 砍价参与人数
* @return
*/
Long sumJoin(WxCoupon wxCoupon);
}

+ 47
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java ファイルの表示

@@ -1560,6 +1560,53 @@ public class WxChartServiceImpl implements WxChartDataService {
return new ResultData(result);
}

//砍价营销数据
if (chart.equals(EnumChart.SALE_PRESS.getCode())) {
WxCoupon wxCoupon = new WxCoupon();
Map<String,Object> result = new HashedMap();

//默认时间本月第一天,截止到当天
if(paramsMap.get("startdate") == null){
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH,1);
wxCoupon.setStartdate(c.getTime());
}else{
Date startTime = DateUtils.stringToDate(startdate);
wxCoupon.setStartdate(startTime);
}
if(paramsMap.get("enddate") == null){
wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"));
}else{
Date endTime = DateUtils.stringToDate(enddate);
wxCoupon.setEnddate(endTime);
}
List<WxCoupon> pressSendHistory = wxCouponService.pressSendHistory(wxCoupon);
List<WxCoupon> pressSuccHistory = wxCouponService.pressSuccHistory(wxCoupon);
List<WxCoupon> pressPaymentHistory = wxCouponService.pressPaymentHistory(wxCoupon);

Map<String,Long> pressSendHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());
Map<String,Long> pressSuccHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());
Map<String,Long> pressPaymentHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());

for (WxCoupon coupon:pressSendHistory){
pressSendHistoryMap.put(coupon.getXtime(),coupon.getXcount());
}
for (WxCoupon coupon:pressSuccHistory){
pressSuccHistoryMap.put(coupon.getXtime(),coupon.getXcount());
}
for (WxCoupon coupon:pressPaymentHistory){
pressPaymentHistoryMap.put(coupon.getXtime(),coupon.getXcount());
}
result.put("pressSendHistory",pressSendHistoryMap);
result.put("pressSuccHistory",pressSuccHistoryMap);
result.put("pressPaymentHistory",pressPaymentHistoryMap);

result.put("pressSuccRate",wxCouponService.pressSuccRate(wxCoupon));
result.put("sumJoin",wxCouponService.sumJoin(wxCoupon));
return new ResultData(result);
}

//拼团营销数据
if (chart.equals(EnumChart.SALE_GROUP.getCode())) {
Map<String, Object> params = new HashMap<>();


+ 40
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java ファイルの表示

@@ -336,17 +336,20 @@ public class WxCouponServiceImpl implements WxCouponService {

@Override
public Long findSaleCardCount(WxCoupon wxCoupon) {
return wxCouponMapper.findSaleCardCount(wxCoupon);
Long count = wxCouponMapper.findSaleCardCount(wxCoupon);
return (count==null)?0l:count;
}

@Override
public Long findTranCardCount(WxCoupon wxCoupon) {
return wxCouponMapper.findTranCardCount(wxCoupon);
Long count = wxCouponMapper.findTranCardCount(wxCoupon);
return (count==null)?0l:count;
}

@Override
public Long findSubsidyMoney(WxCoupon wxCoupon) {
return wxCouponMapper.findSubsidyMoney(wxCoupon);
Long count = wxCouponMapper.findSubsidyMoney(wxCoupon);
return (count==null)?0l:count;
}

@Override
@@ -377,22 +380,51 @@ public class WxCouponServiceImpl implements WxCouponService {

@Override
public Long findSumPriceSaleMoney(WxCoupon wxCoupon) {
return wxCouponMapper.findSumPriceSaleMoney(wxCoupon);
Long count = wxCouponMapper.findSumPriceSaleMoney(wxCoupon);
return (count==null)?0l:count;
}

@Override
public Long findSumPricePayMent(WxCoupon wxCoupon) {
return wxCouponMapper.findSumPricePayMent(wxCoupon);
Long count = wxCouponMapper.findSumPricePayMent(wxCoupon);
return (count==null)?0l:count;
}

@Override
public Long findSumSubsidyMoney(WxCoupon wxCoupon) {
return wxCouponMapper.findSumSubsidyMoney(wxCoupon);
Long count = wxCouponMapper.findSumSubsidyMoney(wxCoupon);
return (count==null)?0l:count;
}


@Override
public PageInfo<WxCoupon> findPressData(WxCoupon record, Integer pageNum, Integer pageSize) {
return null;
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findPressData(record));
}

@Override
public List<WxCoupon> pressSendHistory(WxCoupon wxCoupon) {
return wxCouponMapper.pressSendHistory(wxCoupon);
}

@Override
public List<WxCoupon> pressSuccHistory(WxCoupon wxCoupon) {
return wxCouponMapper.pressSuccHistory(wxCoupon);
}

@Override
public List<WxCoupon> pressPaymentHistory(WxCoupon wxCoupon) {
return wxCouponMapper.pressPaymentHistory(wxCoupon);
}

@Override
public Double pressSuccRate(WxCoupon wxCoupon) {
Double count = wxCouponMapper.pressSuccRate(wxCoupon);
return (count==null)?0l:count;
}

@Override
public Long sumJoin(WxCoupon wxCoupon) {
Long count = wxCouponMapper.sumJoin(wxCoupon);
return (count==null)?0l:count;
}
}

+ 90
- 11
mallinkService/src/main/resources/mapper/WxCouponMapper.xml ファイルの表示

@@ -37,6 +37,10 @@
<result column="transfer_count" property="transferCount"/>
<result column="sale_amount" property="saleAmount"/>
<result column="sum_payment" property="sumPayment"/>

<result column="press_count" property="pressSendCount"/>
<result column="press_succ_count" property="pressSuccCount"/>
<result column="join_count" property="pressJoinCount"/>
</resultMap>

<sql id="allColumns">
@@ -668,7 +672,8 @@
<select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(ci.sale_amount) xcount from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
where ci.create_date between #{startdate} and #{enddate}
where c.type = 100
and ci.create_date between #{startdate} and #{enddate}
group by xtime
</select>

@@ -676,7 +681,8 @@
select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(wcs.payment) xcount from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
left join wx_card_spend wcs on wcs.card_id = ci.id
where ci.create_date between #{startdate} and #{enddate}
where c.type = 100
and ci.create_date between #{startdate} and #{enddate}
group by xtime
</select>

@@ -685,19 +691,20 @@
from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
left join wx_coupon_order co on co.id = ci.id
where c.create_date between #{startdate} and #{enddate}
where c.type = 100
and c.create_date between #{startdate} and #{enddate}
</select>

<select id="findTranCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
select count(distinct wcs.coupon_order_id) from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id
where c.create_date between #{startdate} and #{enddate}
where c.type = 100 and c.create_date between #{startdate} and #{enddate}
</select>

<select id="findSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
select sum(subsidy_num) from wx_coupon c
where c.create_date between #{startdate} and #{enddate}
where c.type = 100 and c.create_date between #{startdate} and #{enddate}
<if test="id != null">
and c.id = #{id}
</if>
@@ -716,7 +723,8 @@
(select sum(wcs.payment) from wx_card_info ci
left join wx_coupon wc on wc.id = ci.coupon_id
left join wx_card_spend wcs on wcs.card_id = ci.id
where wc.id = c.id) as sum_payment
where c.type = 100
and wc.id = c.id) as sum_payment
from wx_coupon c where 1=1
<if test="id != null">
and c.id = #{id}
@@ -729,7 +737,7 @@
(select count(distinct wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count,
(select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 1 and wc.id = c.id) as payment_count,
(select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 3 and wc.id = c.id) as backpay_count
from wx_coupon c where 1=1
from wx_coupon c where c.type not in(8,9,100)
<if test=" 1 == type ">
and c.sale_price > 0
</if>
@@ -742,6 +750,26 @@
order by status asc,create_date desc
</select>

<select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.*,
(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) as press_count,
(select count(wo.id) 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 press_succ_count,
(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
from wx_coupon c where c.type = 8
<if test="id != null">
and c.id = #{id}
</if>
order by status asc,create_date desc
</select>

<!--
<select id="findCouponSendCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(c.create_time,'%Y-%m-%d') xtime,count(id) xcount from wx_coupon_action_log c
@@ -761,7 +789,7 @@
<select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c
left join wx_coupon_order wco on c.id = wco.coupon_id
where 1=1
where c.type not in(8,9,100)
and wco.create_date between #{startdate} and #{enddate}
group by xtime
</select>
@@ -770,21 +798,24 @@

<select id="findCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
where wco.coupon_id = c.id and wco.coupon_order_status = 1
where c.type not in(8,9,100)
and wco.coupon_id = c.id and wco.coupon_order_status = 1
and wco.create_date between #{startdate} and #{enddate}
group by xtime
</select>

<select id="priceCouponSaleCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
where wco.coupon_id = c.id and wco.coupon_price > 0
where c.type not in(8,9,100)
and wco.coupon_id = c.id and wco.coupon_price > 0
and wco.create_date between #{startdate} and #{enddate}
group by xtime
</select>

<select id="priceCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
where wco.coupon_id = c.id and wco.coupon_order_status = 1 and wco.coupon_price > 0
where c.type not in(8,9,100)
and wco.coupon_id = c.id and wco.coupon_order_status = 1 and wco.coupon_price > 0
and wco.create_date between #{startdate} and #{enddate}
group by xtime
</select>
@@ -806,4 +837,52 @@
where wco.coupon_id = c.id
and wco.create_date between #{startdate} and #{enddate}
</select>


<!--砍价-->
<select id="pressSendHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wop.create_date,'%Y-%m-%d') xtime,count(wop.id) xcount 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.type = 8 and wop.first = 1 and
wop.create_date between #{startdate} and #{enddate}
group by xtime
</select>
<select id="pressSuccHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wo.create_date,'%Y-%m-%d') xtime,count(wo.id) xcount from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
where wc.type = 8 and wo.order_status = 7
and wo.create_date between #{startdate} and #{enddate}
group by xtime
</select>
<select id="pressPaymentHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,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 wco.create_date between #{startdate} and #{enddate}
group by xtime
</select>
<select id="pressSuccRate" parameterType="com.iformall.domain.po.WxCoupon" resultType="java.lang.Double">
select
round(
(select count(wo.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
where wo.order_status = 7 and wc.type = 8
and wo.create_date between #{startdate} and #{enddate})
/
(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.type = 8
and wop.create_date between #{startdate} and #{enddate})
* 100
,2)
</select>
<select id="sumJoin" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
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.type = 8
and wop.create_date between #{startdate} and #{enddate}
</select>
</mapper>

読み込み中…
キャンセル
保存