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

    @Autowired
    private CurrentDataService currentDataService;
    @Autowired
    private CurrentDataServiceImpl currentDataServiceImpl;
    @GetMapping("/{inverterId}")
    public CurrentAnalysisResult analyzeCurrent(@PathVariable String 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();

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

    @Autowired
    private CurrentDataService currentDataService;
    @Autowired
    private CurrentDataServiceImpl currentDataServiceImpl;
    @GetMapping("/{inverterId}")
    public CurrentAnalysisResult analyzeCurrent(@PathVariable String 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(String inverterId, String dataType, String timeRange) {
        // 根据逆变器ID、数据类型和时间范围从数据库中查询支路电流数据
        // 使用Navicat等数据库客户端进行查询和提取数据

        return currentDataRepository.findCurrentData(inverterId, dataType, timeRange);
    }
    }
@Mapper
@Repository
public interface CurrentDataService {
    List<Double> getCurrentData(String inverterId, String daily, String s);
}
@Repository
public class CurrentDataRepository {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public List<Double> findCurrentData(String 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);
        //该方法接受三个参数：sql（SQL 查询语句）、Double.class（结果类型）和 inverterId、dataType、timeRange（查询参数）
        return currentData;
    }
}

@TableName("discrepancyanalysis")
public class Data {
    private String inverterId;
    private String date;
    private double module_capacity;
    private double module_current;

    // 其他属性
    // getter和setter方法
    public String getInverterId() {
        return inverterId;
    }

    public void setInverterId(String inverterId) {
        this.inverterId = inverterId;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public double getModule_current() {return module_current;}

    public void setModule_current(double module_current) {this.module_current = module_current;}

    public double getModule_capacity() {
        return module_capacity;
    }

    public void setModule_capacity(double module_capacity) {
        this.module_capacity = module_capacity;
  
}
  }
@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"));

          InverterDataService inverterDataService = new InverterDataService();
             String startTime = "9:00:00"; // 设置startTime
         String endTime = "15:00:00"; // 设置endTime
         List<Double> componentCurrents = inverterDataService.getComponentCurrentsByTime(startTime, endTime);
         List<Double> standardDeviations = inverterDataService.getStandardDeviations(componentCurrents);
         List<Double> discreteRates = inverterDataService.getDiscreteRates(componentCurrents, standardDeviations);
         List<Double> weightedAverages = inverterDataService.getWeightedAverages(discreteRates);
            // 对获得的数据进行处理
         System.out.println("weightedAverages"+resultSet.getObject("weightedAverages"));

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