| @@ -11,6 +11,36 @@ public class MarkingCouponDataReportVo { | |||
| //券核销人数 verifyUserCount | |||
| private String createTime; | |||
| public Long getCouponId() { | |||
| return couponId; | |||
| } | |||
| public void setCouponId(Long couponId) { | |||
| this.couponId = couponId; | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public void setTitle(String title) { | |||
| this.title = title; | |||
| } | |||
| public String getType() { | |||
| return type; | |||
| } | |||
| public void setType(String type) { | |||
| this.type = type; | |||
| } | |||
| private Long couponId; //券id | |||
| private String title; //券名称 | |||
| private String type; //券类型 | |||
| public String getCreateTime() { | |||
| return createTime; | |||
| } | |||
| @@ -3,16 +3,16 @@ package com.simple.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.dto.MarkingCouponDataReportDto; | |||
| import com.simple.domain.po.WxCoupon; | |||
| import com.simple.domain.po.WxUserVisit; | |||
| import com.simple.domain.vo.MarkingCouponDataReportVo; | |||
| import com.simple.domain.vo.MarkingSceneDataReportVo; | |||
| import com.simple.domain.vo.MarkingSceneDataVo; | |||
| import com.simple.domain.vo.TouchUsersReportVo; | |||
| import com.simple.mapper.WxCarCmdLogMapper; | |||
| import com.simple.mapper.WxCouponActionLogMapper; | |||
| import com.simple.mapper.WxCouponOrderMapper; | |||
| import com.simple.mapper.WxUserVisitMapper; | |||
| import com.simple.enums.EnumCouponType; | |||
| import com.simple.mapper.*; | |||
| import com.simple.service.MarkingDataReportService; | |||
| import com.simple.service.WxCouponService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -35,6 +35,8 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| private WxCarCmdLogMapper wxCarCmdLogMapper; | |||
| @Autowired | |||
| private WxUserVisitMapper wxUserVisitMapper; | |||
| @Autowired | |||
| private WxCouponMapper wxCouponMapper; | |||
| //取本月第一天 | |||
| private Date getFirstDayOfMonth() { | |||
| @@ -195,6 +197,23 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<MarkingCouponDataReportVo> couponDatalist = wxCouponOrderMapper.couponDataList(params); | |||
| if(couponDatalist.isEmpty()){ | |||
| return new PageInfo<>(couponDatalist); | |||
| } | |||
| List<Long> couponIds = couponDatalist.stream().map(p->p.getCouponId()).distinct().collect(Collectors.toList()); | |||
| WxCoupon wxCoupon = new WxCoupon(); | |||
| wxCoupon.setTenantId(tenantId); | |||
| wxCoupon.setIds(couponIds); | |||
| List<WxCoupon> wxCoupons = wxCouponMapper.findList(wxCoupon); | |||
| Map<Long,WxCoupon> map = wxCoupons.stream().collect(Collectors.toMap(WxCoupon::getId, p -> p)); | |||
| for (MarkingCouponDataReportVo temp:couponDatalist) { | |||
| if(map.get(temp.getCouponId())!=null){ | |||
| temp.setTitle(map.get(temp.getCouponId()).getTitle()); | |||
| String typeName = EnumCouponType.getEnum(map.get(temp.getCouponId()).getType()).getMessage(); | |||
| temp.setType(typeName); | |||
| } | |||
| } | |||
| return new PageInfo<>(couponDatalist); | |||
| } | |||
| @@ -383,11 +383,11 @@ | |||
| </select> | |||
| <select id="couponDataList" resultType="com.simple.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap"> | |||
| SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as createTime | |||
| SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as createTime,coupon_id as couponId | |||
| ,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount | |||
| ,(select Count(*) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} AND c.update_date >= #{startTime} and c.update_date <= #{endTime}) as verifyCount | |||
| ,(select Count(DISTINCT c_user_id) from wx_coupon_order d where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} AND d.update_date >= #{startTime} and d.update_date <= #{endTime}) as verifyUserCount | |||
| from wx_coupon_order where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY createTime | |||
| ,(select Count(*) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} and c.coupon_id=couponId AND c.update_date >= #{startTime} and c.update_date <= #{endTime}) as verifyCount | |||
| ,(select Count(DISTINCT c_user_id) from wx_coupon_order d where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} and d.coupon_id=couponId AND d.update_date >= #{startTime} and d.update_date <= #{endTime}) as verifyUserCount | |||
| from wx_coupon_order where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY createTime,couponId | |||
| </select> | |||
| <select id="touchUsersReportList" resultType="com.simple.domain.vo.TouchUsersReportVo" parameterType="hashmap"> | |||