|
|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
import com.xunmei.common.core.domain.iot.domain.IotDvrDisk;
|
|
|
+import com.xunmei.common.core.enums.CategoryDataEnum;
|
|
|
import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
import com.xunmei.iot.dto.dvrDisk.DvrDiskAlarmHistoryPageDto;
|
|
|
import com.xunmei.iot.dto.dvrDisk.DvrDiskPageDto;
|
|
|
@@ -17,6 +18,7 @@ import com.xunmei.iot.service.IotDvsDiskService;
|
|
|
import com.xunmei.iot.vo.dvrDisk.DvrDiskPageVo;
|
|
|
import com.xunmei.iot.vo.dvrDisk.DetailVo;
|
|
|
import com.xunmei.iot.vo.dvrDisk.DvrDiskAlarmHistoryPageVo;
|
|
|
+import com.xunmei.iot.vo.dvrDisk.DvrDiskStatisticVo;
|
|
|
import com.xunmei.system.api.RemoteOrgService;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -29,7 +31,7 @@ import java.util.TimeZone;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 服务实现类
|
|
|
+ * 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
* @author oygj
|
|
|
@@ -49,32 +51,61 @@ public class IotDvrDiskServiceImpl extends ServiceImpl<IotDvrDiskMapper, IotDvrD
|
|
|
Date endTime = new DateTime(request.getAlarmTime()[1]).setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
request.setAlarmEndTime(DateUtil.endOfDay(endTime));
|
|
|
}
|
|
|
- if(StringUtils.isEmpty(request.getDiskName())){
|
|
|
+ if (StringUtils.isEmpty(request.getDiskName())) {
|
|
|
request.setDiskName(null);
|
|
|
}
|
|
|
- Page<DvrDiskAlarmHistoryPageVo> page =request.toPage();
|
|
|
- page= baseMapper.getRecordAlarmHistoryList(page,request);
|
|
|
- page.getRecords().forEach(c->{
|
|
|
- if(StringUtils.isNotEmpty(c.getAlarmDetail())){
|
|
|
- DetailVo detailVo= JSON.parseObject(c.getAlarmDetail() , DetailVo.class);
|
|
|
- c.setDiskName(detailVo.getName());
|
|
|
- c.setDiskIndex(detailVo.getIndex());
|
|
|
+ Page<DvrDiskAlarmHistoryPageVo> page = request.toPage();
|
|
|
+ page = baseMapper.getRecordAlarmHistoryList(page, request);
|
|
|
+ page.getRecords().forEach(c -> {
|
|
|
+ if (StringUtils.isNotEmpty(c.getAlarmDetail())) {
|
|
|
+ DetailVo detailVo = JSON.parseObject(c.getAlarmDetail(), DetailVo.class);
|
|
|
+ c.setDiskName(detailVo.getName());
|
|
|
+ c.setDiskIndex(detailVo.getIndex());
|
|
|
}
|
|
|
});
|
|
|
return TableDataInfo.success(page);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public TableDataInfo<DvrDiskPageVo> selectAlarmHostStatus(@Param("pageDto") DvrDiskPageDto pageDto){
|
|
|
|
|
|
- String orgPath="";
|
|
|
- if(pageDto.getCheckSub()){
|
|
|
- SysOrg org= orgService.selectOrgById(pageDto.getOrgId(), SecurityConstants.INNER);
|
|
|
- orgPath=org.getPath();
|
|
|
+ @Override
|
|
|
+ public TableDataInfo<DvrDiskPageVo> selectHostPage(@Param("pageDto") DvrDiskPageDto pageDto) {
|
|
|
+ String orgPath = "";
|
|
|
+ if (pageDto.getCheckSub()) {
|
|
|
+ SysOrg org = orgService.selectOrgById(pageDto.getOrgId(), SecurityConstants.INNER);
|
|
|
+ orgPath = org.getPath();
|
|
|
}
|
|
|
- Page<DvrDiskPageVo> page =pageDto.toPage();
|
|
|
- page=baseMapper.selectHostPage(page,pageDto,orgPath);
|
|
|
+ pageDto.setCategoryId(CategoryDataEnum.MONITOR_HOST_DEVICE.getId());
|
|
|
+ Page<DvrDiskPageVo> page = pageDto.toPage();
|
|
|
+
|
|
|
+ page = baseMapper.selectHostPage(page, pageDto, orgPath);
|
|
|
+ page.getRecords().forEach(r -> {
|
|
|
+ if (ObjectUtil.isNotNull(r.getNetState())) {
|
|
|
+ r.setNetStateStr(r.getNetState().getText());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(r.getDiskInfos())) {
|
|
|
+ r.setDiskCount(r.getDiskInfos().size());
|
|
|
+ r.setDiskExceptionCount((int) r.getDiskInfos().stream().filter(di -> ObjectUtil.equal(di.getState(), 1)).count());
|
|
|
+ r.setDiskTotalSize(r.getDiskInfos().stream().mapToInt(di -> di.getTotal()).sum());
|
|
|
+ int available = r.getDiskInfos().stream().mapToInt(di -> di.getAvailable()).sum();
|
|
|
+ r.setDiskUsedSize(r.getDiskTotalSize() - available);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ });
|
|
|
return TableDataInfo.success(page);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public DvrDiskStatisticVo diskStatistic(DvrDiskPageDto pageDto) {
|
|
|
+ String orgPath = "";
|
|
|
+ if (pageDto.getCheckSub()) {
|
|
|
+ SysOrg org = orgService.selectOrgById(pageDto.getOrgId(), SecurityConstants.INNER);
|
|
|
+ orgPath = org.getPath();
|
|
|
+ }
|
|
|
+ pageDto.setCategoryId(CategoryDataEnum.MONITOR_HOST_DEVICE.getId());
|
|
|
+ DvrDiskStatisticVo vo = baseMapper.diskStatistic(pageDto, orgPath);
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
}
|