TslDataApplicationTest.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package com.nokia.tsl_data;
  2. import java.io.IOException;
  3. import java.util.Arrays;
  4. import java.util.List;
  5. import java.util.Map;
  6. import org.junit.jupiter.api.Test;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.boot.test.context.SpringBootTest;
  9. import com.nokia.tsl_data.dao.HighQualityCountMapper;
  10. import com.nokia.tsl_data.dao.TargetTsRatioMapper;
  11. import com.nokia.tsl_data.entity.TargetTsRatio;
  12. import com.nokia.tsl_data.service.TaskService;
  13. import com.nokia.tsl_data.service.TslDataService;
  14. @SpringBootTest
  15. class TslDataApplicationTest {
  16. @Autowired
  17. private TaskService taskService;
  18. @Test
  19. void test() {
  20. taskService.generateReportV3("20240101");
  21. }
  22. @Autowired
  23. private HighQualityCountMapper highQualityCountMapper;
  24. @Test
  25. void test1() {
  26. List<Map<String, Object>> data = highQualityCountMapper.selectClientRatioForDay("2024-01-01");
  27. data.forEach(System.out::println);
  28. }
  29. @Autowired
  30. private TslDataService tslDataService;
  31. @Test
  32. void test2() {
  33. List<List<List<Object>>> sheet4_6Data = tslDataService.getSheet4_6Data("20240101");
  34. sheet4_6Data.forEach(list -> list.forEach(System.out::println));
  35. }
  36. @Autowired
  37. private TargetTsRatioMapper targetTsRatioMapper;
  38. // 全省 4.2 3.4 4.4 4.7 5.0 5.1 5.4 5.5 4.9 4.6 4.3 3.7
  39. @Test
  40. void test3() throws IOException {
  41. String s = "4.2 3.4 4.4 4.7 5.0 5.1 5.4 5.5 4.9 4.6 4.3 3.7";
  42. String[] split = s.split("\t");
  43. System.out.println(Arrays.toString(split));
  44. for (int i = 0; i < split.length; i++) {
  45. double d = Double.parseDouble(split[i]);
  46. TargetTsRatio targetTsRatio = new TargetTsRatio();
  47. targetTsRatio.setCityName("全省");
  48. targetTsRatio.setMonthId("2024" + (i < 9 ? "0" + (i + 1) : i + 1));
  49. targetTsRatio.setManagementTargetRatio(d);
  50. targetTsRatioMapper.insertOne(targetTsRatio);
  51. }
  52. }
  53. }