|
@@ -6,18 +6,14 @@ import com.influxdb.client.domain.WritePrecision;
|
|
import com.influxdb.client.write.Point;
|
|
import com.influxdb.client.write.Point;
|
|
import com.influxdb.query.FluxRecord;
|
|
import com.influxdb.query.FluxRecord;
|
|
import com.influxdb.query.FluxTable;
|
|
import com.influxdb.query.FluxTable;
|
|
-import com.platform.dao.enums.RemoteOpcTypeEnum;
|
|
|
|
import com.platform.dao.util.influxDB.InfluxDBFluxExpression;
|
|
import com.platform.dao.util.influxDB.InfluxDBFluxExpression;
|
|
import com.platform.dao.vo.query.remote.RemoteOpcVO;
|
|
import com.platform.dao.vo.query.remote.RemoteOpcVO;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-import org.apache.commons.lang.math.RandomUtils;
|
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
-import java.math.RoundingMode;
|
|
|
|
import java.time.Instant;
|
|
import java.time.Instant;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -62,7 +58,11 @@ public class InfluxDbBuilder {
|
|
for (FluxRecord record : records) {
|
|
for (FluxRecord record : records) {
|
|
RemoteOpcVO vo = new RemoteOpcVO();
|
|
RemoteOpcVO vo = new RemoteOpcVO();
|
|
vo.setTime(record.getTime().toString());
|
|
vo.setTime(record.getTime().toString());
|
|
- vo.setResult(new BigDecimal(record.getValue().toString()));
|
|
|
|
|
|
+ if(StringUtils.isEmpty(record.getValue())){
|
|
|
|
+ vo.setResult(new BigDecimal(0));
|
|
|
|
+ }else{
|
|
|
|
+ vo.setResult(new BigDecimal(record.getValue().toString()));
|
|
|
|
+ }
|
|
list.add(vo);
|
|
list.add(vo);
|
|
// log.info("{}---{}---{}---{}", record.getMeasurement(),record.getField(),record.getValue(),record.getTime());
|
|
// log.info("{}---{}---{}---{}", record.getMeasurement(),record.getField(),record.getValue(),record.getTime());
|
|
/*JSONObject object = new JSONObject();
|
|
/*JSONObject object = new JSONObject();
|
|
@@ -89,7 +89,7 @@ public class InfluxDbBuilder {
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
- int total= 1000000;
|
|
|
|
|
|
+ /*int total= 1000000;
|
|
List<RemoteOpcVO> voList = new ArrayList<>();
|
|
List<RemoteOpcVO> voList = new ArrayList<>();
|
|
for(int i =0;i<total;i++){
|
|
for(int i =0;i<total;i++){
|
|
RemoteOpcVO test = new RemoteOpcVO();
|
|
RemoteOpcVO test = new RemoteOpcVO();
|
|
@@ -101,6 +101,12 @@ public class InfluxDbBuilder {
|
|
log.info("collect.size(): " + voList.size());
|
|
log.info("collect.size(): " + voList.size());
|
|
Collections.shuffle(voList);
|
|
Collections.shuffle(voList);
|
|
List<RemoteOpcVO> newList1 =voList.stream().limit(5000).collect(Collectors.toList());
|
|
List<RemoteOpcVO> newList1 =voList.stream().limit(5000).collect(Collectors.toList());
|
|
- log.info("collect.size(): " + newList1.size());
|
|
|
|
|
|
+ log.info("collect.size(): " + newList1.size());*/
|
|
|
|
+
|
|
|
|
+ String ss = null;
|
|
|
|
+ if(StringUtils.isEmpty(ss)){
|
|
|
|
+ System.out.println(true);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|