Browse Source

[A端][修复]:修复数据塔台场景营销数据显示的问题,和一些逻辑问题

release_toaliyun_real
hupeng 7 years ago
parent
commit
b9ea38908d
2 changed files with 35 additions and 52 deletions
  1. +28
    -51
      mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java
  2. +7
    -1
      mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml

+ 28
- 51
mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java View File

@@ -45,17 +45,6 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
@Autowired @Autowired
private WxOrderMapper wxOrderMapper; private WxOrderMapper wxOrderMapper;


//取本月第一天
private Date getFirstDayOfMonth() {
Calendar c = Calendar.getInstance();
c.set(Calendar.DAY_OF_MONTH, 0);//设置为1号,当前日期既为本月第一天
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
Date thisMonth = c.getTime();
return thisMonth;
}


private Date addDay(int addDayAmount) { private Date addDay(int addDayAmount) {
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
@@ -68,20 +57,6 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
return date; return date;
} }


/**
* @param date 转换当前时间去掉时分秒
* @return
*/
private Date convertDate(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
Date result = c.getTime();
return result;
}


private Date convertDateAndAdd(Date date, int addDayAmount) { private Date convertDateAndAdd(Date date, int addDayAmount) {
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
@@ -122,7 +97,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
//couponData //couponData
HashMap<String, Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
params.put("startTime", getFirstDayOfMonth());
params.put("startTime", addDay(-30));
params.put("endTime", addDay(1)); params.put("endTime", addDay(1));
List<MarkingCouponDataReportVo> couponDatalist = wxCouponOrderMapper.couponDataMap(params); List<MarkingCouponDataReportVo> couponDatalist = wxCouponOrderMapper.couponDataMap(params);
//查询券领取人数 //查询券领取人数
@@ -182,7 +157,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {


HashMap<String, Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
params.put("startTime", getFirstDayOfMonth());
params.put("startTime", addDay(-30));
params.put("endTime", addDay(1)); params.put("endTime", addDay(1));
//停车发券数 停车发券被核销数 核销发券数 核销发券被核销数 //停车发券数 停车发券被核销数 核销发券数 核销发券被核销数
List<MarkingSceneDataReportVo> list = wxCouponActionLogMapper.sceneDataMap(params); List<MarkingSceneDataReportVo> list = wxCouponActionLogMapper.sceneDataMap(params);
@@ -190,28 +165,30 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
//停车发券被核销数 //停车发券被核销数
HashMap<String, Object> params1 = new HashMap<>(); HashMap<String, Object> params1 = new HashMap<>();
params1.put("tenantId", tenantId); params1.put("tenantId", tenantId);
params1.put("startTime", getFirstDayOfMonth());
params1.put("startTime", addDay(-30));
params1.put("endTime", addDay(1)); params1.put("endTime", addDay(1));
params1.put("channelType", EnumCouponSendSendType.CAR_STOP.getCode());//停车 params1.put("channelType", EnumCouponSendSendType.CAR_STOP.getCode());//停车
List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params1); List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params1);
Map<String, Integer> parkCountMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount())); Map<String, Integer> parkCountMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount()));

//核销发券被核销数 //核销发券被核销数
HashMap<String, Object> params2 = new HashMap<>(); HashMap<String, Object> params2 = new HashMap<>();
params2.put("tenantId", tenantId); params2.put("tenantId", tenantId);
params2.put("startTime", getFirstDayOfMonth());
params2.put("startTime", addDay(-30));
params2.put("endTime", addDay(1)); params2.put("endTime", addDay(1));
params2.put("channelType", EnumCouponSendSendType.COUPON_VERIFY.getCode());//核销 params2.put("channelType", EnumCouponSendSendType.COUPON_VERIFY.getCode());//核销
List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params2); List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params2);
Map<String, Integer> verifyCountMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount())); Map<String, Integer> verifyCountMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount()));

// B端刷卡支付被核销数 // B端刷卡支付被核销数
// TODO // TODO
HashMap<String, Object> params3 = new HashMap<>(); HashMap<String, Object> params3 = new HashMap<>();
params3.put("tenantId", tenantId); params3.put("tenantId", tenantId);
params3.put("startTime", getFirstDayOfMonth());
params3.put("startTime", addDay(-30));
params3.put("endTime", addDay(1)); params3.put("endTime", addDay(1));
params3.put("channelType", EnumCouponSendSendType.B_MICROPAY.getCode());//B端刷卡支付 params3.put("channelType", EnumCouponSendSendType.B_MICROPAY.getCode());//B端刷卡支付
List<MarkingSceneDataReportVo> list3 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params3); List<MarkingSceneDataReportVo> list3 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params3);
Map<String, Integer> microPayCountMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount()));
Map<String, Integer> microPayCountMap = list3.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount()));


for (MarkingSceneDataReportVo vo : list) { for (MarkingSceneDataReportVo vo : list) {
vo.setParkCount(parkCountMap.get(vo.getXTime()) == null ? 0 : parkCountMap.get(vo.getXTime())); vo.setParkCount(parkCountMap.get(vo.getXTime()) == null ? 0 : parkCountMap.get(vo.getXTime()));
@@ -261,9 +238,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
HashMap<String, Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
if (markingCouponDataReportDto.getStartTime() != null) if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(), 0));
if (markingCouponDataReportDto.getEndTime() != null) if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
if(markingCouponDataReportDto.getCouponType()!=null){ if(markingCouponDataReportDto.getCouponType()!=null){
params.put("couponType", markingCouponDataReportDto.getCouponType()); params.put("couponType", markingCouponDataReportDto.getCouponType());
} }
@@ -298,9 +275,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
HashMap<String, Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
if (markingCouponDataReportDto.getStartTime() != null) if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null) if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
//停车发券数 停车发券被核销数, 核销发券数 核销发券被核销数, B端刷卡支付发券数 刷卡支付发券被核销数 //停车发券数 停车发券被核销数, 核销发券数 核销发券被核销数, B端刷卡支付发券数 刷卡支付发券被核销数
PageHelper.startPage(pageIndex, pageSize); PageHelper.startPage(pageIndex, pageSize);
List<MarkingSceneDataReportVo> templist = wxCouponActionLogMapper.sceneDataList(params); List<MarkingSceneDataReportVo> templist = wxCouponActionLogMapper.sceneDataList(params);
@@ -329,9 +306,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
params.clear(); params.clear();
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
if (markingCouponDataReportDto.getStartTime() != null) if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null) if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
params.put("channelType", EnumCouponSendSendType.CAR_STOP.getCode()); params.put("channelType", EnumCouponSendSendType.CAR_STOP.getCode());
List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params); List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params);
countMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount())); countMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount()));
@@ -340,9 +317,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
params.clear(); params.clear();
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
if (markingCouponDataReportDto.getStartTime() != null) if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null) if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
params.put("channelType", EnumCouponSendSendType.B_MICROPAY.getCode()); params.put("channelType", EnumCouponSendSendType.B_MICROPAY.getCode());
List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params); List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params);
countMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount())); countMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount()));
@@ -351,9 +328,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
params.clear(); params.clear();
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
if (markingCouponDataReportDto.getStartTime() != null) if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null) if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
params.put("channelType", EnumCouponSendSendType.COUPON_VERIFY.getCode()); params.put("channelType", EnumCouponSendSendType.COUPON_VERIFY.getCode());
List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params); List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params);
countMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount())); countMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount()));
@@ -366,9 +343,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
params.clear(); params.clear();
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
if (markingCouponDataReportDto.getStartTime() != null) if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null) if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
params.put("cmdType", EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); params.put("cmdType", EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode());
List<MarkingSceneDataVo> markingSceneDataVos = wxCarCmdLogMapper.queryForSceneRepotyHistoryCar(params); List<MarkingSceneDataVo> markingSceneDataVos = wxCarCmdLogMapper.queryForSceneRepotyHistoryCar(params);
triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getTriggerCount())); triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getTriggerCount()));
@@ -377,9 +354,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
params.clear(); params.clear();
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
if (markingCouponDataReportDto.getStartTime() != null) if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null) if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
params.put("type", EnumOrderType.MICROPAY.getCode()); params.put("type", EnumOrderType.MICROPAY.getCode());
List<MarkingSceneDataVo> markingSceneDataVos = wxOrderMapper.queryForSceneRepotyHistory(params); List<MarkingSceneDataVo> markingSceneDataVos = wxOrderMapper.queryForSceneRepotyHistory(params);
triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getTriggerCount())); triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getTriggerCount()));
@@ -388,9 +365,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
params.clear(); params.clear();
params.put("tenantId", tenantId); params.put("tenantId", tenantId);
if (markingCouponDataReportDto.getStartTime() != null) if (markingCouponDataReportDto.getStartTime() != null)
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null) if (markingCouponDataReportDto.getEndTime() != null)
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
List<MarkingSceneDataVo> markingSceneDataVos = wxCouponOrderMapper.queryForSceneRepotyHistoryVerified(params); List<MarkingSceneDataVo> markingSceneDataVos = wxCouponOrderMapper.queryForSceneRepotyHistoryVerified(params);
triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getTriggerCount())); triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getTriggerCount()));
} }
@@ -415,9 +392,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
HashMap<String, Object> params1 = new HashMap<>(); HashMap<String, Object> params1 = new HashMap<>();
params1.put("tenantId", tenantId); params1.put("tenantId", tenantId);
if (markingCouponDataReportDto.getStartTime() != null) if (markingCouponDataReportDto.getStartTime() != null)
params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params1.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null) if (markingCouponDataReportDto.getEndTime() != null)
params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params1.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
PageHelper.startPage(pageIndex, pageSize); PageHelper.startPage(pageIndex, pageSize);
List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params1); List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params1);


@@ -429,9 +406,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService {
HashMap<String, Object> params2 = new HashMap<>(); HashMap<String, Object> params2 = new HashMap<>();
params2.put("tenantId", tenantId); params2.put("tenantId", tenantId);
if (markingCouponDataReportDto.getStartTime() != null) if (markingCouponDataReportDto.getStartTime() != null)
params2.put("startTime", convertDate(markingCouponDataReportDto.getStartTime()));
params2.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0));
if (markingCouponDataReportDto.getEndTime() != null) if (markingCouponDataReportDto.getEndTime() != null)
params2.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1));
params2.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1));
List<TouchUsersReportVo> couponDatalist = wxCouponOrderMapper.touchUsersReportList(params2); List<TouchUsersReportVo> couponDatalist = wxCouponOrderMapper.touchUsersReportList(params2);


Map<String,TouchUsersReportVo> visitMap = couponDatalist.stream().collect(Collectors.toMap(TouchUsersReportVo::getxTime, p -> p)); Map<String,TouchUsersReportVo> visitMap = couponDatalist.stream().collect(Collectors.toMap(TouchUsersReportVo::getxTime, p -> p));


+ 7
- 1
mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml View File

@@ -75,6 +75,8 @@
<select id="findCountByDateLimit" resultType="java.lang.Integer"> <select id="findCountByDateLimit" resultType="java.lang.Integer">
select COUNT(*) FROM wx_coupon_action_log select COUNT(*) FROM wx_coupon_action_log
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and `channel_type` != 0
and `channel_type` != 1
and `create_time` &gt;= #{startTime} and `create_time` &gt;= #{startTime}
and `create_time` &lt;= #{endTime} and `create_time` &lt;= #{endTime}
</select> </select>
@@ -88,7 +90,11 @@
(select Count(*) from wx_coupon_action_log c (select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(create_time,'%m/%d')=xTime where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=3 and c.channel_type=3
and tenant_id=#{tenantId}) as verifySendCount
and tenant_id=#{tenantId}) as verifySendCount,
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=4
and tenant_id=#{tenantId}) as microPaySendCount
from wx_coupon_action_log from wx_coupon_action_log
where tenant_id=#{tenantId} where tenant_id=#{tenantId}
and create_time &gt;= #{startTime} and create_time &gt;= #{startTime}


Loading…
Cancel
Save