zoujiajian 3 лет назад
Родитель
Сommit
061d8f591a

+ 12 - 11
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java

@@ -103,7 +103,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 			List<StatisticsFashionGoodsData> fashionGoodsData = statistics.statisticsFashionGoodsData(startDate, endDate, true);
 			List<StatisticsFashionGoodsData> collect = fashionGoodsData.stream().filter(data -> {
 				if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
-					data.setRefundMoney(getRefundMoney(data.getGoodsId(), startDate, endDate));
+					data.setRefundMoney(getRefundMoney(data.getGoodsId(), null, startDate, endDate));
 					data.setMoney(data.getMoney().divide(BigDecimal.valueOf(100)));
 					return true;
 				}
@@ -122,7 +122,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 				if (goodsDonSku != null) {
 					data.setSpecVal(goodsDonSku.getSpecVal());
 				}
-				data.setRefundMoney(getRefundMoney(data.getGoodsId(), startDate, endDate));
+				data.setRefundMoney(getRefundMoney(data.getGoodsId(), null, startDate, endDate));
 			}));
 			backgroundDataView.setFashionGoodsDataViews(fashionGoodsData);
 		}
@@ -236,7 +236,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 	public List<ExcelSheetAndData> exportStatisticsDataByType(Integer type, Long startTime, Long endTime) {
 		String startDate = null;
 		String endDate = null;
-		if (type==null) type = 0;
+		if (type == null) type = 0;
 		if (startTime != null) {
 			startDate = DateTime.of(startTime).toString();
 		}
@@ -295,7 +295,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 	private void exportFashionData(List<ExcelSheetAndData> excelSheetDataList, String startDate, String endDate) {
 		List<Long> goodsIds = statisticsUserDataMapper.getAllFashionGoods(startDate, endDate);
 		List<ExcelRealGoodsData> fashionData = new ArrayList<>();
-		goodsIds.forEach(goodsId->{
+		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 -> {
@@ -370,7 +370,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 	private void exportAppleOneData(List<ExcelSheetAndData> excelSheetDataList, String startDate, String endDate) {
 		Map<String, List<GoodsDonSku>> appleOneMap = statistics.getAppleOneMap();
 		List<ExcelAppleOneData> appleData = new ArrayList<>();
-		appleOneMap.forEach((k,v)->{
+		appleOneMap.forEach((k, v) -> {
 			ExcelAppleOneData appleDataExcel = new ExcelAppleOneData();
 			appleDataExcel.setArea(k);
 			Set<Long> skuIds = v.stream().map(GoodsDonSku::getId).collect(Collectors.toSet());
@@ -432,7 +432,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 			}).collect(Collectors.toList());
 			backgroundDataView.setAppleOneDataViews(collect);
 		} else {
-			appleOneData.forEach(data->{
+			appleOneData.forEach(data -> {
 				data.setRefundMoney(getAppleOneRefundMoneyByArea(data.getAreaName(), startDate, endDate));
 			});
 			backgroundDataView.setAppleOneDataViews(appleOneData);
@@ -444,7 +444,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 			List<StreamingAccountData> streamingAccountData = statistics.statisticsStreamingAccountData(startDate, endDate, true);
 			List<StreamingAccountData> collect = streamingAccountData.stream().filter(data -> {
 				if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
-					data.setRefundMoney(getRefundMoney(data.getGoodsId(), startDate, endDate));
+					data.setRefundMoney(getRefundMoney(data.getGoodsId(), null, startDate, endDate));
 					data.setMoney(data.getMoney().divide(BigDecimal.valueOf(100)));
 					return true;
 				}
@@ -458,7 +458,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 				if (goodsDon != null) {
 					data.setAccountName(goodsDon.getTitle());
 				}
-				data.setRefundMoney(getRefundMoney(data.getGoodsId(), startDate, endDate));
+				data.setRefundMoney(getRefundMoney(data.getGoodsId(), null, startDate, endDate));
 			}));
 			backgroundDataView.setStreamAccountDataViews(streamingAccountData);
 		}
@@ -469,7 +469,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 			List<RealGoodsData> realGoodsData = statistics.statisticsRealGoodsData(startDate, endDate, true);
 			List<RealGoodsData> collect = realGoodsData.stream().filter(data -> {
 				if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
-					data.setRefundMoney(getRefundMoney(data.getGoodsId(), startDate, endDate));
+					data.setRefundMoney(getRefundMoney(null, data.getSkuId(), startDate, endDate));
 					data.setMoney(data.getMoney().divide(BigDecimal.valueOf(100)));
 					return true;
 				}
@@ -487,7 +487,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 				if (goodsDonSku != null) {
 					data.setSpecVal(goodsDonSku.getSpecVal());
 				}
-				data.setRefundMoney(getRefundMoney(data.getGoodsId(), startDate, endDate));
+				data.setRefundMoney(getRefundMoney(null, data.getSkuId(), startDate, endDate));
 			}));
 			backgroundDataView.setRealGoodsDataViews(realGoodsData);
 		}
@@ -580,9 +580,10 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		}
 	}
 
-	public BigDecimal getRefundMoney(Long goodsId, Date startDate, Date endDate) {
+	public BigDecimal getRefundMoney(Long goodsId, Long skuId, Date startDate, Date endDate) {
 		Number refundMoneyNumber = beanSearcher.searchSum(OrderDon.class, MapUtils.builder()
 				.field(OrderDon::getGoodsId, goodsId)
+				.field(OrderDon::getSkuId, skuId)
 				.field(OrderDon::getStatus, OrderDon.Status.refund.name())
 				.field(OrderDon::getCreatedTime, startDate, endDate).op(Operator.Between)
 				.build(), "refundMoney");