|
|
@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.constant.Constant;
|
|
|
+import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
import com.cyksj.mapper.*;
|
|
|
@@ -36,6 +37,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.CountDownLatch;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/*
|
|
|
@@ -78,8 +80,10 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
|
|
|
private final StatisticsExportMapper statisticsExportMapper;
|
|
|
|
|
|
+ private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
+
|
|
|
@Override
|
|
|
- public Result<BackgroundDataView> getStatisticsByCondition(Long startTime, Long endTime) {
|
|
|
+ public Result<BackgroundDataView> getStatisticsByCondition(Long startTime, Long endTime) throws InterruptedException {
|
|
|
BackgroundDataView backgroundDataView = new BackgroundDataView();
|
|
|
Date startDate = null;
|
|
|
Date endDate = null;
|
|
|
@@ -89,18 +93,34 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
if (endTime != null) {
|
|
|
endDate = DateUtil.date(endTime);
|
|
|
}
|
|
|
+ CountDownLatch countDownLatch = new CountDownLatch(2);
|
|
|
+ final Date f_st = startDate;
|
|
|
+ final Date f_et = endDate;
|
|
|
//头部数据
|
|
|
- headerData(backgroundDataView, startDate, endDate);
|
|
|
- //流媒体账号
|
|
|
- getStreamingAccountDataView(backgroundDataView, startDate, endDate);
|
|
|
- //appleOne
|
|
|
- getAppleOneDataView(backgroundDataView, startDate, endDate);
|
|
|
- //实物数据
|
|
|
- getRealGoodsData(backgroundDataView, startDate, endDate);
|
|
|
- //注册账号数据
|
|
|
- getRegisterAccountData(backgroundDataView, startDate, endDate);
|
|
|
- //潮玩好物数据
|
|
|
- getFashionGoodsData(backgroundDataView, startDate, endDate);
|
|
|
+ TASK_POOL.execute(() -> {
|
|
|
+ try {
|
|
|
+ headerData(backgroundDataView, f_st, f_et);
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ TASK_POOL.execute(() -> {
|
|
|
+ try {
|
|
|
+ //流媒体账号
|
|
|
+ getStreamingAccountDataView(backgroundDataView, f_st, f_et);
|
|
|
+ //appleOne
|
|
|
+ getAppleOneDataView(backgroundDataView, f_st, f_et);
|
|
|
+ //实物数据
|
|
|
+ getRealGoodsData(backgroundDataView, f_st, f_et);
|
|
|
+ //注册账号数据
|
|
|
+ getRegisterAccountData(backgroundDataView, f_st, f_et);
|
|
|
+ //潮玩好物数据
|
|
|
+ getFashionGoodsData(backgroundDataView, f_st, f_et);
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ countDownLatch.await();
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(backgroundDataView);
|
|
|
}
|
|
|
|
|
|
@@ -282,22 +302,63 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
if (endTime != null) {
|
|
|
endDate = DateTime.of(endTime).toString();
|
|
|
}
|
|
|
+ final String f_st = startDate;
|
|
|
+ final String f_et = endDate;
|
|
|
+ CountDownLatch countDownLatch = new CountDownLatch(3);
|
|
|
//业务订单数
|
|
|
- exportBusinessMonthlyData(excelSheetDataList, startTime, endTime);
|
|
|
+ TASK_POOL.execute(() -> {
|
|
|
+ try {
|
|
|
+ exportBusinessMonthlyData(excelSheetDataList, startTime, endTime);
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ });
|
|
|
//分销类型订单数据
|
|
|
- exportDistributeMonthlyData(excelSheetDataList, startDate, endDate);
|
|
|
-
|
|
|
+ TASK_POOL.execute(() -> {
|
|
|
+ try {
|
|
|
+ exportDistributeMonthlyData(excelSheetDataList, f_st, f_et);
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ });
|
|
|
//所有平台类型的订单数据
|
|
|
- exportAllTypeData(excelSheetDataList, startDate, endDate);
|
|
|
+ TASK_POOL.execute(() -> {
|
|
|
+ try {
|
|
|
+ exportAllTypeData(excelSheetDataList, f_st, f_et);
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ countDownLatch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ }
|
|
|
return excelSheetDataList;
|
|
|
}
|
|
|
|
|
|
public void exportAllTypeData(List<ExcelSheetAndData> excelSheetDataList, String startDate, String endDate) {
|
|
|
+ CountDownLatch latch = new CountDownLatch(2);
|
|
|
+ TASK_POOL.execute(() -> {
|
|
|
+ try {
|
|
|
+ exportStreamingAccountData(excelSheetDataList, startDate, endDate);
|
|
|
+ } finally {
|
|
|
+ latch.countDown();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ TASK_POOL.execute(() -> {
|
|
|
+ try {
|
|
|
+ exportRealGoodsData(excelSheetDataList, startDate, endDate);
|
|
|
+ } finally {
|
|
|
+ latch.countDown();
|
|
|
+ }
|
|
|
+ });
|
|
|
exportAppleOneData(excelSheetDataList, startDate, endDate);
|
|
|
- exportStreamingAccountData(excelSheetDataList, startDate, endDate);
|
|
|
- exportRealGoodsData(excelSheetDataList, startDate, endDate);
|
|
|
exportFashionData(excelSheetDataList, startDate, endDate);
|
|
|
exportRegisterData(excelSheetDataList, startDate, endDate);
|
|
|
+ try {
|
|
|
+ latch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void exportBusinessMonthlyData(List<ExcelSheetAndData> excelSheetDataList, Long startTime, Long endTime) {
|
|
|
@@ -404,7 +465,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
// .setMonthPrivateStreamingNumOfUser(monthPrivateStreamingNumOfUser)
|
|
|
// .setMonthPrivateAiNumOfUser(monthPrivateAiNumOfUser)
|
|
|
// .setMonthPrivateEqNumOfUser(monthPrivateEqNumOfUser);
|
|
|
- excelSheetDataList.add(new ExcelSheetAndData("每月订单业务数据", List.of(excelMonthOrderData), ExcelMonthOrderData.class));
|
|
|
+ excelSheetDataList.add(new ExcelSheetAndData("每月订单业务数据", List.of(excelMonthOrderData), ExcelMonthOrderData.class, 1));
|
|
|
}
|
|
|
|
|
|
private void exportDistributeMonthlyData(List<ExcelSheetAndData> excelSheetDataList, String startDate, String endDate) {
|
|
|
@@ -469,7 +530,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
excelMonthlyDistributeOrderData.setChannelUserSourceNum(channelUserSourceNum);
|
|
|
excelMonthlyDistributeOrderData.setChannelUserSourceOrderNum(channelUserSourceOrderNum);
|
|
|
excelMonthlyDistributeOrderData.setChannelUserSourceOrderRate(channelUserSourceOrderRate);
|
|
|
- excelSheetDataList.add(new ExcelSheetAndData("每月用户分销数据", List.of(excelMonthlyDistributeOrderData), ExcelMonthlyDistributeOrderData.class));
|
|
|
+ excelSheetDataList.add(new ExcelSheetAndData("每月用户分销数据", List.of(excelMonthlyDistributeOrderData), ExcelMonthlyDistributeOrderData.class, 2));
|
|
|
}
|
|
|
|
|
|
private void exportRegisterData(List<ExcelSheetAndData> excelSheetDataList, String startDate, String endDate) {
|
|
|
@@ -491,63 +552,59 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
if (registerAccountData.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- excelSheetDataList.add(new ExcelSheetAndData("注册账号数据", registerAccountData, ExcelRegisterAccountData.class));
|
|
|
+ excelSheetDataList.add(new ExcelSheetAndData("注册账号数据", registerAccountData, ExcelRegisterAccountData.class, 7));
|
|
|
}
|
|
|
|
|
|
private void exportFashionData(List<ExcelSheetAndData> excelSheetDataList, String startDate, String endDate) {
|
|
|
- List<Long> goodsIds = goodsDonMapper.selectList(Wrappers.lambdaQuery(GoodsDon.class).eq(GoodsDon::getType, Constant.realGoodsType.get(1))).stream().map(GoodsDon::getId).collect(Collectors.toList());
|
|
|
+ List<GoodsDonSkuView> goodsDonSkuViews = goodsDonMapper.selectGoodsDonSkuByGoodsType(Constant.realGoodsType.get(1));
|
|
|
List<ExcelRealGoodsData> fashionData = new ArrayList<>();
|
|
|
- goodsIds.forEach(goodsId -> {
|
|
|
- //查找所有规格
|
|
|
- List<Long> skuIds = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class).eq(GoodsDonSku::getGoodsId, goodsId)).stream().map(GoodsDonSku::getId).collect(Collectors.toList());
|
|
|
- skuIds.forEach(skuId -> {
|
|
|
- //订单数据
|
|
|
- ExcelRealGoodsData exportData = statisticsUserDataMapper.getExportGoodsDonDataBySkuId(skuId, startDate, endDate);
|
|
|
- if (exportData == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- exportData.setName(goodsDonMapper.selectById(goodsId).getTitle());
|
|
|
- exportData.setSpecVal(goodsDonSkuMapper.selectById(skuId).getSpecVal());
|
|
|
- if (exportData.getNumOfOrder() != 0) {
|
|
|
- fashionData.add(exportData);
|
|
|
- }
|
|
|
- });
|
|
|
+ goodsDonSkuViews.forEach(goodsDonSkuView -> {
|
|
|
+ Long skuId = goodsDonSkuView.getSkuId();
|
|
|
+ String goodsTitle = goodsDonSkuView.getGoodsTitle();
|
|
|
+ String specVal = goodsDonSkuView.getSpecVal();
|
|
|
+ //订单数据
|
|
|
+ ExcelRealGoodsData exportData = statisticsUserDataMapper.getExportGoodsDonDataBySkuId(skuId, startDate, endDate);
|
|
|
+ if (exportData == null || exportData.getNumOfOrder() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ exportData.setName(goodsTitle);
|
|
|
+ exportData.setSpecVal(specVal);
|
|
|
+
|
|
|
+ fashionData.add(exportData);
|
|
|
});
|
|
|
if (fashionData.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- excelSheetDataList.add(new ExcelSheetAndData("潮玩好物", fashionData, ExcelRealGoodsData.class));
|
|
|
+ excelSheetDataList.add(new ExcelSheetAndData("潮玩好物", fashionData, ExcelRealGoodsData.class, 6));
|
|
|
}
|
|
|
|
|
|
private void exportRealGoodsData(List<ExcelSheetAndData> excelSheetDataList, String startDate, String endDate) {
|
|
|
- List<Long> goodsIds = goodsDonMapper.selectList(Wrappers.lambdaQuery(GoodsDon.class).eq(GoodsDon::getType, Constant.realGoodsType.get(0))).stream().map(GoodsDon::getId).collect(Collectors.toList());
|
|
|
+ List<GoodsDonSkuView> goodsDonSkuViews = goodsDonMapper.selectGoodsDonSkuByGoodsType(Constant.realGoodsType.get(0));
|
|
|
List<ExcelRealGoodsData> realGoodsData = new ArrayList<>();
|
|
|
- goodsIds.forEach(goodsId -> {
|
|
|
- //查找所有规格
|
|
|
- List<Long> skuIds = goodsDonSkuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class).eq(GoodsDonSku::getGoodsId, goodsId)).stream().map(GoodsDonSku::getId).collect(Collectors.toList());
|
|
|
- skuIds.forEach(skuId -> {
|
|
|
- //订单数据
|
|
|
- ExcelRealGoodsData exportData = statisticsUserDataMapper.getExportGoodsDonDataBySkuId(skuId, startDate, endDate);
|
|
|
- if (exportData == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- exportData.setName(goodsDonMapper.selectById(goodsId).getTitle());
|
|
|
- exportData.setSpecVal(goodsDonSkuMapper.selectById(skuId).getSpecVal());
|
|
|
- if (exportData.getNumOfOrder() != 0) {
|
|
|
- realGoodsData.add(exportData);
|
|
|
- }
|
|
|
- });
|
|
|
+ goodsDonSkuViews.forEach(goodsDonSkuView -> {
|
|
|
+ Long skuId = goodsDonSkuView.getSkuId();
|
|
|
+ String goodsTitle = goodsDonSkuView.getGoodsTitle();
|
|
|
+ String specVal = goodsDonSkuView.getSpecVal();
|
|
|
+ //订单数据
|
|
|
+ ExcelRealGoodsData exportData = statisticsUserDataMapper.getExportGoodsDonDataBySkuId(skuId, startDate, endDate);
|
|
|
+ if (exportData == null || exportData.getNumOfOrder() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ exportData.setName(goodsTitle);
|
|
|
+ exportData.setSpecVal(specVal);
|
|
|
+
|
|
|
+ realGoodsData.add(exportData);
|
|
|
});
|
|
|
if (realGoodsData.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- excelSheetDataList.add(new ExcelSheetAndData("硬件设备数据", realGoodsData, ExcelRealGoodsData.class));
|
|
|
+ excelSheetDataList.add(new ExcelSheetAndData("硬件设备数据", realGoodsData, ExcelRealGoodsData.class, 5));
|
|
|
}
|
|
|
|
|
|
private void exportStreamingAccountData(List<ExcelSheetAndData> excelSheetDataList, String startDate, String endDate) {
|
|
|
- Long appleOndGoodsId = 2l;
|
|
|
+ Long appleOneGoodsId = 2l;
|
|
|
List<GoodsDon> goodsDons = goodsDonMapper.selectList(Wrappers.lambdaQuery(GoodsDon.class)
|
|
|
- .ne(GoodsDon::getId, appleOndGoodsId)
|
|
|
+ .ne(GoodsDon::getId, appleOneGoodsId)
|
|
|
.eq(GoodsDon::getType, 1)
|
|
|
.eq(GoodsDon::getDeleted, 1));
|
|
|
List<ExcelStreamingAccountData> streamingAccountData = new ArrayList<>();
|
|
|
@@ -558,13 +615,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
if (exportData == null || exportData.getNumOfUser() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
- exportData.setName(goodsDonMapper.selectById(goodsId).getTitle());
|
|
|
- //兑换单数
|
|
|
- exportData.setNumOfExCodeOrder(statisticsUserDataMapper.getExportStreamingAccountData(goodsId, null, true, startDate, endDate).getNumOfOrder());
|
|
|
- //分销记录
|
|
|
- ExcelStreamingAccountData distributeData = statisticsUserDataMapper.getExportStreamingAccountData(goodsId, true, null, startDate, endDate);
|
|
|
- exportData.setDisOrder(distributeData.getNumOfOrder());
|
|
|
- exportData.setDisMoney(distributeData.getMoney() != null ? distributeData.getMoney() : BigDecimal.ZERO);
|
|
|
+ exportData.setName(goods.getTitle());
|
|
|
//月、季、年
|
|
|
exportData.setMonth(statisticsUserDataMapper.getTypeData(goodsId, Constant.payType.get(0), startDate, endDate));
|
|
|
exportData.setSeason(statisticsUserDataMapper.getTypeData(goodsId, Constant.payType.get(1), startDate, endDate));
|
|
|
@@ -574,59 +625,32 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
if (streamingAccountData.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- excelSheetDataList.add(new ExcelSheetAndData("流媒体账号数据", streamingAccountData, ExcelStreamingAccountData.class));
|
|
|
+ excelSheetDataList.add(new ExcelSheetAndData("流媒体账号数据", streamingAccountData, ExcelStreamingAccountData.class, 4));
|
|
|
}
|
|
|
|
|
|
private void exportAppleOneData(List<ExcelSheetAndData> excelSheetDataList, String startDate, String endDate) {
|
|
|
Map<String, List<GoodsDonSku>> appleOneMap = statistics.getAppleOneMap();
|
|
|
List<ExcelAppleOneData> appleData = new ArrayList<>();
|
|
|
appleOneMap.forEach((areaName, goodsDonSkuList) -> {
|
|
|
- ExcelAppleOneData appleDataExcel = new ExcelAppleOneData();
|
|
|
- appleDataExcel.setArea(areaName);
|
|
|
Set<Long> skuIds = goodsDonSkuList.stream().map(GoodsDonSku::getId).collect(Collectors.toSet());
|
|
|
- List<OrderDon> orderDons = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class).in(OrderDon::getSkuId, skuIds)
|
|
|
- .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
- .ge(ObjectUtil.isNotNull(startDate), OrderDon::getCreatedTime, startDate)
|
|
|
- .lt(ObjectUtil.isNotNull(endDate), OrderDon::getCreatedTime, endDate));
|
|
|
- appleDataExcel.setNumOfOrder(orderDons.size());
|
|
|
- Set<Long> userSet = Optional.ofNullable(orderDons.stream().map(OrderDon::getUserId).collect(Collectors.toSet())).orElse(new HashSet<>());
|
|
|
- appleDataExcel.setNumOfUser(userSet.size());
|
|
|
- List<OrderDon> exCodeOrders = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
- .eq(OrderDon::getType, OrderDon.Type.EX_CODE)
|
|
|
- .in(OrderDon::getSkuId, skuIds)
|
|
|
- .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
- .ge(ObjectUtil.isNotNull(startDate), OrderDon::getCreatedTime, startDate)
|
|
|
- .lt(ObjectUtil.isNotNull(endDate), OrderDon::getCreatedTime, endDate));
|
|
|
- if (orderDons.isEmpty()) {
|
|
|
+ ExcelAppleOneData appleDataExcel = statisticsExportMapper.getAppleOneDataThisMonth(skuIds, startDate, endDate);
|
|
|
+ if (appleDataExcel == null || appleDataExcel.getNumOfOrder() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
- appleDataExcel.setNumOfExCodeOrder(exCodeOrders.size());
|
|
|
- //金额
|
|
|
- Optional<BigDecimal> money = orderDonMapper.selectThisMonthMoney(skuIds, startDate, endDate);
|
|
|
- appleDataExcel.setMoney(money.isPresent() ? money.get().divide(BigDecimal.valueOf(100)) : BigDecimal.ZERO);
|
|
|
- List<OrderDon> distributeOrders = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
- .eq(OrderDon::getIsDistribute, true)
|
|
|
- .in(OrderDon::getSkuId, skuIds)
|
|
|
- .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
- .ge(ObjectUtil.isNotNull(startDate), OrderDon::getCreatedTime, startDate)
|
|
|
- .lt(ObjectUtil.isNotNull(endDate), OrderDon::getCreatedTime, endDate));
|
|
|
- appleDataExcel.setDisOrder(distributeOrders.size());
|
|
|
- Optional<BigDecimal> distributeMoney = distributeOrders.stream().map(OrderDon::getMoney).reduce(BigDecimal::add);
|
|
|
- appleDataExcel.setDisMoney(distributeMoney.isPresent() ? distributeMoney.get().divide(BigDecimal.valueOf(100)) : BigDecimal.ZERO);
|
|
|
- Map<Long, List<OrderDon>> skuMaps = orderDons.stream().collect(Collectors.groupingBy(OrderDon::getSkuId));
|
|
|
+ appleDataExcel.setArea(areaName);
|
|
|
+
|
|
|
Integer monthOrder = 0;
|
|
|
Integer searOrder = 0;
|
|
|
Integer yearOrder = 0;
|
|
|
for (GoodsDonSku sku : goodsDonSkuList) {
|
|
|
Long skuId = sku.getId();
|
|
|
if (StrUtil.isNotBlank(sku.getSpecVal())) {
|
|
|
- List<OrderDon> dons = Optional.ofNullable(skuMaps.get(skuId)).orElse(new ArrayList<>());
|
|
|
if (sku.getSpecVal().contains(Constant.payType.get(0)) && !sku.getSpecVal().contains(Constant.payType.get(2))) {
|
|
|
- monthOrder += dons.size();
|
|
|
+ monthOrder += statisticsExportMapper.getAppleOnePayMonthTypeOrderThisMonth(skuId, startDate, endDate);
|
|
|
} else if (sku.getSpecVal().contains(Constant.payType.get(1))) {
|
|
|
- searOrder += dons.size();
|
|
|
+ searOrder += statisticsExportMapper.getAppleOnePayMonthTypeOrderThisMonth(skuId, startDate, endDate);
|
|
|
} else if (!sku.getSpecVal().contains(Constant.payType.get(0)) && sku.getSpecVal().contains(Constant.payType.get(2))) {
|
|
|
- yearOrder += dons.size();
|
|
|
+ yearOrder += statisticsExportMapper.getAppleOnePayMonthTypeOrderThisMonth(skuId, startDate, endDate);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -638,7 +662,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
if (appleData.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- excelSheetDataList.add(new ExcelSheetAndData("Apple One数据", appleData, ExcelAppleOneData.class));
|
|
|
+ excelSheetDataList.add(new ExcelSheetAndData("Apple One数据", appleData, ExcelAppleOneData.class, 3));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -829,17 +853,9 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
}
|
|
|
|
|
|
public void setGoodsMoneyAndOrder(Integer type, Date startDate, Date endDate, BackgroundDataView backgroundDataView) {
|
|
|
- List<OrderDonStatisticsView> orderDonStatisticsView = Optional.ofNullable(beanSearcher.searchAll(OrderDonStatisticsView.class,
|
|
|
- MapUtils.builder().field(OrderDonStatisticsView::getGoodsType, type)
|
|
|
- .field(OrderDonStatisticsView::getStatus, Constant.noOrderStatus).op(Operator.NotIn)
|
|
|
- .field(OrderDonStatisticsView::getCreateTime, startDate, endDate).op(Operator.Between)
|
|
|
- .build())).orElse(new ArrayList<>());
|
|
|
- Optional<BigDecimal> orderMoneyReduce = orderDonStatisticsView.stream().map(OrderDonStatisticsView::getMoney).reduce(BigDecimal::add);
|
|
|
- int totalOrder = orderDonStatisticsView.size();
|
|
|
-
|
|
|
- BigDecimal orderMoney = orderMoneyReduce.isPresent() ? orderMoneyReduce.get().divide(BigDecimal.valueOf(100)) : BigDecimal.ZERO;
|
|
|
- backgroundDataView.setFashionNumOfOrder(totalOrder);
|
|
|
- backgroundDataView.setFashionAccountOfOrder(orderMoney);
|
|
|
+ Map<String, Object> map = orderDonMapper.getOrderDetailByGoodsType(type, Constant.noOrderStatus, startDate, endDate);
|
|
|
+ Integer totalOrder = Integer.parseInt(map.get("orderNum").toString());
|
|
|
+ BigDecimal orderMoney = BigDecimal.valueOf(Long.parseLong(map.get("money").toString())).divide(BigDecimal.valueOf(100));
|
|
|
if (type == 1) {
|
|
|
backgroundDataView.setVirtualNumOfOrder(totalOrder);
|
|
|
backgroundDataView.setVirtualAccountOfOrder(orderMoney);
|