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

[营销][修改]:营销统计数据日期不填引起的异常问题

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
43e341cc2b
5 измененных файлов: 116 добавлений и 37 удалений
  1. +32
    -17
      mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java
  2. +2
    -0
      mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml
  3. +13
    -3
      mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml
  4. +60
    -16
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml
  5. +9
    -1
      mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml

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

@@ -8,6 +8,7 @@ import com.iformall.domain.vo.MarkingCouponDataReportVo;
import com.iformall.domain.vo.MarkingSceneDataReportVo;
import com.iformall.domain.vo.MarkingSceneDataVo;
import com.iformall.domain.vo.TouchUsersReportVo;
import com.iformall.enums.EnumCarCmd;
import com.iformall.enums.EnumCouponSendSendType;
import com.iformall.enums.EnumCouponType;
import com.iformall.mapper.*;
@@ -194,8 +195,10 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
public PageInfo<MarkingCouponDataReportVo> getCouponDateList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) {
HashMap<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId);
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
if(markingCouponDataReportDto.getCouponType()!=null){
params.put("couponType", markingCouponDataReportDto.getCouponType());
}
@@ -226,8 +229,10 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
public PageInfo<MarkingSceneDataVo> getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) {
HashMap<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId);
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
//停车发券数 停车发券被核销数 核销发券数 核销发券被核销数
PageHelper.startPage(pageIndex, pageSize);
List<MarkingSceneDataReportVo> templist = wxCouponActionLogMapper.sceneDataList(params);
@@ -251,18 +256,22 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
//停车发券被核销数
HashMap<String, Object> params1 = new HashMap<>();
params1.put("tenantId", tenantId);
params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params1.put("channelType", 3);//停车
if (markingCouponDataReportDto.getStartTime() != null)
params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
if (markingCouponDataReportDto.getEndTime() != null)
params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params1.put("channelType", EnumCouponSendSendType.CAR_STOP.getCode());
List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params1);
countMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount()));
}else{
//核销发券被核销数
HashMap<String, Object> params2 = new HashMap<>();
params2.put("tenantId", tenantId);
params2.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params2.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params2.put("channelType", 4);//核销
if (markingCouponDataReportDto.getStartTime() != null)
params2.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
if (markingCouponDataReportDto.getEndTime() != null)
params2.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params2.put("channelType", EnumCouponSendSendType.COUPON_VERIFY.getCode());
List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params2);
countMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount()));
}
@@ -270,9 +279,11 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
//获取车辆进场数
HashMap<String, Object> params3 = new HashMap<>();
params3.put("tenantId", tenantId);
params3.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params3.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params3.put("cmdType", 601);//核销
if (markingCouponDataReportDto.getStartTime() != null)
params3.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
if (markingCouponDataReportDto.getEndTime() != null)
params3.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params3.put("cmdType", EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode());
List<MarkingSceneDataVo> markingSceneDataVos = wxCarCmdLogMapper.queryForSceneRepotyHistoryCar(params3);
Map<String,Integer> carCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getCarCount()));

@@ -297,16 +308,20 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
//核销量
HashMap<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId);
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
PageHelper.startPage(pageIndex, pageSize);
List<TouchUsersReportVo> couponDatalist = wxCouponOrderMapper.touchUsersReportList(params);

//查询UV PV
HashMap<String, Object> params1 = new HashMap<>();
params1.put("tenantId", tenantId);
params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
if (markingCouponDataReportDto.getStartTime() != null)
params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
if (markingCouponDataReportDto.getEndTime() != null)
params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params1);
Map<String,TouchUsersReportVo> visitMap = wxUserVisitList.stream().collect(Collectors.toMap(TouchUsersReportVo::getxTime, p -> p));
for (TouchUsersReportVo temp:couponDatalist) {


+ 2
- 0
mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml Просмотреть файл

@@ -88,7 +88,9 @@
<select id="queryForSceneRepotyHistoryCar" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
select DATE_FORMAT(create_date,'%Y-%m-%d') xTime, count(c.id) carCount
from wx_car_cmd_log c where tenant_id = #{tenantId} and cmd_type=#{cmdType}
<if test=" null != startTime and null != endTime">
and create_date BETWEEN #{startTime} and #{endTime}
</if>
group by xTime
</select>


+ 13
- 3
mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml Просмотреть файл

@@ -92,7 +92,9 @@
from wx_coupon_action_log
where tenant_id=#{tenantId}
and createtime &gt;= #{startTime}
and createtime &lt;= #{endTime} group by xTime
and createtime &lt;= #{endTime}
group by xTime
order by xTime desc
</select>

<select id="sceneDataMapJoinCouponOrder" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
@@ -102,7 +104,9 @@
and wx_coupon_order.coupon_order_status = 1
and wx_coupon_action_log.createtime &gt;= #{startTime}
and wx_coupon_action_log.createtime &lt;= #{endTime}
and wx_coupon_action_log.channel_type = #{channelType} group by xTime
and wx_coupon_action_log.channel_type = #{channelType}
group by xTime
order by xTime desc
</select>

<select id="sceneDataList" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
@@ -122,9 +126,15 @@
select DATE_FORMAT(create_date,'%Y-%m-%d') AS xTime,COUNT(wx_coupon_order.id) as tempCount from wx_coupon_action_log left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id
where wx_coupon_action_log.tenant_id=#{tenantId}
and wx_coupon_order.coupon_order_status = 1
<if test=" null != startTime ">
and wx_coupon_action_log.createtime &gt;= #{startTime}
</if>
<if test=" null != endTime ">
and wx_coupon_action_log.createtime &lt;= #{endTime}
and wx_coupon_action_log.channel_type = #{channelType} group by xTime
</if>
and wx_coupon_action_log.channel_type = #{channelType}
group by xTime
order by xTime desc
</select>




+ 60
- 16
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Просмотреть файл

@@ -389,40 +389,84 @@
<select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap">
SELECT DATE_FORMAT(wx_coupon_order.create_date,'%Y-%m-%d') as createTime,wx_coupon_order.coupon_id as couponId
,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount
,(select Count(coupon_id) 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 &gt;= #{startTime} and c.update_date &lt;= #{endTime}) as verifyCount
,(select Count(DISTINCT c_user_id) from wx_coupon_order d where coupon_order_status=1 AND d.coupon_id=couponId AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} and d.coupon_id=couponId AND d.update_date &gt;= #{startTime} and d.update_date &lt;= #{endTime}) as verifyUserCount
from wx_coupon_order join wx_coupon on wx_coupon_order.coupon_id=wx_coupon.id where wx_coupon_order.tenant_id=#{tenantId} AND wx_coupon_order.create_date &gt;= #{startTime} and wx_coupon_order.create_date &lt;= #{endTime}

<if test="couponType != null">
AND wx_coupon.type = #{couponType}
</if>

GROUP BY createTime,couponId
,(select Count(coupon_id) 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
<if test="startTime != null">
and c.update_date &gt;= #{startTime}
</if>
<if test="endTime != null">
and c.update_date &lt;= #{endTime}
</if>
) as verifyCount
,(select Count(DISTINCT c_user_id) from wx_coupon_order d
where coupon_order_status=1
and d.coupon_id=couponId
and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime
and tenant_id=#{tenantId}
and d.coupon_id=couponId
<if test="startTime != null">
and d.update_date &gt;= #{startTime}
</if>
<if test="endTime != null">
and d.update_date &lt;= #{endTime}
</if>
) as verifyUserCount
from wx_coupon_order
join wx_coupon on wx_coupon_order.coupon_id=wx_coupon.id
where wx_coupon_order.tenant_id=#{tenantId}
<if test="startTime != null">
and wx_coupon_order.create_date &gt;= #{startTime}
</if>
<if test="endTime != null">
and wx_coupon_order.create_date &lt;= #{endTime}
</if>
<if test="couponType != null">
and wx_coupon.type = #{couponType}
</if>
GROUP BY createTime,couponId
order by createTime desc
</select>

<select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap">
SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime
,COUNT(DISTINCT c_user_id) as userCount,count(*) as couponCount
,(select Count(*) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=xTime and tenant_id=#{tenantId}
,(select Count(*) from wx_coupon_order c
where coupon_order_status=1
and DATE_FORMAT(create_date,'%Y-%m-%d')=xTime
and tenant_id=#{tenantId}
<if test="startTime != null">
AND c.update_date &gt;= #{startTime}
and c.update_date &gt;= #{startTime}
</if>
<if test="endTime != null">
and c.update_date &lt;= #{endTime}
</if>
) 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')=xTime and tenant_id=#{tenantId} AND d.update_date &gt;= #{startTime} and d.update_date &lt;= #{endTime}) as verifyUserCount
from wx_coupon_order where tenant_id=#{tenantId}
)
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')=xTime
and tenant_id=#{tenantId}
<if test="startTime != null">
and d.update_date &gt;= #{startTime}
</if>
<if test="endTime != null">
and d.update_date &lt;= #{endTime}
</if>
)
as verifyUserCount
from wx_coupon_order
where tenant_id=#{tenantId}
<if test="startTime != null">
AND create_date &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_date &lt;= #{endTime}
</if>


GROUP BY xTime
order by xTime desc
</select>

<select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" >


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

@@ -103,7 +103,15 @@

<select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap">
SELECT DATE_FORMAT(day_date,'%Y-%m-%d') as xTime,visit_pv as pv,visit_uv as uv
from wx_user_visit where tenant_id=#{tenantId} AND day_date &gt;= #{startTime} and day_date &lt;= #{endTime} order by day_date desc
from wx_user_visit
where tenant_id=#{tenantId}
<if test="startTime != null">
and day_date &gt;= #{startTime}
</if>
<if test="endTime != null">
and day_date &lt;= #{endTime}
</if>
order by day_date desc
</select>
</mapper>

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