| | |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | |
| | | orderStatisticsDetail.setServiceTotal(serviceTotal); |
| | | orderStatisticsDetail.setSingleTotal(singleTotal); |
| | | orderStatisticsDetail.setTotal(total); |
| | | |
| | | orderStatisticsDetail.setServiceTotalMoney(serviceTotalMoney); |
| | | orderStatisticsDetail.setSingleTotalMoney(singleTotalMoney); |
| | | orderStatisticsDetail.setTotalMoney(totalMoney); |
| | | orderStatisticsDetails.add(orderStatisticsDetail); |
| | | }); |
| | | Integer shopId = null; |
| | |
| | | } |
| | | OrderStatistics orderStatistics = orderMapper.getOrderStatistics(startTime, endTime, shopId); |
| | | if(null != orderStatistics){ |
| | | orderStatistics.setOrderStatisticsDetailList(orderStatisticsDetails); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<OrderStatisticsDetail> sortedDetails = orderStatisticsDetails.stream() |
| | | .sorted(Comparator.comparing((OrderStatisticsDetail detail) -> { |
| | | try { |
| | | return dateFormat.parse(detail.getDate()); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }).reversed()) |
| | | .collect(Collectors.toList()); |
| | | orderStatistics.setOrderStatisticsDetailList(sortedDetails); |
| | | } |
| | | return R.ok(orderStatistics); |
| | | } |