暂降系统优化influxdb转mysql

This commit is contained in:
wurui
2023-03-31 10:28:39 +08:00
parent 8c3ae3ef2b
commit 6237a7b656
23 changed files with 1619 additions and 1686 deletions

View File

@@ -78,7 +78,7 @@ public class HistoryResultServiceImpl implements HistoryResultService {
List<EventDetailVO> eventDetailVOList = new ArrayList<>();
if (!eventDetailList.isEmpty()) {
for (EventDetail eventdetail : eventDetailList) {
Instant now = eventdetail.getTimeId();
Instant now = eventdetail.getStartTime();
Long time = now.toEpochMilli();
String timeText = format.format(time);
EventDetailVO eventDetailVO = new EventDetailVO();

View File

@@ -673,10 +673,10 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
private List<PublicDTO> getLineDate(List<String> line, String startTime, String endTime, String type) {
List<PublicDTO> result = new ArrayList<>();
String quota = "";
if (Objects.equals(type, DicDataEnum.XBDY_ENUM.getCode())) {
quota = "harmonic_v";
} else if (Objects.equals(type, DicDataEnum.XBDL_ENUM.getCode())) {
quota = "harmonic_i";
if (Objects.equals(type, DicDataEnum.V_HARMONIC.getCode())) {
quota = ",harmonic_v";
} else if (Objects.equals(type, DicDataEnum.I_ALL.getCode())) {
quota = ",harmonic_i";
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(Param.TIME).append(" >= '").append(startTime).append(Param.START_TIME).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append(Param.END_TIME).append("' and (");
@@ -688,7 +688,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
}
}
stringBuilder.append(" group by line_id order by time desc limit 1 tz('Asia/Shanghai')");
String sql = "SELECT line_id," + quota + " FROM harmonic_pollution where " + stringBuilder;
String sql = "SELECT line_id" + quota + " FROM harmonic_pollution where " + stringBuilder;
QueryResult sqlResult = influxDbUtils.query(sql);
List<QueryResult.Series> list = sqlResult.getResults().get(0).getSeries();
if (!CollectionUtils.isEmpty(list)) {