Compare commits
3 Commits
5e1e409748
...
2024-11
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
288dc53cde | ||
|
|
2d3b17a636 | ||
| a7f17cd2ef |
@@ -4,8 +4,11 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.njcn.influx.utils.InstantDateSerializer;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
@@ -17,22 +20,62 @@ import java.time.Instant;
|
||||
@Data
|
||||
public class CarryCapcityData {
|
||||
|
||||
@Column(name = "time")
|
||||
@Column(name = "time",tag = true)
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Column(name = "line_id",tag = true)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Column(name = "phasic_type",tag = true)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "quality_flag")
|
||||
private String qualityFlag;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
private Double value;
|
||||
|
||||
public static void main(String[] args) {
|
||||
String[] strs ={"eat","tea", "tan", "ate", "nat", "bat"};
|
||||
|
||||
CarryCapcityData.groupAnagrams(strs);
|
||||
}
|
||||
|
||||
public static List<List<String>> groupAnagrams(String[] strs) {
|
||||
Map<String, List<String>> collect = Arrays.stream(strs).collect(Collectors.groupingBy(temp -> {
|
||||
char[] charArray = temp.toCharArray();
|
||||
Arrays.sort(charArray);
|
||||
return new String(charArray);
|
||||
}));
|
||||
return new ArrayList<>(collect.values());
|
||||
|
||||
}
|
||||
|
||||
public int longestConsecutive(int[] nums) {
|
||||
Set<Integer> num_set = new HashSet<>();
|
||||
for (int num : nums) {
|
||||
num_set.add(num);
|
||||
}
|
||||
int longestStreak = 0;
|
||||
for (int num:
|
||||
num_set) {
|
||||
if (!num_set.contains(num - 1)) {
|
||||
int currentNum = num;
|
||||
int currentStreak = 1;
|
||||
|
||||
while (num_set.contains(currentNum + 1)) {
|
||||
currentNum += 1;
|
||||
currentStreak += 1;
|
||||
}
|
||||
|
||||
longestStreak = Math.max(longestStreak, currentStreak);
|
||||
}
|
||||
}
|
||||
return longestStreak;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.njcn.influx.utils.InstantDateSerializer;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
import org.influxdb.annotation.TimeColumn;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@@ -18,12 +19,12 @@ import java.time.Instant;
|
||||
@Data
|
||||
@Measurement(name = "evt_data")
|
||||
public class EntData {
|
||||
|
||||
@Column(name = "time")
|
||||
@TimeColumn
|
||||
@Column(name = "time",tag = true)
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "uuid")
|
||||
@Column(name = "uuid", tag = true)
|
||||
private String uuid;
|
||||
|
||||
@Column(name = "Evt_Param_Phase")
|
||||
|
||||
@@ -77,4 +77,12 @@ public interface CommonService {
|
||||
* @return
|
||||
*/
|
||||
List<StatisticalDataDTO> getTopTemperature(String lineId,String tableName, String columnName,String process);
|
||||
|
||||
/**
|
||||
* 获取监测点的指标数量,用来计算完整率
|
||||
*
|
||||
*/
|
||||
StatisticalDataDTO getCounts(String lineId, String tableName, String columnName,String resultName, String phasic, String dataType, String clDid, String process,String startTime, String endTime);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -147,6 +147,19 @@ public class CommonServiceImpl implements CommonService {
|
||||
return commonMapper.getTopTemperature(influxQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatisticalDataDTO getCounts(String lineId, String tableName, String columnName,String resultName, String phasic, String dataType, String clDid,String process,String startTime, String endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class);
|
||||
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||
.count(columnName,resultName)
|
||||
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,phasic)
|
||||
.eq(InfluxDBTableConstant.VALUE_TYPE,dataType)
|
||||
.eq(InfluxDBTableConstant.CL_DID,clDid)
|
||||
.eq(InfluxDBTableConstant.PROCESS,process)
|
||||
.between(InfluxDBTableConstant.TIME, startTime, endTime);;
|
||||
return commonMapper.getLineRtData(influxQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user