Commit 1695a097 authored by libin's avatar libin

租车订单统计

parent 038a7f48
...@@ -45,21 +45,24 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi ...@@ -45,21 +45,24 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
List<OrderDTO> orderDTOS = baseOrderBiz.selectOrdersByTypeAndTime(Arrays.asList(StatisticsStatusEnum.ORDER_RENT_VEHICLE_TYPE), startDate, endDate); List<OrderDTO> orderDTOS = baseOrderBiz.selectOrdersByTypeAndTime(Arrays.asList(StatisticsStatusEnum.ORDER_RENT_VEHICLE_TYPE), startDate, endDate);
Map<String, Long> stateGroupMap = orderDTOS.stream().peek(x -> {
x.setStateGroup(String.format("%d-%d-%d-%d", x.getCompanyId(), x.getOrderOrigin(), x.getPayWay() == null ? StatisticsStatusEnum.NO_PAY_WAY : x.getPayWay(), x.getStatus()));
})
.collect(Collectors.groupingBy(OrderDTO::getStateGroup, Collectors.counting()));
//订单账目信息 //订单账目信息
// List<OrderAccountBo> orderAccountBoList = orderAccountBiz.selectByDate(startDate,endDate); List<OrderAccountBo> orderAccountBoList = orderAccountBiz.selectByDate(startDate,endDate);
//数据处理 把 未支付的单的支付方式 设置为 99 //数据处理 把 未支付的单的支付方式 设置为 99
Map<String, List<OrderDTO>> ordersMap = orderDTOS.stream().peek(x -> { Map<String, List<OrderAccountBo>> ordersMap = orderAccountBoList.stream().peek(x -> {
x.setStateGroup(String.format("%d-%d-%d-%d", x.getCompanyId(), x.getOrderOrigin(), x.getPayWay() == null ? StatisticsStatusEnum.NO_PAY_WAY : x.getPayWay(), x.getStatus())); x.setStateGroup(String.format("%d-%d-%d-%d", x.getCompanyId(), x.getOrderOrigin(), x.getPayWay() == null ? StatisticsStatusEnum.NO_PAY_WAY : x.getPayWay(), x.getStatus()));
}).collect(Collectors.groupingBy(OrderDTO::getStateGroup, Collectors.toList())); }).collect(Collectors.groupingBy(OrderAccountBo::getStateGroup, Collectors.toList()));
if (!ordersMap.isEmpty()) { Set<Map.Entry<String, List<OrderAccountBo>>> ordersSet = ordersMap.entrySet();
Set<Map.Entry<String, List<OrderDTO>>> ordersSet = ordersMap.entrySet(); for (Map.Entry<String, List<OrderAccountBo>> orderEntry : ordersSet) {
for (Map.Entry<String, List<OrderDTO>> orderEntry : ordersSet) {
String orderKey = orderEntry.getKey(); String orderKey = orderEntry.getKey();
List<OrderDTO> orderDTOList = orderEntry.getValue(); List<OrderAccountBo> orderAccountBos = orderEntry.getValue();
OrderRentVehicleReceivedStatistics orderRentVehicleReceivedStatistics = StatisticsStatusEnum.wrapStatisticsObject(startDate, orderKey, new OrderRentVehicleReceivedStatistics()); OrderRentVehicleReceivedStatistics orderRentVehicleReceivedStatistics = StatisticsStatusEnum.wrapStatisticsObject(startDate, orderKey, new OrderRentVehicleReceivedStatistics());
/* BigDecimal totalAmount = BigDecimal.ZERO; BigDecimal totalAmount = BigDecimal.ZERO;
BigDecimal refundAmount = BigDecimal.ZERO; BigDecimal refundAmount = BigDecimal.ZERO;
for (OrderAccountBo orderAccountBo : orderAccountBos) { for (OrderAccountBo orderAccountBo : orderAccountBos) {
OrderAccountDetail accountDetailEntity = orderAccountBo.getAccountDetailEntity(); OrderAccountDetail accountDetailEntity = orderAccountBo.getAccountDetailEntity();
...@@ -70,10 +73,10 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi ...@@ -70,10 +73,10 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
} }
} }
orderRentVehicleReceivedStatistics.setTotalAmount(totalAmount); orderRentVehicleReceivedStatistics.setTotalAmount(totalAmount);
long size = orderAccountBos.stream().map(OrderDTO::getId).distinct().count(); Long totalQuantity = stateGroupMap == null?0L:stateGroupMap.get(orderKey)==null?0L:stateGroupMap.get(orderKey);
orderRentVehicleReceivedStatistics.setTotalQuantity(Integer.valueOf(String.valueOf(size)));*/ orderRentVehicleReceivedStatistics.setTotalQuantity(totalQuantity.intValue());
}
} }
List<Integer> companyIds = vehicleFeign.findCompanyIdsByAreaId(null); List<Integer> companyIds = vehicleFeign.findCompanyIdsByAreaId(null);
List stisticsActiveState = ordersMap.isEmpty() ? Collections.EMPTY_LIST : Lists.newArrayList(ordersMap.keySet()); List stisticsActiveState = ordersMap.isEmpty() ? Collections.EMPTY_LIST : Lists.newArrayList(ordersMap.keySet());
List<OrderRentVehicleReceivedStatistics> otherStatisticsStateGroupList = createOtherStatisticsStateGroupList(startDate,stisticsActiveState,companyIds); List<OrderRentVehicleReceivedStatistics> otherStatisticsStateGroupList = createOtherStatisticsStateGroupList(startDate,stisticsActiveState,companyIds);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment