TslDataApplicationTest.java 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package com.nokia.tsl_data;
  2. import com.nokia.common.scheduling.service.DemoService;
  3. import com.nokia.tsl_data.service.TslReportService;
  4. import com.nokia.tsl_data.service.UserCountService;
  5. import org.junit.jupiter.api.Test;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.boot.test.context.SpringBootTest;
  8. import java.io.IOException;
  9. import java.nio.charset.StandardCharsets;
  10. import java.nio.file.Files;
  11. import java.nio.file.Paths;
  12. @SpringBootTest
  13. class TslDataApplicationTest {
  14. @Autowired
  15. private UserCountService userCountService;
  16. /**
  17. * 更新管理端用户数--当前阶段需要修改一下模式
  18. */
  19. @Test
  20. void test1() throws IOException {
  21. String path = "D:/src/管理端用户数.txt";
  22. Files.lines(Paths.get(path), StandardCharsets.UTF_8)
  23. .forEach(line -> {
  24. String[] split = line.split("\t");
  25. System.out.println(split[0] + Double.parseDouble(split[2]));
  26. userCountService.updateManagementUserCount("202311", split[0], Double.parseDouble(split[2]));
  27. });
  28. }
  29. /**
  30. * 更新客户端用户数
  31. */
  32. @Test
  33. void test2() throws IOException {
  34. String path = "D:/src/客户端用户数.txt";
  35. Files.lines(Paths.get(path), StandardCharsets.UTF_8)
  36. .forEach(line -> {
  37. String[] split = line.split("\t");
  38. System.out.println(split[0] + Double.parseDouble(split[1]));
  39. userCountService.updateCustomerUserCount("202311", split[0], Double.parseDouble(split[1]));
  40. });
  41. }
  42. @Autowired
  43. private TslReportService tslReportService;
  44. @Test
  45. void test() {
  46. tslReportService.generateReport("20231126");
  47. tslReportService.screenShot("20231126");
  48. }
  49. @Autowired
  50. private DemoService demoService;
  51. @Test
  52. void test3() {
  53. demoService.test1();
  54. }
  55. }