代码调整

This commit is contained in:
2023-02-27 13:39:59 +08:00
parent 338b659d94
commit 43e60ec946
5 changed files with 12 additions and 18 deletions

View File

@@ -3,8 +3,11 @@ package com.njcn.influxdb.config;
import com.njcn.influxdb.utils.InfluxDbUtils;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* 类的介绍:
@@ -14,23 +17,20 @@ import org.springframework.context.annotation.Configuration;
* @createTime 2021/12/10 10:48
*/
@Data
@Configuration
@Component
@ConfigurationProperties(prefix = "spring.influx")
public class InfluxDbConfig {
@Value("${spring.influx.url:''}")
private String influxDBUrl;
private String url;
@Value("${spring.influx.user:''}")
private String userName;
private String user;
@Value("${spring.influx.password:''}")
private String password;
@Value("${spring.influx.database:''}")
private String database;
@Bean
public InfluxDbUtils influxDbUtils() {
return new InfluxDbUtils(userName, password, influxDBUrl, database, "autogen");
return new InfluxDbUtils(user, password, url, database, "autogen");
}
}

View File

@@ -25,14 +25,12 @@ import java.util.Map;
* @version 1.0.0
* @createTime 2022/11/28 - 10:09
*/
@Slf4j
@Service
@RequiredArgsConstructor
@Slf4j
public class DataExceptionInfluxServiceImpl implements DataExceptionInfluxService {
// private final InfluxDbUtils influxDbUtils;
private final InfluxDbUtils influxDbUtils = new InfluxDbUtils("admin", "njcnpqs", "http://192.168.1.18:8086", "pqsbase", "");
private final InfluxDbUtils influxDbUtils;
/**
* 取前四项指标相别为A

View File

@@ -31,9 +31,7 @@ import java.util.Map;
@Slf4j
public class DataIntegrityRateInfluxServiceImpl implements DataIntegrityRateInfluxService {
// private final InfluxDbUtils influxDbUtils;
private final InfluxDbUtils influxDbUtils = new InfluxDbUtils("admin", "njcnpqs", "http://192.168.1.18:8086", "pqsbase", "");
private final InfluxDbUtils influxDbUtils;
/**
* 获取data_v表五项稳态指标日数量

View File

@@ -43,8 +43,6 @@ import java.util.Objects;
@Slf4j
public class DataIntegrityRateServiceImpl implements DataIntegrityRateService {
private final InfluxDbUtils influxDbUtils;
private final RMpIntegrityDMapper rMpIntegrityDMapper;
private final DistributionMonitorClient distributionMonitorClient;