|
|
|
@@ -249,52 +249,66 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { |
|
|
|
list.add(vo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Integer> countMap = new HashMap<>(); |
|
|
|
|
|
|
|
if(markingCouponDataReportDto.getType()==1){ //停车 |
|
|
|
//停车发券被核销数 |
|
|
|
HashMap<String, Object> params1 = new HashMap<>(); |
|
|
|
params1.put("tenantId", tenantId); |
|
|
|
params.clear(); |
|
|
|
params.put("tenantId", tenantId); |
|
|
|
if (markingCouponDataReportDto.getStartTime() != null) |
|
|
|
params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); |
|
|
|
params.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); |
|
|
|
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); |
|
|
|
params.put("channelType", EnumCouponSendSendType.CAR_STOP.getCode()); |
|
|
|
List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params); |
|
|
|
countMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); |
|
|
|
}else{ |
|
|
|
//核销发券被核销数 |
|
|
|
HashMap<String, Object> params2 = new HashMap<>(); |
|
|
|
params2.put("tenantId", tenantId); |
|
|
|
params.clear(); |
|
|
|
params.put("tenantId", tenantId); |
|
|
|
if (markingCouponDataReportDto.getStartTime() != null) |
|
|
|
params2.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); |
|
|
|
params.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); |
|
|
|
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); |
|
|
|
params.put("channelType", EnumCouponSendSendType.COUPON_VERIFY.getCode()); |
|
|
|
List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params); |
|
|
|
countMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); |
|
|
|
} |
|
|
|
|
|
|
|
//获取车辆进场数 |
|
|
|
HashMap<String, Object> params3 = new HashMap<>(); |
|
|
|
params3.put("tenantId", tenantId); |
|
|
|
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())); |
|
|
|
Map<String, Integer> triggerCountMap = new HashMap<>(); |
|
|
|
|
|
|
|
if(markingCouponDataReportDto.getType()==1) { //停车 |
|
|
|
//获取车辆进场数 |
|
|
|
params.clear(); |
|
|
|
params.put("tenantId", tenantId); |
|
|
|
if (markingCouponDataReportDto.getStartTime() != null) |
|
|
|
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); |
|
|
|
if (markingCouponDataReportDto.getEndTime() != null) |
|
|
|
params.put("endTime", convertDateAndAdd(convertDate(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 { |
|
|
|
//获取核销数 |
|
|
|
params.clear(); |
|
|
|
params.put("tenantId", tenantId); |
|
|
|
if (markingCouponDataReportDto.getStartTime() != null) |
|
|
|
params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); |
|
|
|
if (markingCouponDataReportDto.getEndTime() != null) |
|
|
|
params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); |
|
|
|
List<MarkingSceneDataVo> markingSceneDataVos = wxCouponOrderMapper.queryForSceneRepotyHistoryVerified(params); |
|
|
|
triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getTriggerCount())); |
|
|
|
|
|
|
|
} |
|
|
|
NumberFormat nf = NumberFormat.getPercentInstance(); |
|
|
|
nf.setMinimumFractionDigits(2); |
|
|
|
for (MarkingSceneDataVo vo : list) { |
|
|
|
vo.setVerifyCount(countMap.get(vo.getxTime()) == null ? 0 : countMap.get(vo.getxTime())); |
|
|
|
vo.setCarCount(carCountMap.get(vo.getxTime()) == null ? 0 : carCountMap.get(vo.getxTime())); |
|
|
|
if(vo.getSendCount()==0||vo.getVerifyCount()==0){ |
|
|
|
vo.setVerifyPercent(vo.getVerifyCount()+":"+vo.getSendCount()); |
|
|
|
vo.setVerifiedCount(countMap.get(vo.getxTime()) == null ? 0 : countMap.get(vo.getxTime())); |
|
|
|
vo.setTriggerCount(triggerCountMap.get(vo.getxTime()) == null ? 0 : triggerCountMap.get(vo.getxTime())); |
|
|
|
if(vo.getSendCount()==0){ |
|
|
|
vo.setVerifiedPercent("--"); |
|
|
|
}else { |
|
|
|
int gcd = gcd(vo.getSendCount(), vo.getVerifyCount()); |
|
|
|
vo.setVerifyPercent(vo.getVerifyCount() / gcd + "/" + vo.getSendCount() / gcd); |
|
|
|
vo.setVerifiedPercent(nf.format(new Double(vo.getVerifiedCount()) / new Double(vo.getSendCount()))); |
|
|
|
} |
|
|
|
} |
|
|
|
return new PageInfo<>(list); |
|
|
|
@@ -345,14 +359,5 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//计算最大公约数 |
|
|
|
public int gcd(int x, int y){ // 这个是运用辗转相除法求 两个数的 最大公约数 看不懂可以百度 // 下 |
|
|
|
if(y == 0) |
|
|
|
return x; |
|
|
|
else |
|
|
|
return gcd(y,x%y); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|