package com.nokia.tsl_data; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.Map; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import com.nokia.tsl_data.dao.HighQualityCountMapper; import com.nokia.tsl_data.dao.TargetTsRatioMapper; import com.nokia.tsl_data.entity.TargetTsRatio; import com.nokia.tsl_data.service.TaskService; import com.nokia.tsl_data.service.TslDataService; @SpringBootTest class TslDataApplicationTest { @Autowired private TaskService taskService; @Test void test() { taskService.generateReportV3("20240101"); } @Autowired private HighQualityCountMapper highQualityCountMapper; @Test void test1() { List> data = highQualityCountMapper.selectClientRatioForDay("2024-01-01"); data.forEach(System.out::println); } @Autowired private TslDataService tslDataService; @Test void test2() { List>> sheet4_6Data = tslDataService.getSheet4_6Data("20240101"); sheet4_6Data.forEach(list -> list.forEach(System.out::println)); } @Autowired private TargetTsRatioMapper targetTsRatioMapper; // 全省 4.2 3.4 4.4 4.7 5.0 5.1 5.4 5.5 4.9 4.6 4.3 3.7 @Test void test3() throws IOException { 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"; String[] split = s.split("\t"); System.out.println(Arrays.toString(split)); for (int i = 0; i < split.length; i++) { double d = Double.parseDouble(split[i]); TargetTsRatio targetTsRatio = new TargetTsRatio(); targetTsRatio.setCityName("全省"); targetTsRatio.setMonthId("2024" + (i < 9 ? "0" + (i + 1) : i + 1)); targetTsRatio.setManagementTargetRatio(d); targetTsRatioMapper.insertOne(targetTsRatio); } } }