|
@@ -1,8 +1,11 @@
|
|
package com.huaxu.service.impl;
|
|
package com.huaxu.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
+import com.huaxu.dao.DeviceSceneMapper;
|
|
import com.huaxu.dao.MonitorDataReportMapper;
|
|
import com.huaxu.dao.MonitorDataReportMapper;
|
|
import com.huaxu.dto.*;
|
|
import com.huaxu.dto.*;
|
|
import com.huaxu.dto.generalView.*;
|
|
import com.huaxu.dto.generalView.*;
|
|
|
|
+import com.huaxu.dto.scene.SceneIdDto;
|
|
import com.huaxu.entity.DeviceEntity;
|
|
import com.huaxu.entity.DeviceEntity;
|
|
import com.huaxu.entity.MonitorDataEntity;
|
|
import com.huaxu.entity.MonitorDataEntity;
|
|
import com.huaxu.entity.MonitorDataValueEntity;
|
|
import com.huaxu.entity.MonitorDataValueEntity;
|
|
@@ -57,6 +60,9 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
@Autowired
|
|
@Autowired
|
|
private DeviceService deviceService;
|
|
private DeviceService deviceService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private DeviceSceneMapper deviceSceneMapper;
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<MonitorDataChartReportDeviceDto> monitorDataChartReportByDay(Long sceneId, Integer year, Integer month , Integer day) {
|
|
public List<MonitorDataChartReportDeviceDto> monitorDataChartReportByDay(Long sceneId, Integer year, Integer month , Integer day) {
|
|
@@ -83,23 +89,7 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = monitorDataReportMapper.monthMonitorData(startTime, endTime,sceneId,
|
|
List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = monitorDataReportMapper.monthMonitorData(startTime, endTime,sceneId,
|
|
loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
- LocalDateTime startDate = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
- LocalDateTime endDate = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
- if (startDate.getYear() == endDate.getYear()){
|
|
|
|
- for (int i = startDate.getMonth().getValue();i <= endDate.getMonth().getValue(); i++){
|
|
|
|
- FillLoseData(monitorDataChartReportDeviceDtos,2, startDate.getYear(), i, 1);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- int start = 0;
|
|
|
|
- int end = 0;
|
|
|
|
- for (int i = startDate.getYear(); i <= endDate.getYear(); i++){
|
|
|
|
- start = i == startDate.getYear() ? startDate.getMonth().getValue() : 1;
|
|
|
|
- end = i == endDate.getYear() ? endDate.getMonthValue() : 12;
|
|
|
|
- for (int m = start;m <= end; m++){
|
|
|
|
- FillLoseData(monitorDataChartReportDeviceDtos,2, i , m,1);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ FillLoseData(startTime, endTime, monitorDataChartReportDeviceDtos);
|
|
return monitorDataChartReportDeviceDtos;
|
|
return monitorDataChartReportDeviceDtos;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -310,7 +300,12 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
public List<MonitorDataChartReportDeviceDto> monitorDataDeviceReport(Integer type, List<Long> deviceIds, Integer searchType, Integer year, Integer month , Integer day, String startTime, String endTime){
|
|
public List<MonitorDataChartReportDeviceDto> monitorDataDeviceReport(Integer type, List<Long> deviceIds, Integer searchType, Integer year, Integer month , Integer day, String startTime, String endTime){
|
|
-
|
|
|
|
|
|
+ Long sceneId =null;
|
|
|
|
+ String name = searchType == 1 ? "压力" : ((searchType == 2) ? "流量" : "水质");
|
|
|
|
+ SceneIdDto sceneIdDto = deviceSceneMapper.findSceneId("管网",name, deviceIds.get(0));
|
|
|
|
+ if (sceneIdDto != null) {
|
|
|
|
+ sceneId = sceneIdDto.getSceneId();
|
|
|
|
+ }
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = null;
|
|
List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = null;
|
|
if (type == null) {
|
|
if (type == null) {
|
|
@@ -318,18 +313,18 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
}
|
|
}
|
|
if (type == 3){
|
|
if (type == 3){
|
|
monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByDay(deviceIds,searchType,year,month,day,
|
|
monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByDay(deviceIds,searchType,year,month,day,
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList(),sceneId);
|
|
} else if(type == 2){
|
|
} else if(type == 2){
|
|
monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByMonth(deviceIds,searchType,year,month,
|
|
monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByMonth(deviceIds,searchType,year,month,
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList(),sceneId);
|
|
} else if(type == 1){
|
|
} else if(type == 1){
|
|
monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByYear(deviceIds,searchType,year,
|
|
monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByYear(deviceIds,searchType,year,
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList(),sceneId);
|
|
} else if (type == 4){
|
|
} else if (type == 4){
|
|
startTime += " 00:00:00";
|
|
startTime += " 00:00:00";
|
|
endTime += " 23:59:59";
|
|
endTime += " 23:59:59";
|
|
monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReport(deviceIds,searchType,startTime,endTime,
|
|
monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReport(deviceIds,searchType,startTime,endTime,
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList(),sceneId);
|
|
}
|
|
}
|
|
if (monitorDataChartReportDeviceDtos != null && type == 4){
|
|
if (monitorDataChartReportDeviceDtos != null && type == 4){
|
|
FillLoseData(startTime,endTime, monitorDataChartReportDeviceDtos);
|
|
FillLoseData(startTime,endTime, monitorDataChartReportDeviceDtos);
|
|
@@ -1476,5 +1471,10 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ for (MonitorDataChartReportDeviceDto dto : monitorDataChartReportDeviceDtos ) {
|
|
|
|
+ for (MonitorDataChartReportAttributeDto attributeDto : dto.getAttributeData() ) {
|
|
|
|
+ Collections.sort(attributeDto.getMonitorDataChartReportValue());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|