package com.trafficaudit.energy.service; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import javax.annotation.Resource; /** 启动时确保 H204 单耗阈值表存在并有种子数据(幂等) */ @Component @Order(120) public class EnergyThresholdInitializer implements ApplicationRunner { @Resource private EnergyThresholdService thresholdService; @Override public void run(ApplicationArguments args) { thresholdService.seedIfNeeded(); } }