| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | |
| | | * 总体订单 |
| | | */ |
| | | public TOrderStatisticsTotalOrderVo totalOrderStatistics(String startDate, String endDate) { |
| | | if(StringUtils.isNotEmpty(startDate)) { |
| | | startDate = startDate+" 00:00:00"; |
| | | } |
| | | if(StringUtils.isNotEmpty(endDate)) { |
| | | endDate = endDate+" 23:59:59"; |
| | | } |
| | | startDate = Optional.ofNullable(startDate).filter(StringUtils::isNotEmpty).map(s -> s +" 00:00:00").orElseThrow(() -> new ServiceException("总体订单统计,开始时间不能为空")); |
| | | endDate = Optional.ofNullable(endDate).filter(StringUtils::isNotEmpty).map(e -> e +" 23:59:59").orElseThrow(() -> new ServiceException("总体订单统计,结束时间不能为空")); |
| | | TOrderStatisticsTotalOrderVo totalOrderVo = orderTaxiMapper.totalOrderStatistics(startDate, endDate); |
| | | return Optional.ofNullable(totalOrderVo).map(TOrderStatisticsTotalOrderVo::convert).orElse(new TOrderStatisticsTotalOrderVo()); |
| | | } |
| | |
| | | * @param type 1 日新增,2月新增 |
| | | */ |
| | | public List<TOrderStatisticsCountVo> newAddPassengerStatistics(Integer type) { |
| | | Optional.ofNullable(type).orElseThrow(() -> new ServiceException("新增乘客统计,请求类型不能为空")); |
| | | return orderTaxiMapper.newAddPassengerStatistics(type); |
| | | } |
| | | |
| | |
| | | * @param type 1 日订单量,2月订单量 |
| | | */ |
| | | public List<TOrderStatisticsCountVo> orderCountStatistics(Integer type) { |
| | | Optional.ofNullable(type).orElseThrow(() -> new ServiceException("订单量统计,请求类型不能为空")); |
| | | return orderTaxiMapper.orderCountStatistics(type); |
| | | } |
| | | |
| | |
| | | * @param type 1 今日,2本周,3本月 |
| | | */ |
| | | public List<TOrderStatisticsCarVo> driverCarStatistics(Integer type) { |
| | | Optional.ofNullable(type).orElseThrow(() -> new ServiceException("司机接单排名统计,请求类型不能为空")); |
| | | return orderTaxiMapper.driverCarStatistics(type); |
| | | } |
| | | |
| | |
| | | * @param type 1 今日,2本周,3本月 |
| | | */ |
| | | public List<TOrderStatisticsPassengerVo> passengerStatistics(Integer type) { |
| | | Optional.ofNullable(type).orElseThrow(() -> new ServiceException("乘客排名统计,请求类型不能为空")); |
| | | return orderTaxiMapper.passengerStatistics(type); |
| | | } |
| | | } |