1.2支路电流分析：

@RestController
@RequestMapping(“/current-analysis”)
public class CurrentAnalysisController {

    @Autowired
    private CurrentDataService currentDataService;

    @GetMapping(“/{inverterId}”)
    public CurrentAnalysisResult analyzeCurrent(@PathVariable Long inverterId,
                                                @RequestParam String dataType,
                                                @RequestParam String timeRange) {
        // 设定分析参数
        // 获取选定时间范围内的支路电流数据
        List<Double> currentData = currentDataService.getCurrentData(inverterId, dataType, timeRange);

        // 统计支路电流为零的次数，并计算零系数
        double zeroCount = currentData.stream().filter(current -> current == 0).count();
        double zeroFactor = zeroCount / currentData.size();

        // 计算支路电流的平均值，并判断每个支路电流是否低于平均值
        double averageCurrent = currentData.stream().mapToDouble(Double::doubleValue).average().orElse(0.0);
        long belowAverageCount = currentData.stream().filter(current -> current < averageCurrent).count();
        double lowFactor = belowAverageCount / currentData.size();

        return new CurrentAnalysisResult(zeroFactor, lowFactor);
    }
}

@Service
public class CurrentDataServiceImpl implements CurrentDataService {

    @Autowired
    private CurrentDataRepository currentDataRepository;

    @Override
    public List<Double> getCurrentData(Long inverterId, String dataType, String timeRange) {
        // 根据逆变器ID、数据类型和时间范围从数据库中查询支路电流数据
        // 使用Navicat等数据库客户端进行查询和提取数据

        return currentDataRepository.findCurrentData(inverterId, dataType, timeRange);
    }
}

@Repository
public class CurrentDataRepository {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public List<Double> findCurrentData(Long inverterId, String dataType, String timeRange) {
        // 使用JdbcTemplate执行SQL查询，并返回支路电流数据

        // 例子：
        String sql = “SELECT current_value FROM current_data WHERE inverter_id = ? AND data_type = ? AND time_range = ?”;
                // 执行查询，将结果映射为List<Double>
        List<Double> currentData = jdbcTemplate.queryForList(sql, Double.class, inverterId, dataType, timeRange);
        return currentData;
    }
}

public class CurrentAnalysisResult {
    private double zeroFactor;
    private double lowFactor;

    // 构造函数、getter、setter等省略
}
@ImportResource("classpath:applicationContext.xml")
@SpringBootApplication
//@MapperScan
@Repository
@Service
@RestController
public class Main {
	public static void main(String[] args) {
		Connection connection = null;

		try {
			// 加载JDBC驱动程序
			Class.forName("com.mysql.cj.jdbc.Driver");

			// 创建数据库连接
			String url = "jdbc:mysql://localhost:3306/mydb_one?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone = GMT";
			String username = "root";
			String password = "1527648qw";
			connection = DriverManager.getConnection(url, username, password);
			Statement statement = connection.createStatement();
			String sql = "select * from discrepancyanalysis";
			// 执行数据库操作
			ResultSet resultSet = statement.executeQuery(sql);
			while (resultSet.next())
				System.out.println("daily" + resultSet.getObject("daily"));
			System.out.println("CurrentAnalysisResult"+resultSet.getObject("CurrentAnalysisResult"));


		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			// 关闭数据库连接
			try {
				if (connection != null) {
					connection.close();
				}
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}}为什么这段代码报错