Ver a proveniência

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

release_toaliyun_real
luozukai há 7 anos
ascendente
cometimento
cca54c1d18
13 ficheiros alterados com 256 adições e 30 eliminações
  1. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/WxCardPayController.java
  2. +61
    -3
      mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java
  3. +10
    -4
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java
  4. +68
    -3
      mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
  5. +0
    -2
      mallinkService/src/main/java/com/iformall/mapper/WxCardInfoMapper.java
  6. +15
    -2
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  7. +3
    -1
      mallinkService/src/main/java/com/iformall/service/WxCardInfoService.java
  8. +30
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  9. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java
  10. +2
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java
  11. +19
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  12. +1
    -5
      mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml
  13. +45
    -0
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

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

@@ -51,7 +51,7 @@ public class WxCardPayController extends BaseController {
@Autowired
WxCardSpendService wxCardSpendService;

@ApiOperation("售卡记录列表接口")
@ApiOperation("售卡记录列表分页接口")
@GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),


+ 61
- 3
mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java Ver ficheiro

@@ -16,15 +16,16 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

@RestController
@@ -119,4 +120,61 @@ public class WxCouponController extends BaseController {
logger.debug("[" + getIpAddr() + "] WxCouponController::findById");;
return new ResultData(wxCouponService.getVoById(id));
}

@ApiOperation("卡类列表接口")
@GetMapping("findList")
public ResultData findList(@ModelAttribute WxCoupon wxCoupon) {
return new ResultData(wxCouponService.list(wxCoupon));
}

@ApiOperation("卡类列表统计接口")
@GetMapping("findCountData")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData findCountData(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) {
Map<String,Object> result = new HashedMap();
if(wxCoupon.getStartdate() == null){
//获取当前月第一天
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
wxCoupon.setStartdate(c.getTime());
}
if(wxCoupon.getEnddate() == null){
wxCoupon.setEnddate(new Date());
}
List<WxCoupon> saleMoneyList = wxCouponService.findSaleMoneyByDate(wxCoupon);
List<WxCoupon> paymentList = wxCouponService.findPaymentByDate(wxCoupon);
Map<String,Integer> saleMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());
Map<String,Integer> payMentMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());

for (WxCoupon coupon:saleMoneyList){
saleMap.put(coupon.getxTime(),coupon.getSaleAmount());
}
for (WxCoupon coupon:paymentList){
payMentMap.put(coupon.getxTime(),coupon.getSumPayment());
}
result.put("list",wxCouponService.findCountData(wxCoupon,pageNum,pageSize));
result.put("saleHistory",saleMap);
result.put("paymentHistory",payMentMap);
return new ResultData(result);
}

public static Map<String,Integer> getDateMap(Date begin, Date end) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Map<String,Integer> map = new LinkedHashMap<>();
map.put(format.format(begin),0);
Calendar calBegin = Calendar.getInstance();
calBegin.setTime(begin);
Calendar calEnd = Calendar.getInstance();
calEnd.setTime(end);
while (calBegin.getTime().before(end)) {
calBegin.add(Calendar.DAY_OF_MONTH, 1);
map.put(format.format(calBegin.getTime()),0);
}
return map;
}


}

+ 10
- 4
mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java Ver ficheiro

@@ -2,25 +2,30 @@ package com.iformall.controller;

import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.vo.MarkingSceneDataReportVo;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.enums.EnumCouponChannelActivityStatus;
import com.iformall.enums.EnumCouponChannelType;
import com.iformall.service.WxCouponChannelService;
import com.iformall.service.WxCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/api/wxCoupon")
@@ -30,6 +35,8 @@ public class WxCouponController extends BaseController {

@Autowired
private WxCouponChannelService wxCouponChannelService;
@Autowired
private WxCouponService wxCouponService;


@ApiOperation("根据id(couponChannel)查询接口")
@@ -66,6 +73,5 @@ public class WxCouponController extends BaseController {
}

return new ResultData(wxCouponCVo);

}
}

+ 68
- 3
mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java Ver ficheiro

@@ -1,5 +1,7 @@
package com.iformall.domain.po;

import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -14,7 +16,7 @@ public class WxCoupon implements Serializable {

@Id
protected Long id;
@Transient
protected List<Long> ids;
@Transient
@@ -57,14 +59,15 @@ public class WxCoupon implements Serializable {
private String subsidyNumStr;

@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date startdate;

@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date enddate;


@Transient
private String merchantParams;
private String xTime;

/**租户ID**/
@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
@@ -158,6 +161,60 @@ public class WxCoupon implements Serializable {
@io.swagger.annotations.ApiModelProperty(value="砍价限制时间",name="pressLimitHours")
private Integer pressLimitHours;



/**售出卡数量**/
@io.swagger.annotations.ApiModelProperty(value="售出卡数量",name="saleCount")
private Long saleCount;
/**转增数量**/
@io.swagger.annotations.ApiModelProperty(value="转增数量",name="transferCount")
private Long transferCount;
/**售出金额**/
@io.swagger.annotations.ApiModelProperty(value="售出金额",name="saleAmount")
private Integer saleAmount;
/**核销金额**/
@io.swagger.annotations.ApiModelProperty(value="核销金额",name="sumPayment")
private Integer sumPayment;

@Transient
private String merchantParams;

public Long getSaleCount() {
return saleCount;
}

public void setSaleCount(Long saleCount) {
this.saleCount = saleCount;
}

public Long getTransferCount() {
return transferCount;
}

public void setTransferCount(Long transferCount) {
this.transferCount = transferCount;
}

public Integer getSaleAmount() {
return saleAmount;
}

public void setSaleAmount(Integer saleAmount) {
this.saleAmount = saleAmount;
}

public Integer getSumPayment() {
return sumPayment;
}

public void setSumPayment(Integer sumPayment) {
this.sumPayment = sumPayment;
}

public static long getSerialVersionUID() {
return serialVersionUID;
}

public String getTenantId() {
return tenantId;
}
@@ -504,4 +561,12 @@ public class WxCoupon implements Serializable {
this.setSortColumns(Field.valueOf(sortColumns));
}
}

public String getxTime() {
return xTime;
}

public void setxTime(String xTime) {
this.xTime = xTime;
}
}

+ 0
- 2
mallinkService/src/main/java/com/iformall/mapper/WxCardInfoMapper.java Ver ficheiro

@@ -7,8 +7,6 @@ import com.iformall.domain.vo.WxCardVo;

public interface WxCardInfoMapper extends CommonMapper<WxCardInfo, Long> {

List<WxCardInfo> findList(WxCardInfo wxCardInfo);

List<WxCardVo> findVoList(WxCardVo wxCardVo);


+ 15
- 2
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java Ver ficheiro

@@ -2,13 +2,12 @@ package com.iformall.mapper;

import java.util.*;
import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.vo.WxCouponCVo;
import org.apache.ibatis.annotations.Param;
import com.iformall.domain.po.WxCoupon;

public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
List<WxCoupon> findCountData(WxCoupon wxCoupon);
List<WxCoupon> findList(WxCoupon wxCoupon);
List<WxCoupon> findCardList(WxCoupon wxCoupon);
List<WxCoupon> findCouponList(WxCoupon wxCoupon);
@@ -21,4 +20,18 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
void offExpiriedCouponByValidDate();

void offExpiriedCouponByMerchantStatus();

/**
* 查询时间段内销售金额
* @param wxCoupon
* @return
*/
List<WxCoupon> findSaleMoneyByDate(WxCoupon wxCoupon);

/**
* 查询时间段内核销金额
* @param wxCoupon
* @return
*/
List<WxCoupon> findPaymentByDate(WxCoupon wxCoupon);
}

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

@@ -4,6 +4,8 @@ import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxCardInfo;
import com.iformall.domain.vo.WxCardVo;

import java.util.List;

public interface WxCardInfoService {

/**
@@ -15,7 +17,7 @@ public interface WxCardInfoService {
* @return
*/
PageInfo<WxCardVo> listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize);
/**
* 根据Id获得实体
*


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

@@ -21,7 +21,22 @@ public interface WxCouponService {
* @return
*/
PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize, Integer type);

/**
* 列表
* @param record
* @return
*/
List<WxCoupon> list(WxCoupon record);


/**
* 卡类列表,包括统计
* @param record
* @return
*/
PageInfo<WxCoupon> findCountData(WxCoupon record,Integer pageNum, Integer pageSize);

/**
* 根据Id获得实体
*
@@ -47,4 +62,18 @@ public interface WxCouponService {
void deleteById(Long id);


/**
* 查询时间段内销售金额
* @param wxCoupon
* @return
*/
List<WxCoupon> findSaleMoneyByDate(WxCoupon wxCoupon);

/**
* 查询时间段内核销金额
* @param wxCoupon
* @return
*/
List<WxCoupon> findPaymentByDate(WxCoupon wxCoupon);

}

+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java Ver ficheiro

@@ -363,6 +363,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
params.put("cmdType", EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode());
List<MarkingSceneDataVo> markingSceneDataVos = wxCarCmdLogMapper.queryForSceneRepotyHistoryCar(params);

triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getTriggerCount()));
} else if(markingCouponDataReportDto.getType().equals(EnumCouponSendSendType.B_MICROPAY.getCode())){ // B端刷卡支付发券
//获取B端刷卡数


+ 2
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java Ver ficheiro

@@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iformall.common.IdWorker;

import java.util.List;

@Service
public class WxCardInfoServiceImpl implements WxCardInfoService {
@@ -43,12 +45,4 @@ public class WxCardInfoServiceImpl implements WxCardInfoService {
public void deleteById(Long id) {
wxCardInfoMapper.deleteByPrimaryKey(id);
}
}

+ 19
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Ver ficheiro

@@ -125,6 +125,16 @@ public class WxCouponServiceImpl implements WxCouponService {
}
}

@Override
public List<WxCoupon> list(WxCoupon record) {
return wxCouponMapper.findList(record);
}

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

@Override
public WxCoupon getById(Long id) {
return wxCouponMapper.selectByPrimaryKey(id);
@@ -315,4 +325,13 @@ public class WxCouponServiceImpl implements WxCouponService {
wxCouponMapper.deleteByPrimaryKey(id);
}

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

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

+ 1
- 5
mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml Ver ficheiro

@@ -69,7 +69,7 @@
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>
@@ -195,8 +195,4 @@
</select>
</mapper>

+ 45
- 0
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Ver ficheiro

@@ -33,6 +33,10 @@
<result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/>
<result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/>

<result column="sale_count" property="saleCount"/>
<result column="transfer_count" property="transferCount"/>
<result column="sale_amount" property="saleAmount"/>
<result column="sum_payment" property="sumPayment"/>
</resultMap>

<sql id="allColumns">
@@ -182,6 +186,27 @@
<include refid="dynamicWhereConditions"/>
</select>

<select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select <include refid="allColumns"/>,
(select count(distinct wco.owner_id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count,
(select count(distinct wcs.coupon_order_id) from wx_card_info ci
left join wx_coupon wc on wc.id = ci.coupon_id
left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id
where wc.id = c.id) as transfer_count,
(select sum(ci.sale_amount) from wx_card_info ci
left join wx_coupon wc on wc.id = ci.coupon_id
where wc.id = c.id) as sale_amount,
(select sum(wcs.real_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
from wx_coupon c where 1=1
<if test=" null != title ">
and `title` like concat('%', #{title},'%')
</if>
order by status asc,create_date desc
</select>

<sql id="dynamicWhereConditionsForCard">
where `type` = 100

@@ -653,4 +678,24 @@
and m.status = 1) = 0
</update>

<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) sale_amount from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
where ci.create_date between #{startdate} and #{enddate}
<if test="title != null">
and c.title like concat('%', #{title},'%')
</if>
group by xTime
</select>

<select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xTime,sum(wcs.real_payment) sum_payment 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}
<if test="title != null">
and c.title like concat('%', #{title},'%')
</if>
group by xTime
</select>
</mapper>

Carregando…
Cancelar
Guardar