|
@@ -1358,23 +1358,38 @@ public class ProjectService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
KwsAlarmDetailMapper alarmDetailMapper;
|
|
KwsAlarmDetailMapper alarmDetailMapper;
|
|
|
|
|
|
|
|
- public HttpResult dataScreening(String projectId) {
|
|
|
|
|
|
|
+ public HttpResult dataScreening(String projectId, String companyId) {
|
|
|
DataScreeningVO vo = new DataScreeningVO();
|
|
DataScreeningVO vo = new DataScreeningVO();
|
|
|
LambdaQueryWrapper<KwsProject> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<KwsProject> wrapper = new LambdaQueryWrapper<>();
|
|
|
- LambdaQueryWrapper<KwsProjectArea> wrapperProjectArea = new LambdaQueryWrapper<>();
|
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(projectId)) {
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(projectId)) {
|
|
|
wrapper.eq(KwsProject::getId, Long.parseLong(projectId));
|
|
wrapper.eq(KwsProject::getId, Long.parseLong(projectId));
|
|
|
}
|
|
}
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(companyId)) {
|
|
|
|
|
+ wrapper.eq(KwsProject::getCompanyId, Long.parseLong(companyId));
|
|
|
|
|
+ }
|
|
|
long count = projectMapper.selectList(wrapper.eq(KwsProject::getDelFlag, 0)).stream().count();
|
|
long count = projectMapper.selectList(wrapper.eq(KwsProject::getDelFlag, 0)).stream().count();
|
|
|
vo.setProjectTotal(count);
|
|
vo.setProjectTotal(count);
|
|
|
- int deviceCount = deviceMapper.selectCountByProject(projectId);
|
|
|
|
|
|
|
+ int deviceCount = deviceMapper.selectCountByProject(projectId, companyId);
|
|
|
vo.setDeviceTotal(deviceCount);
|
|
vo.setDeviceTotal(deviceCount);
|
|
|
|
|
+ List<KwsProject> projectList = projectMapper.selectList(new LambdaQueryWrapper<KwsProject>()
|
|
|
|
|
+ .eq(org.apache.commons.lang3.StringUtils.isNotBlank(projectId), KwsProject::getId, Long.parseLong(projectId))
|
|
|
|
|
+ .eq(org.apache.commons.lang3.StringUtils.isNotBlank(companyId), KwsProject::getCompanyId, Long.parseLong(companyId))
|
|
|
|
|
+ );
|
|
|
|
|
+ List<Long> projectIdList = new ArrayList<>();
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(projectList)) {
|
|
|
|
|
+ projectIdList = projectList.stream().map(KwsProject::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
//统计全部面积
|
|
//统计全部面积
|
|
|
- BigDecimal area = projectAreaMapper.selectList(wrapperProjectArea.eq(KwsProjectArea::getDelFlag, 0)).stream().map(KwsProjectArea::getArea).reduce(BigDecimal.ZERO,
|
|
|
|
|
|
|
+ LambdaQueryWrapper<KwsProjectArea> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ queryWrapper.eq(KwsProjectArea::getDelFlag, 0);
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(projectIdList) && projectIdList.size() > 0) {
|
|
|
|
|
+ queryWrapper.in(KwsProjectArea::getProjectId, projectIdList);
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal area = projectAreaMapper.selectList(queryWrapper).stream().map(KwsProjectArea::getArea).reduce(BigDecimal.ZERO,
|
|
|
BigDecimal::add);
|
|
BigDecimal::add);
|
|
|
vo.setProjectTotalArea(area);
|
|
vo.setProjectTotalArea(area);
|
|
|
/**仅统计设备在线的数据*/
|
|
/**仅统计设备在线的数据*/
|
|
|
- int deviceOnline = deviceMapper.selectDeviceOnlineRateCountByProject(projectId);
|
|
|
|
|
|
|
+ int deviceOnline = deviceMapper.selectDeviceOnlineRateCountByProject(projectId, companyId);
|
|
|
BigDecimal deviceOnlineRate = new BigDecimal("0.00");
|
|
BigDecimal deviceOnlineRate = new BigDecimal("0.00");
|
|
|
if (deviceOnline != 0) {
|
|
if (deviceOnline != 0) {
|
|
|
deviceOnlineRate = new BigDecimal(deviceOnline).divide(new BigDecimal(deviceCount), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100.00"));
|
|
deviceOnlineRate = new BigDecimal(deviceOnline).divide(new BigDecimal(deviceCount), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100.00"));
|
|
@@ -1393,6 +1408,7 @@ public class ProjectService {
|
|
|
}
|
|
}
|
|
|
List<KwsAlarm> kwsAlarmsCount = alarmMapper.selectList(new LambdaQueryWrapper<KwsAlarm>()
|
|
List<KwsAlarm> kwsAlarmsCount = alarmMapper.selectList(new LambdaQueryWrapper<KwsAlarm>()
|
|
|
.eq(org.apache.commons.lang3.StringUtils.isNotBlank(mountainId), KwsAlarm::getMountainId, mountainId)
|
|
.eq(org.apache.commons.lang3.StringUtils.isNotBlank(mountainId), KwsAlarm::getMountainId, mountainId)
|
|
|
|
|
+ .eq(org.apache.commons.lang3.StringUtils.isNotBlank(companyId), KwsAlarm::getCompanyId, companyId)
|
|
|
.eq(KwsAlarm::getStatus, 0)
|
|
.eq(KwsAlarm::getStatus, 0)
|
|
|
.eq(KwsAlarm::getDelFlag, 0)
|
|
.eq(KwsAlarm::getDelFlag, 0)
|
|
|
);
|
|
);
|
|
@@ -1404,12 +1420,14 @@ public class ProjectService {
|
|
|
vo.setAlarmTotal(alarmTotal);
|
|
vo.setAlarmTotal(alarmTotal);
|
|
|
List<KwsAlarmDetail> unreadKwsAlarms = alarmDetailMapper.selectList(new LambdaQueryWrapper<KwsAlarmDetail>()
|
|
List<KwsAlarmDetail> unreadKwsAlarms = alarmDetailMapper.selectList(new LambdaQueryWrapper<KwsAlarmDetail>()
|
|
|
.eq(org.apache.commons.lang3.StringUtils.isNotBlank(mountainId), KwsAlarmDetail::getMountainId, mountainId)
|
|
.eq(org.apache.commons.lang3.StringUtils.isNotBlank(mountainId), KwsAlarmDetail::getMountainId, mountainId)
|
|
|
|
|
+ .eq(org.apache.commons.lang3.StringUtils.isNotBlank(companyId), KwsAlarmDetail::getCompanyId, companyId)
|
|
|
.eq(KwsAlarmDetail::getStatus, 0)
|
|
.eq(KwsAlarmDetail::getStatus, 0)
|
|
|
.eq(KwsAlarmDetail::getDelFlag, 0)
|
|
.eq(KwsAlarmDetail::getDelFlag, 0)
|
|
|
);
|
|
);
|
|
|
vo.setUnreadAlarmTotal(CollectionUtils.isEmpty(unreadKwsAlarms) ? 0 : unreadKwsAlarms.size());
|
|
vo.setUnreadAlarmTotal(CollectionUtils.isEmpty(unreadKwsAlarms) ? 0 : unreadKwsAlarms.size());
|
|
|
List<KwsAlarm> oneThresholdAlarm = alarmMapper.selectList(new LambdaQueryWrapper<KwsAlarm>()
|
|
List<KwsAlarm> oneThresholdAlarm = alarmMapper.selectList(new LambdaQueryWrapper<KwsAlarm>()
|
|
|
.eq(org.apache.commons.lang3.StringUtils.isNotBlank(mountainId), KwsAlarm::getMountainId, mountainId)
|
|
.eq(org.apache.commons.lang3.StringUtils.isNotBlank(mountainId), KwsAlarm::getMountainId, mountainId)
|
|
|
|
|
+ .eq(org.apache.commons.lang3.StringUtils.isNotBlank(companyId), KwsAlarm::getCompanyId, companyId)
|
|
|
.eq(KwsAlarm::getLevel, NumberConstant.ONE)
|
|
.eq(KwsAlarm::getLevel, NumberConstant.ONE)
|
|
|
);
|
|
);
|
|
|
int oneAlarmTotal = 0;
|
|
int oneAlarmTotal = 0;
|
|
@@ -1420,6 +1438,7 @@ public class ProjectService {
|
|
|
vo.setOneAlarmTotal(oneAlarmTotal);
|
|
vo.setOneAlarmTotal(oneAlarmTotal);
|
|
|
List<KwsAlarmDetail> kwsAlarms = alarmDetailMapper.selectList(new LambdaQueryWrapper<KwsAlarmDetail>()
|
|
List<KwsAlarmDetail> kwsAlarms = alarmDetailMapper.selectList(new LambdaQueryWrapper<KwsAlarmDetail>()
|
|
|
.eq(org.apache.commons.lang3.StringUtils.isNotBlank(mountainId), KwsAlarmDetail::getMountainId, mountainId)
|
|
.eq(org.apache.commons.lang3.StringUtils.isNotBlank(mountainId), KwsAlarmDetail::getMountainId, mountainId)
|
|
|
|
|
+ .eq(org.apache.commons.lang3.StringUtils.isNotBlank(companyId), KwsAlarmDetail::getCompanyId, companyId)
|
|
|
.eq(KwsAlarmDetail::getDelFlag, 0)
|
|
.eq(KwsAlarmDetail::getDelFlag, 0)
|
|
|
.gt(KwsAlarmDetail::getCreateTime, localDateTimeStart).lt(KwsAlarmDetail::getCreateTime, localDateTimeEnd)
|
|
.gt(KwsAlarmDetail::getCreateTime, localDateTimeStart).lt(KwsAlarmDetail::getCreateTime, localDateTimeEnd)
|
|
|
);
|
|
);
|