diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java new file mode 100644 index 0000000..0740b40 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java @@ -0,0 +1,18 @@ +package com.newfiber.termite.domain; + +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "历史告警记录统计", description = "历史告警记录统计") +public class MonitoringWarnResponseStatistics extends BaseEntity { + @ApiModelProperty(value = "项目编号") + private String projectCode; + + + @ApiModelProperty(value = "告警数统计") + private Long snCount; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java new file mode 100644 index 0000000..0740b40 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java @@ -0,0 +1,18 @@ +package com.newfiber.termite.domain; + +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "历史告警记录统计", description = "历史告警记录统计") +public class MonitoringWarnResponseStatistics extends BaseEntity { + @ApiModelProperty(value = "项目编号") + private String projectCode; + + + @ApiModelProperty(value = "告警数统计") + private Long snCount; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java index 3d924a5..bb26eea 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.List; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; import com.newfiber.termite.domain.MonitoringWarnRecord; import org.apache.ibatis.annotations.Mapper; @@ -32,4 +33,7 @@ */ MonitoringWarnRecord selectOneById(@Param("id") Long id); + + List selectListTotal(@Param("request") MonitoringWarnRecordQueryRequest request); + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java new file mode 100644 index 0000000..0740b40 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java @@ -0,0 +1,18 @@ +package com.newfiber.termite.domain; + +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "历史告警记录统计", description = "历史告警记录统计") +public class MonitoringWarnResponseStatistics extends BaseEntity { + @ApiModelProperty(value = "项目编号") + private String projectCode; + + + @ApiModelProperty(value = "告警数统计") + private Long snCount; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java index 3d924a5..bb26eea 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.List; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; import com.newfiber.termite.domain.MonitoringWarnRecord; import org.apache.ibatis.annotations.Mapper; @@ -32,4 +33,7 @@ */ MonitoringWarnRecord selectOneById(@Param("id") Long id); + + List selectListTotal(@Param("request") MonitoringWarnRecordQueryRequest request); + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java index f4cf7a2..85c0812 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java @@ -2,6 +2,7 @@ import java.util.List; import com.newfiber.termite.domain.MonitoringWarnRecord; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordSaveRequest; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordUpdateRequest; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; @@ -62,4 +63,11 @@ */ List selectList(MonitoringWarnRecordQueryRequest request); + /** + * 查询历史告警记录统计 + * + * @param request 列表参数 + * @return 历史告警记录统计 + */ + List selectListTotal(MonitoringWarnRecordQueryRequest request); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java new file mode 100644 index 0000000..0740b40 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java @@ -0,0 +1,18 @@ +package com.newfiber.termite.domain; + +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "历史告警记录统计", description = "历史告警记录统计") +public class MonitoringWarnResponseStatistics extends BaseEntity { + @ApiModelProperty(value = "项目编号") + private String projectCode; + + + @ApiModelProperty(value = "告警数统计") + private Long snCount; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java index 3d924a5..bb26eea 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.List; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; import com.newfiber.termite.domain.MonitoringWarnRecord; import org.apache.ibatis.annotations.Mapper; @@ -32,4 +33,7 @@ */ MonitoringWarnRecord selectOneById(@Param("id") Long id); + + List selectListTotal(@Param("request") MonitoringWarnRecordQueryRequest request); + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java index f4cf7a2..85c0812 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java @@ -2,6 +2,7 @@ import java.util.List; import com.newfiber.termite.domain.MonitoringWarnRecord; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordSaveRequest; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordUpdateRequest; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; @@ -62,4 +63,11 @@ */ List selectList(MonitoringWarnRecordQueryRequest request); + /** + * 查询历史告警记录统计 + * + * @param request 列表参数 + * @return 历史告警记录统计 + */ + List selectListTotal(MonitoringWarnRecordQueryRequest request); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java index b1ec899..4e3ee81 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java @@ -7,6 +7,7 @@ import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.exception.ServiceException; import com.newfiber.common.core.web.service.BaseServiceImpl; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; @@ -70,4 +71,9 @@ return monitoringWarnRecordMapper.selectByCondition(request); } + @Override + public List selectListTotal(MonitoringWarnRecordQueryRequest request) { + return monitoringWarnRecordMapper.selectListTotal(request); + } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java new file mode 100644 index 0000000..0740b40 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java @@ -0,0 +1,18 @@ +package com.newfiber.termite.domain; + +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "历史告警记录统计", description = "历史告警记录统计") +public class MonitoringWarnResponseStatistics extends BaseEntity { + @ApiModelProperty(value = "项目编号") + private String projectCode; + + + @ApiModelProperty(value = "告警数统计") + private Long snCount; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java index 3d924a5..bb26eea 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.List; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; import com.newfiber.termite.domain.MonitoringWarnRecord; import org.apache.ibatis.annotations.Mapper; @@ -32,4 +33,7 @@ */ MonitoringWarnRecord selectOneById(@Param("id") Long id); + + List selectListTotal(@Param("request") MonitoringWarnRecordQueryRequest request); + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java index f4cf7a2..85c0812 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java @@ -2,6 +2,7 @@ import java.util.List; import com.newfiber.termite.domain.MonitoringWarnRecord; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordSaveRequest; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordUpdateRequest; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; @@ -62,4 +63,11 @@ */ List selectList(MonitoringWarnRecordQueryRequest request); + /** + * 查询历史告警记录统计 + * + * @param request 列表参数 + * @return 历史告警记录统计 + */ + List selectListTotal(MonitoringWarnRecordQueryRequest request); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java index b1ec899..4e3ee81 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java @@ -7,6 +7,7 @@ import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.exception.ServiceException; import com.newfiber.common.core.web.service.BaseServiceImpl; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; @@ -70,4 +71,9 @@ return monitoringWarnRecordMapper.selectByCondition(request); } + @Override + public List selectListTotal(MonitoringWarnRecordQueryRequest request) { + return monitoringWarnRecordMapper.selectListTotal(request); + } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index fa9c693..e667880 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -1,10 +1,6 @@ package com.newfiber.termite.service.impl; -import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.DeviceMonitoringData; -import com.newfiber.termite.domain.DeviceMonitoringDataRealtime; -import com.newfiber.termite.domain.MonitoringWarnRecord; -import com.newfiber.termite.domain.ProjectInfo; +import com.newfiber.termite.domain.*; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; import com.newfiber.termite.domain.request.deviceMonitoringDataRealtime.DeviceMonitoringDataRealtimeQueryRequest; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; @@ -142,7 +138,9 @@ // TODO 历史告警 MonitoringWarnRecordQueryRequest monitoringWarnRecordQueryRequest = new MonitoringWarnRecordQueryRequest(); monitoringWarnRecordQueryRequest.setProjectCodeList(projectCodeList); - List monitoringWarnRecordList = monitoringWarnRecordService.selectList(monitoringWarnRecordQueryRequest); + List monitoringWarnRecordList = monitoringWarnRecordService.selectListTotal(monitoringWarnRecordQueryRequest); + + // List monitoringWarnRecordList = monitoringWarnRecordService.selectList(monitoringWarnRecordQueryRequest); // 实时监测数据 DeviceMonitoringDataRealtimeQueryRequest deviceMonitoringDataRealtimeQueryRequest = new DeviceMonitoringDataRealtimeQueryRequest(); @@ -155,8 +153,8 @@ for(ProjectInfo projectInfo : projectInfoSet){ List projectDeviceInfoList = deviceInfoList.stream().filter(t -> t.getProjectCode().equals(projectInfo.getProjectCode())).collect(Collectors.toList()); - List projectMonitoringWarnRecordList = monitoringWarnRecordList.stream().filter(t -> - t.getProjectCode().equals(projectInfo.getProjectCode())).collect(Collectors.toList()); +// List projectMonitoringWarnRecordList = monitoringWarnRecordList.stream().filter(t -> +// t.getProjectCode().equals(projectInfo.getProjectCode())).collect(Collectors.toList()); List projectDeviceMonitoringDataRealtimeList = deviceMonitoringDataRealtimeList.stream().filter(t -> t.getProjectCode().equals(projectInfo.getProjectCode())).collect(Collectors.toList()); @@ -167,8 +165,14 @@ projectStatisticDetail.setProjectName(projectInfo.getProjectName()); projectStatisticDetail.setDeviceCount(projectDeviceInfoList.size()); projectStatisticDetail.setWarnCountRealtime(warnCountRealtime); - projectStatisticDetail.setWarnCountHistory(projectMonitoringWarnRecordList.stream().map(MonitoringWarnRecord::getSn).distinct().count()); + for (MonitoringWarnResponseStatistics monitoringWarnResponseStatistics : monitoringWarnRecordList) { + if(monitoringWarnResponseStatistics.getProjectCode() == projectInfo.getProjectCode()){ + projectStatisticDetail.setWarnCountHistory(monitoringWarnResponseStatistics.getSnCount()); + } + } + + // projectStatisticDetail.setWarnCountHistory(projectMonitoringWarnRecordList.stream().map(MonitoringWarnRecord::getSn).distinct().count()); Optional firstWarnDatetimeDevice = projectDeviceInfoList.stream().max(Comparator.comparing(DeviceInfo::getFirstWarnDatetime)); firstWarnDatetimeDevice.ifPresent(deviceInfo -> projectStatisticDetail.setFirstWarnDatetime(deviceInfo.getFirstWarnDatetime())); diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java new file mode 100644 index 0000000..0740b40 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/MonitoringWarnResponseStatistics.java @@ -0,0 +1,18 @@ +package com.newfiber.termite.domain; + +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +@ApiModel(value = "历史告警记录统计", description = "历史告警记录统计") +public class MonitoringWarnResponseStatistics extends BaseEntity { + @ApiModelProperty(value = "项目编号") + private String projectCode; + + + @ApiModelProperty(value = "告警数统计") + private Long snCount; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java index 3d924a5..bb26eea 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/MonitoringWarnRecordMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.List; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; import com.newfiber.termite.domain.MonitoringWarnRecord; import org.apache.ibatis.annotations.Mapper; @@ -32,4 +33,7 @@ */ MonitoringWarnRecord selectOneById(@Param("id") Long id); + + List selectListTotal(@Param("request") MonitoringWarnRecordQueryRequest request); + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java index f4cf7a2..85c0812 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IMonitoringWarnRecordService.java @@ -2,6 +2,7 @@ import java.util.List; import com.newfiber.termite.domain.MonitoringWarnRecord; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordSaveRequest; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordUpdateRequest; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; @@ -62,4 +63,11 @@ */ List selectList(MonitoringWarnRecordQueryRequest request); + /** + * 查询历史告警记录统计 + * + * @param request 列表参数 + * @return 历史告警记录统计 + */ + List selectListTotal(MonitoringWarnRecordQueryRequest request); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java index b1ec899..4e3ee81 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/MonitoringWarnRecordServiceImpl.java @@ -7,6 +7,7 @@ import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.exception.ServiceException; import com.newfiber.common.core.web.service.BaseServiceImpl; +import com.newfiber.termite.domain.MonitoringWarnResponseStatistics; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; @@ -70,4 +71,9 @@ return monitoringWarnRecordMapper.selectByCondition(request); } + @Override + public List selectListTotal(MonitoringWarnRecordQueryRequest request) { + return monitoringWarnRecordMapper.selectListTotal(request); + } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index fa9c693..e667880 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -1,10 +1,6 @@ package com.newfiber.termite.service.impl; -import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.DeviceMonitoringData; -import com.newfiber.termite.domain.DeviceMonitoringDataRealtime; -import com.newfiber.termite.domain.MonitoringWarnRecord; -import com.newfiber.termite.domain.ProjectInfo; +import com.newfiber.termite.domain.*; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; import com.newfiber.termite.domain.request.deviceMonitoringDataRealtime.DeviceMonitoringDataRealtimeQueryRequest; import com.newfiber.termite.domain.request.monitoringWarnRecord.MonitoringWarnRecordQueryRequest; @@ -142,7 +138,9 @@ // TODO 历史告警 MonitoringWarnRecordQueryRequest monitoringWarnRecordQueryRequest = new MonitoringWarnRecordQueryRequest(); monitoringWarnRecordQueryRequest.setProjectCodeList(projectCodeList); - List monitoringWarnRecordList = monitoringWarnRecordService.selectList(monitoringWarnRecordQueryRequest); + List monitoringWarnRecordList = monitoringWarnRecordService.selectListTotal(monitoringWarnRecordQueryRequest); + + // List monitoringWarnRecordList = monitoringWarnRecordService.selectList(monitoringWarnRecordQueryRequest); // 实时监测数据 DeviceMonitoringDataRealtimeQueryRequest deviceMonitoringDataRealtimeQueryRequest = new DeviceMonitoringDataRealtimeQueryRequest(); @@ -155,8 +153,8 @@ for(ProjectInfo projectInfo : projectInfoSet){ List projectDeviceInfoList = deviceInfoList.stream().filter(t -> t.getProjectCode().equals(projectInfo.getProjectCode())).collect(Collectors.toList()); - List projectMonitoringWarnRecordList = monitoringWarnRecordList.stream().filter(t -> - t.getProjectCode().equals(projectInfo.getProjectCode())).collect(Collectors.toList()); +// List projectMonitoringWarnRecordList = monitoringWarnRecordList.stream().filter(t -> +// t.getProjectCode().equals(projectInfo.getProjectCode())).collect(Collectors.toList()); List projectDeviceMonitoringDataRealtimeList = deviceMonitoringDataRealtimeList.stream().filter(t -> t.getProjectCode().equals(projectInfo.getProjectCode())).collect(Collectors.toList()); @@ -167,8 +165,14 @@ projectStatisticDetail.setProjectName(projectInfo.getProjectName()); projectStatisticDetail.setDeviceCount(projectDeviceInfoList.size()); projectStatisticDetail.setWarnCountRealtime(warnCountRealtime); - projectStatisticDetail.setWarnCountHistory(projectMonitoringWarnRecordList.stream().map(MonitoringWarnRecord::getSn).distinct().count()); + for (MonitoringWarnResponseStatistics monitoringWarnResponseStatistics : monitoringWarnRecordList) { + if(monitoringWarnResponseStatistics.getProjectCode() == projectInfo.getProjectCode()){ + projectStatisticDetail.setWarnCountHistory(monitoringWarnResponseStatistics.getSnCount()); + } + } + + // projectStatisticDetail.setWarnCountHistory(projectMonitoringWarnRecordList.stream().map(MonitoringWarnRecord::getSn).distinct().count()); Optional firstWarnDatetimeDevice = projectDeviceInfoList.stream().max(Comparator.comparing(DeviceInfo::getFirstWarnDatetime)); firstWarnDatetimeDevice.ifPresent(deviceInfo -> projectStatisticDetail.setFirstWarnDatetime(deviceInfo.getFirstWarnDatetime())); diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml index de8135b..e05c263 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/MonitoringWarnRecordMapper.xml @@ -100,6 +100,16 @@ order by t.${request.orderBy} + + + +