mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update
This commit is contained in:
@@ -365,53 +365,83 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
|
||||
//根据分组进行分账信息的汇总
|
||||
List<SplitConfigOrderVO> resultList = Lists.newArrayList();
|
||||
|
||||
for (Map.Entry<String, List<SplitConfigStationVO>> entry : collect.entrySet()) {
|
||||
String stationId = entry.getKey();
|
||||
List<SplitConfigStationVO> splitConfigStationVOList = entry.getValue();
|
||||
|
||||
//计算时间范围
|
||||
List<SplitConfigStationVO> sortedList = splitConfigStationVOList.stream()
|
||||
.sorted(Comparator.comparing(SplitConfigStationVO::getTradeDate))
|
||||
.collect(Collectors.toList());
|
||||
String startTime = sortedList.get(0).getTradeDate();
|
||||
String endTime = sortedList.get(sortedList.size() - 1).getTradeDate();
|
||||
// //计算时间范围
|
||||
// List<SplitConfigStationVO> sortedList = splitConfigStationVOList.stream()
|
||||
// .sorted(Comparator.comparing(SplitConfigStationVO::getTradeDate))
|
||||
// .collect(Collectors.toList());
|
||||
// String startTime = sortedList.get(0).getTradeDate();
|
||||
// String endTime = sortedList.get(sortedList.size() - 1).getTradeDate();
|
||||
|
||||
String timeRange = dto.getStartTime() + "至" + dto.getEndTime();
|
||||
|
||||
BigDecimal totalElectricitySplitAmount = BigDecimal.ZERO;
|
||||
BigDecimal totalServiceSplitAmount = BigDecimal.ZERO;
|
||||
BigDecimal totalFeeAmount = BigDecimal.ZERO;
|
||||
for (SplitConfigStationVO splitConfigStationVO : splitConfigStationVOList) {
|
||||
// 总电费分账金额
|
||||
totalElectricitySplitAmount = totalElectricitySplitAmount.add(splitConfigStationVO.getElectricityAmount());
|
||||
// 总服务费分账金额
|
||||
totalServiceSplitAmount = totalServiceSplitAmount.add(splitConfigStationVO.getServiceAmount());
|
||||
// 总手续费
|
||||
totalFeeAmount = totalFeeAmount.add(splitConfigStationVO.getFeeAmount());
|
||||
}
|
||||
|
||||
// 总收入
|
||||
BigDecimal totalRevenueAmount = totalElectricitySplitAmount.add(totalServiceSplitAmount).subtract(totalFeeAmount);
|
||||
|
||||
SplitConfigOrderVO vo = SplitConfigOrderVO.builder()
|
||||
.stationId(stationId)
|
||||
.stationName(splitConfigStationVOList.get(0).getStationName())
|
||||
.totalElectricitySplitAmount(totalElectricitySplitAmount)
|
||||
.totalServiceSplitAmount(totalServiceSplitAmount)
|
||||
.totalFeeAmount(totalFeeAmount)
|
||||
.totalRevenueAmount(totalRevenueAmount)
|
||||
.orderCount(splitConfigStationVOList.size())
|
||||
.timeRange(timeRange)
|
||||
|
||||
.build();
|
||||
resultList.add(vo);
|
||||
|
||||
String timeRange = startTime + "至" + endTime;
|
||||
|
||||
//总的电费分账金额totalElectricitySplitAmount
|
||||
BigDecimal totalElectricitySplitAmount =
|
||||
splitConfigStationVOList.stream()
|
||||
.map(SplitConfigStationVO::getElectricityAmount)
|
||||
.filter(Objects::nonNull) //过滤掉null
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
//总的服务费分账金额totalServiceSplitAmount
|
||||
BigDecimal totalServiceSplitAmount =
|
||||
splitConfigStationVOList.stream()
|
||||
.map(SplitConfigStationVO::getServiceAmount)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
//总手续费分账金额totalFeeAmount
|
||||
BigDecimal totalFeeAmount =
|
||||
splitConfigStationVOList.stream()
|
||||
.map(SplitConfigStationVO::getFeeAmount)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
//总收入分账金额= 总电费分账金额 +总手续费分账金额 -总手续费分账金额
|
||||
BigDecimal totalRevenueAmount = totalElectricitySplitAmount.add(totalServiceSplitAmount).subtract(totalFeeAmount);
|
||||
SplitConfigOrderVO splitConfigOrderVO =
|
||||
SplitConfigOrderVO.builder()
|
||||
.stationId(stationId)
|
||||
.stationName(splitConfigStationVOList.get(0).getStationName())
|
||||
.orderCount(splitConfigStationVOList.size())
|
||||
.timeRange(timeRange)
|
||||
.totalElectricitySplitAmount(totalElectricitySplitAmount)
|
||||
.totalServiceSplitAmount(totalServiceSplitAmount)
|
||||
.totalFeeAmount(totalFeeAmount)
|
||||
.totalRevenueAmount(totalRevenueAmount)
|
||||
.build();
|
||||
|
||||
resultList.add(splitConfigOrderVO);
|
||||
// BigDecimal totalElectricitySplitAmount =
|
||||
// splitConfigStationVOList.stream()
|
||||
// .map(SplitConfigStationVO::getElectricityAmount)
|
||||
// .filter(Objects::nonNull) //过滤掉null
|
||||
// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// //总的服务费分账金额totalServiceSplitAmount
|
||||
// BigDecimal totalServiceSplitAmount =
|
||||
// splitConfigStationVOList.stream()
|
||||
// .map(SplitConfigStationVO::getServiceAmount)
|
||||
// .filter(Objects::nonNull)
|
||||
// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// //总手续费分账金额totalFeeAmount
|
||||
// BigDecimal totalFeeAmount =
|
||||
// splitConfigStationVOList.stream()
|
||||
// .map(SplitConfigStationVO::getFeeAmount)
|
||||
// .filter(Objects::nonNull)
|
||||
// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
//
|
||||
// //总收入分账金额= 总电费分账金额 +总手续费分账金额 -总手续费分账金额
|
||||
// BigDecimal totalRevenueAmount = totalElectricitySplitAmount.add(totalServiceSplitAmount).subtract(totalFeeAmount);
|
||||
// SplitConfigOrderVO splitConfigOrderVO =
|
||||
// SplitConfigOrderVO.builder()
|
||||
// .stationId(stationId)
|
||||
// .stationName(splitConfigStationVOList.get(0).getStationName())
|
||||
// .orderCount(splitConfigStationVOList.size())
|
||||
// .timeRange(timeRange)
|
||||
// .totalElectricitySplitAmount(totalElectricitySplitAmount)
|
||||
// .totalServiceSplitAmount(totalServiceSplitAmount)
|
||||
// .totalFeeAmount(totalFeeAmount)
|
||||
// .totalRevenueAmount(totalRevenueAmount)
|
||||
// .build();
|
||||
//
|
||||
// resultList.add(splitConfigOrderVO);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user