StatisticServiceTest.java 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package com.izouma.nineth.service;
  2. import org.junit.Test;
  3. import org.junit.runner.RunWith;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.boot.test.context.SpringBootTest;
  6. import org.springframework.test.context.junit4.SpringRunner;
  7. import java.time.LocalDate;
  8. import java.time.LocalDateTime;
  9. import java.time.LocalTime;
  10. @SpringBootTest
  11. @RunWith(SpringRunner.class)
  12. public class StatisticServiceTest {
  13. @Autowired
  14. private StatisticService statisticService;
  15. @Autowired
  16. private CacheService cacheService;
  17. @Test
  18. public void total() {
  19. System.out.println(statisticService.total());
  20. }
  21. // @Test
  22. // public void userTrend() {
  23. // System.out.println(statisticService.userTrend(7));
  24. // }
  25. @Test
  26. public void orderNumTrend() {
  27. System.out.println(statisticService.orderNumTrend(7));
  28. }
  29. @Test
  30. public void orderPriceTrend() {
  31. System.out.println(statisticService.orderPriceTrend(7));
  32. }
  33. @Test
  34. public void top() {
  35. LocalDate now = LocalDate.now();
  36. LocalDate endDate = now.minusDays(now.getDayOfWeek().getValue());
  37. LocalDateTime start = LocalDateTime.of(endDate.minusDays(6), LocalTime.MIN);
  38. System.out.println(start);
  39. String top = statisticService.top(start, LocalDateTime.of(endDate, LocalTime.MAX), 50);
  40. System.out.println(top);
  41. }
  42. @Test
  43. public void test() {
  44. cacheService.clearWeekTop();
  45. }
  46. }