|
|
|
@@ -3,11 +3,9 @@ package com.iformall.service.impl; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.domain.dto.MarkingCouponDataReportDto; |
|
|
|
import com.iformall.domain.dto.WxOrderReportDto; |
|
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
|
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.domain.vo.*; |
|
|
|
import com.iformall.enums.EnumCarCmd; |
|
|
|
import com.iformall.enums.EnumCouponSendSendType; |
|
|
|
import com.iformall.enums.EnumCouponType; |
|
|
|
@@ -16,12 +14,15 @@ import com.iformall.mapper.*; |
|
|
|
import com.iformall.service.MarkingDataReportService; |
|
|
|
import com.iformall.utils.DateUtils; |
|
|
|
import net.bytebuddy.asm.Advice; |
|
|
|
import org.joda.time.Days; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.text.NumberFormat; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.temporal.ChronoUnit; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@@ -81,17 +82,13 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { |
|
|
|
|
|
|
|
NumberFormat nf = NumberFormat.getPercentInstance(); |
|
|
|
nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 |
|
|
|
String couponUpDay = ""; |
|
|
|
String couponUpDay = "--"; |
|
|
|
if (yesterdayCount != 0) { |
|
|
|
couponUpDay = nf.format((todayCouponCount - yesterdayCount) / (float) yesterdayCount); |
|
|
|
} else { |
|
|
|
couponUpDay = nf.format(todayCouponCount); |
|
|
|
} |
|
|
|
String couponUpWeek = ""; |
|
|
|
String couponUpWeek = "--"; |
|
|
|
if (lastWeekCount != 0) { |
|
|
|
couponUpWeek = nf.format((todayCouponCount - lastWeekCount) / (float) lastWeekCount); |
|
|
|
} else { |
|
|
|
couponUpWeek = nf.format(todayCouponCount); |
|
|
|
} |
|
|
|
|
|
|
|
//couponData |
|
|
|
@@ -142,17 +139,13 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { |
|
|
|
|
|
|
|
NumberFormat nf = NumberFormat.getPercentInstance(); |
|
|
|
nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 |
|
|
|
String sceneDownDay = ""; |
|
|
|
String sceneDownDay = "--"; |
|
|
|
if (yesterdayCount != 0) { |
|
|
|
sceneDownDay = nf.format((yesterdayCount - todaySceneCount) / (float) yesterdayCount); |
|
|
|
} else { |
|
|
|
sceneDownDay = nf.format(0 - todaySceneCount); |
|
|
|
} |
|
|
|
String sceneUpWeek = ""; |
|
|
|
String sceneUpWeek = "--"; |
|
|
|
if (lastWeekCount != 0) { |
|
|
|
sceneUpWeek = nf.format((todaySceneCount - lastWeekCount) / (float) lastWeekCount); |
|
|
|
} else { |
|
|
|
sceneUpWeek = nf.format(todaySceneCount); |
|
|
|
} |
|
|
|
|
|
|
|
HashMap<String, Object> params = new HashMap<>(); |
|
|
|
@@ -385,6 +378,94 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { |
|
|
|
return new PageInfo<>(list); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> listOrderReportByDate(String tenantId, WxOrderReportDto wxOrderReportDto, Integer pageIndex, Integer pageSize) { |
|
|
|
HashMap<String, Object> params = new HashMap<>(); |
|
|
|
params.put("tenantId", tenantId); |
|
|
|
if (wxOrderReportDto.getStartTime() != null) { |
|
|
|
params.put("startTime", convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); |
|
|
|
} else { |
|
|
|
params.put("startTime", addDay(-30)); |
|
|
|
} |
|
|
|
if (wxOrderReportDto.getEndTime() != null) { |
|
|
|
params.put("endTime", convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); |
|
|
|
} else { |
|
|
|
params.put("endTime", addDay(1)); |
|
|
|
} |
|
|
|
params.put("type", wxOrderReportDto.getType()); |
|
|
|
List<WxOrderReportVo> list = wxOrderMapper.listOrderReportByDate(params); |
|
|
|
|
|
|
|
String startdate = DateUtils.getTimeBefore(30, new Date()); |
|
|
|
String enddate = DateUtils.getTimeBefore(0,new Date()); |
|
|
|
List<String> tjTimeList = DateUtils.getTjTimeList(startdate, enddate, "0"); |
|
|
|
List<WxOrderReportVo> wxOrderReportVoList = new ArrayList<WxOrderReportVo>(); |
|
|
|
|
|
|
|
int todayCount = 0; |
|
|
|
int todayAmount = 0; |
|
|
|
int yesterdayCount = 0; |
|
|
|
int yesterdayAmount = 0; |
|
|
|
int lastWeekCount = 0; |
|
|
|
int lastWeekAmount = 0; |
|
|
|
|
|
|
|
for(String tj:tjTimeList){ |
|
|
|
Optional<WxOrderReportVo> first = list.stream().filter(c -> c.getxTime().equals(tj)).findFirst(); |
|
|
|
if(!first.isPresent()){ |
|
|
|
WxOrderReportVo orderReportVo = new WxOrderReportVo(); |
|
|
|
orderReportVo.setAmount(0); |
|
|
|
orderReportVo.setCount(0); |
|
|
|
first = Optional.of(orderReportVo); |
|
|
|
} |
|
|
|
first.get().setxTime(tj.substring(5).replace("-", "/")); |
|
|
|
wxOrderReportVoList.add(first.get()); |
|
|
|
if (LocalDate.now().equals(tj)){ |
|
|
|
todayCount = first.get().getCount(); |
|
|
|
todayAmount = first.get().getAmount(); |
|
|
|
} |
|
|
|
if (LocalDate.now().minusDays(1).equals(tj)){ |
|
|
|
yesterdayCount = first.get().getCount(); |
|
|
|
yesterdayAmount = first.get().getAmount(); |
|
|
|
} |
|
|
|
if (LocalDate.now().minusDays(7).equals(tj)){ |
|
|
|
lastWeekCount = first.get().getCount(); |
|
|
|
lastWeekAmount= first.get().getAmount(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
NumberFormat nf = NumberFormat.getPercentInstance(); |
|
|
|
nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 |
|
|
|
String dayCountRate = "--"; |
|
|
|
if (yesterdayCount != 0) { |
|
|
|
dayCountRate = nf.format((todayCount - yesterdayCount) / (float) yesterdayCount); |
|
|
|
} |
|
|
|
String weekCountRate = "--"; |
|
|
|
if (lastWeekCount != 0) { |
|
|
|
weekCountRate = nf.format((todayCount - lastWeekCount) / (float) lastWeekCount); |
|
|
|
} |
|
|
|
|
|
|
|
String dayAmountRate = "--"; |
|
|
|
if (yesterdayAmount != 0) { |
|
|
|
dayAmountRate = nf.format((todayAmount - yesterdayAmount) / (float) yesterdayAmount); |
|
|
|
} |
|
|
|
|
|
|
|
String weekAmountRate = "--"; |
|
|
|
if (lastWeekAmount != 0) { |
|
|
|
weekAmountRate = nf.format((todayAmount - lastWeekAmount) / (float) lastWeekAmount); |
|
|
|
} |
|
|
|
|
|
|
|
HashMap<String, Object> returnMap = new HashMap<>(); |
|
|
|
returnMap.put("microPayList",wxOrderReportVoList); |
|
|
|
returnMap.put("todayCount",todayCount); |
|
|
|
returnMap.put("dayCountRate",dayCountRate); |
|
|
|
returnMap.put("weekCountRate",weekCountRate); |
|
|
|
returnMap.put("todayAmount",todayAmount); |
|
|
|
returnMap.put("dayAmountRate",dayAmountRate); |
|
|
|
returnMap.put("weekAmountRate",weekAmountRate); |
|
|
|
|
|
|
|
return returnMap; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageInfo<TouchUsersReportVo> getTouchUsersReportList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { |
|
|
|
|
|
|
|
|