|
@@ -105,22 +105,23 @@ public class InfluxDBServiceImpl implements InfluxDBService {
|
|
|
*
|
|
|
*/
|
|
|
@Override
|
|
|
- public RemoteOpcVO select(RemoteOpcDTO remoteOpcDTO) {
|
|
|
- RemoteOpc remoteOpc = remoteOpcMapper.selectByPrimaryKey(remoteOpcDTO.getId());
|
|
|
- RemoteOpcVO vo = BeanConverterUtil.copyObjectProperties(remoteOpc, RemoteOpcVO.class);
|
|
|
+ public RemoteOpcVO select(RemoteOpcDTO remoteOpcDTO) {;
|
|
|
StringBuffer stringBuilder = new StringBuffer();
|
|
|
- if(remoteOpcDTO.getStartTime() == null){
|
|
|
- throw new BusinessException("请选择查询开始时间");
|
|
|
+ LocalDateTime start;
|
|
|
+ LocalDateTime stop;
|
|
|
+ if(remoteOpcDTO.getStartTime() == null){// 默认当前时间的5分钟
|
|
|
+ remoteOpcDTO.setStartTime(LocalDateTime.now().minusMinutes(5));
|
|
|
}
|
|
|
- if(remoteOpcDTO.getEndTime() == null){
|
|
|
- throw new BusinessException("请选择查询截止时间");
|
|
|
+ if(remoteOpcDTO.getEndTime() == null){// 默认当前时间
|
|
|
+ remoteOpcDTO.setEndTime(LocalDateTime.now());
|
|
|
}
|
|
|
if(remoteOpcDTO.getEndTime().isAfter(LocalDateTime.now())){
|
|
|
throw new BusinessException("截止时间不能晚于当前系统时间");
|
|
|
}
|
|
|
+ start = remoteOpcDTO.getStartTime().minusHours(8);
|
|
|
+ stop = remoteOpcDTO.getEndTime().minusHours(8);
|
|
|
+ RemoteOpcVO vo = BeanConverterUtil.copyObjectProperties(remoteOpcDTO, RemoteOpcVO.class);
|
|
|
try {
|
|
|
- LocalDateTime start = remoteOpcDTO.getStartTime().minusHours(8);
|
|
|
- LocalDateTime stop = remoteOpcDTO.getEndTime().minusHours(8);
|
|
|
/*Integer type = remoteOpcDTO.getSearchDay();
|
|
|
if (type == 1) {// 5分钟
|
|
|
start = start.minusMinutes(5);
|
|
@@ -149,7 +150,7 @@ public class InfluxDBServiceImpl implements InfluxDBService {
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- InfluxDBFluxExpression.appendTagFlux(stringBuilder, remoteOpc.getPositionNum());
|
|
|
+ InfluxDBFluxExpression.appendTagFlux(stringBuilder, remoteOpcDTO.getPositionNum());
|
|
|
InfluxDBFluxExpression.appendTimeShiftFlux(stringBuilder);
|
|
|
log.info("查询sql :{}", stringBuilder);
|
|
|
// 通过时间分组 查询时间段的数据
|