Просмотр исходного кода

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

release_toaliyun_real
luozukai 7 лет назад
Родитель
Сommit
11a6cb2ed4
9 измененных файлов: 82 добавлений и 61 удалений
  1. +3
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/WxChartDataController.java
  2. +19
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java
  3. +0
    -2
      mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
  4. +11
    -2
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  5. +3
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCarPayRecordServiceImpl.java
  6. +24
    -37
      mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java
  7. +6
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  8. +4
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMsgRecordServiceImpl.java
  9. +12
    -9
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

+ 3
- 2
mallinkAdmin/src/main/java/com/iformall/controller/WxChartDataController.java Просмотреть файл

@@ -23,7 +23,6 @@ public class WxChartDataController extends BaseController {

private final Logger logger = LoggerFactory.getLogger(this.getClass());


@Autowired
private WxChartDataService wxChartDataService;

@@ -31,7 +30,9 @@ public class WxChartDataController extends BaseController {
@GetMapping("/queryData")
@ApiImplicitParams({
@ApiImplicitParam(name = "chart", value = "chart", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "querytime", value = "querytime", dataType = "String", paramType = "query", required = true)})
@ApiImplicitParam(name = "startdate", value = "startdate", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "enddate", value = "enddate", dataType = "String", paramType = "query")
})
public ResultData queryData(@RequestParam Map<String, String> params) {
logger.debug("[" + getIpAddr() + "] WxChartDataController::queryData");
params.put("tenantId",super.getTenantId());


+ 19
- 0
mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java Просмотреть файл

@@ -157,6 +157,25 @@ public class WxCouponController extends BaseController {
return new ResultData(wxCouponService.findCouponData(wxCoupon,pageNum,pageSize));
}

@ApiOperation("砍价营销列表接口")
@GetMapping("findPressCountList")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData findPressCountList(@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);
wxCoupon.setStartdate(c.getTime());
}
if(wxCoupon.getEnddate() == null){
wxCoupon.setEnddate(new Date());
}
return new ResultData(wxCouponService.findPressData(wxCoupon,pageNum,pageSize));
}





+ 0
- 2
mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java Просмотреть файл

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

import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;


+ 11
- 2
mallinkService/src/main/java/com/iformall/service/WxCouponService.java Просмотреть файл

@@ -43,6 +43,15 @@ public interface WxCouponService {
*/
PageInfo<WxCoupon> findCouponData(WxCoupon record,Integer pageNum, Integer pageSize);

/**
* 砍价列表,包括统计
* @param record
* @param pageNum
* @param pageSize
* @return
*/
PageInfo<WxCoupon> findPressData(WxCoupon record,Integer pageNum, Integer pageSize);

/**
* 根据Id获得实体
*
@@ -105,7 +114,7 @@ public interface WxCouponService {
* 卷发放数量
* @return
*/
List<WxCoupon> findCouponSendCount(WxCoupon wxCoupon);
//List<WxCoupon> findCouponSendCount(WxCoupon wxCoupon);

/**
* 卷购买数量
@@ -117,7 +126,7 @@ public interface WxCouponService {
* 卷领取数量
* @return
*/
List<WxCoupon> findCouponGetCount(WxCoupon wxCoupon);
//List<WxCoupon> findCouponGetCount(WxCoupon wxCoupon);

/**
* 卷核销数量


+ 3
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCarPayRecordServiceImpl.java Просмотреть файл

@@ -2,6 +2,7 @@ package com.iformall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxCarPayRecord;
import com.iformall.mapper.WxCarPayRecordMapper;
import com.iformall.service.WxCarPayRecordService;
@@ -25,6 +26,8 @@ public class WxCarPayRecordServiceImpl implements WxCarPayRecordService{
@Override
public void saveOrUpdate(WxCarPayRecord record) {
if (record.getId() == null) {
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
wxCarPayRecordMapper.insertSelective(record);
} else {
wxCarPayRecordMapper.updateByPrimaryKeySelective(record);


+ 24
- 37
mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java Просмотреть файл

@@ -67,18 +67,14 @@ public class WxChartServiceImpl implements WxChartDataService {
public ResultData queryData(Map<String, String> paramsMap) {
String tenantId = paramsMap.get("tenantId");
Integer chart = Integer.valueOf(paramsMap.get("chart"));
String querytime = paramsMap.get("querytime");
String startdate = DateUtils.getSystemTime("yyyy-MM-dd");
String enddate = startdate;
if (!StringUtils.isEmpty(querytime)) {
String[] split = querytime.split(",");
if (split.length == 2) {
startdate = split[0];
enddate = split[1];
} else {
startdate = split[0];
enddate = split[0];
}
String startdate = paramsMap.get("startdate") + " 00:00:00";
String enddate = paramsMap.get("enddate") + " 23:59:59";

if (StringUtils.isEmpty(startdate)) {
startdate = DateUtils.getSystemTime("yyyy-MM-dd") + " 00:00:00" ;
}
if(StringUtils.isBlank(enddate)){
enddate = DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59";
}

//出租率
@@ -1472,23 +1468,25 @@ public class WxChartServiceImpl implements WxChartDataService {
//卡营销数据
if (chart.equals(EnumChart.SALE_CARD.getCode())) {
WxCoupon wxCoupon = new WxCoupon();

//默认时间本月第一天,截止到当天
Map<String,Object> result = new HashedMap();
if(startdate == null){
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 + " 00:00:00");
Date startTime = DateUtils.stringToDate(startdate);
wxCoupon.setStartdate(startTime);
}
if(enddate == null){
wxCoupon.setEnddate(new Date());
if(paramsMap.get("enddate") == null){
wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"));
}else{
Date endTime = DateUtils.stringToDate(enddate + " 23:59:59");
Date endTime = DateUtils.stringToDate(enddate);
wxCoupon.setEnddate(endTime);
}

Map<String,Object> result = new HashedMap();
List<WxCoupon> saleMoneyList = wxCouponService.findSaleMoneyByDate(wxCoupon);
List<WxCoupon> paymentList = wxCouponService.findPaymentByDate(wxCoupon);
Map<String,Long> saleMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());
@@ -1508,49 +1506,40 @@ public class WxChartServiceImpl implements WxChartDataService {
return new ResultData(result);
}

//营销数据
//营销数据
if (chart.equals(EnumChart.SALE_COUPON.getCode())) {
WxCoupon wxCoupon = new WxCoupon();
//默认时间本月第一天,截止到当天
Map<String,Object> result = new HashedMap();
if(startdate == null){

//默认时间本月第一天,截止到当天
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 + " 00:00:00");
Date startTime = DateUtils.stringToDate(startdate);
wxCoupon.setStartdate(startTime);
}
if(enddate == null){
wxCoupon.setEnddate(new Date());
if(paramsMap.get("enddate") == null){
wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"));
}else{
Date endTime = DateUtils.stringToDate(enddate + " 23:59:59");
Date endTime = DateUtils.stringToDate(enddate);
wxCoupon.setEnddate(endTime);
}
List<WxCoupon> sendList = wxCouponService.findCouponSendCount(wxCoupon);
List<WxCoupon> orderCountList = wxCouponService.findCouponOrderCount(wxCoupon);
List<WxCoupon> getCountList = wxCouponService.findCouponGetCount(wxCoupon);
List<WxCoupon> paymentCountList = wxCouponService.findCouponPaymentCount(wxCoupon);
List<WxCoupon> priceCouponSaleCountList = wxCouponService.priceCouponSaleCount(wxCoupon);
List<WxCoupon> priceCouponPaymentCountList = wxCouponService.priceCouponPaymentCount(wxCoupon);

Map<String,Long> sendMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());
Map<String,Long> orderCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());
Map<String,Long> getCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());
Map<String,Long> paymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());
Map<String,Long> priceCouponSaleCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());
Map<String,Long> priceCouponPaymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate());

for (WxCoupon coupon:sendList){
sendMap.put(coupon.getXtime(),coupon.getXcount());
}
for (WxCoupon coupon:orderCountList){
orderCountMap.put(coupon.getXtime(),coupon.getXcount());
}
for (WxCoupon coupon:getCountList){
getCountMap.put(coupon.getXtime(),coupon.getXcount());
}
for (WxCoupon coupon:paymentCountList){
paymentCountMap.put(coupon.getXtime(),coupon.getXcount());
}
@@ -1560,9 +1549,7 @@ public class WxChartServiceImpl implements WxChartDataService {
for (WxCoupon coupon:priceCouponPaymentCountList){
priceCouponPaymentCountMap.put(coupon.getXtime(),coupon.getXcount());
}
result.put("sendList",sendMap);
result.put("orderCountList",orderCountMap);
result.put("getCountList",getCountMap);
result.put("paymentCountList",paymentCountMap);
result.put("priceCouponSaleCountList",priceCouponSaleCountMap);
result.put("priceCouponPaymentCountList",priceCouponPaymentCountMap);


+ 6
- 9
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -354,20 +354,11 @@ public class WxCouponServiceImpl implements WxCouponService {
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCouponData(record));
}

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

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

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

@Override
public List<WxCoupon> findCouponPaymentCount(WxCoupon wxCoupon) {
@@ -398,4 +389,10 @@ public class WxCouponServiceImpl implements WxCouponService {
public Long findSumSubsidyMoney(WxCoupon wxCoupon) {
return wxCouponMapper.findSumSubsidyMoney(wxCoupon);
}


@Override
public PageInfo<WxCoupon> findPressData(WxCoupon record, Integer pageNum, Integer pageSize) {
return null;
}
}

+ 4
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMsgRecordServiceImpl.java Просмотреть файл

@@ -1,5 +1,6 @@
package com.iformall.service.impl;

import com.iformall.common.IdWorker;
import com.iformall.domain.po.*;
import com.iformall.mapper.*;
import com.iformall.service.WxMsgRecordService;
@@ -20,14 +21,17 @@ public class WxMsgRecordServiceImpl implements WxMsgRecordService {

@Override
public void save(BaseMsg data) {
final IdWorker idWorker = IdWorker.get();
data.setUuid(UUID.randomUUID().toString());
if(data instanceof WxMsgRecord){
WxMsgRecord msgRecord = (WxMsgRecord)data;
msgRecord.setMsgJson(JsonUtil.obj2Json(data));
msgRecord.setId(idWorker.nextId());
wxMsgRecordMapper.save(msgRecord);
}else if(data instanceof WxMsg || data instanceof MailMsg){
WxMsgRecord msgRecord = new WxMsgRecord();
msgRecord.setMsgJson(JsonUtil.obj2Json(data));
msgRecord.setId(idWorker.nextId());
wxMsgRecordMapper.save(msgRecord);
}
}


+ 12
- 9
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -730,8 +730,11 @@
(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
<if test=" null != type ">
and c.type = #{type}
<if test=" 1 == type ">
and c.sale_price > 0
</if>
<if test=" 2 == type ">
and c.sale_price = 0
</if>
<if test="id != null">
and c.id = #{id}
@@ -739,32 +742,32 @@
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
where c.create_time between #{startdate} and #{enddate}
group by xtime
</select>

<select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
<select id="findCouponGetCount" 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
and wco.create_date between #{startdate} and #{enddate}
and wco.coupon_price > 0
and wco.coupon_price = 0
group by xtime
</select>
-->

<select id="findCouponGetCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
<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
and wco.create_date between #{startdate} and #{enddate}
and wco.coupon_price = 0
group by xtime
</select>



<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


Загрузка…
Отмена
Сохранить