Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
H.X 2 years ago
parent
commit
e95ec548ee
  1. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java
  2. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java
  3. 30
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  4. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java
  5. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/vo/SoeDataVo.java

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java

@ -47,8 +47,8 @@ public class AbnormalAlarmController extends BladeController {
@GetMapping("/queryByEntity")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "统计通讯中断二级目录查询", notes = "传入imsDutyMainEntity")
public R<IPage<HistoryAbnormalAlarmEntity>> queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) {
IPage<HistoryAbnormalAlarmEntity> pages = service.queryByEntity(entity,query);
public R<IPage<HistoryAbnormalAlarmVo>> queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) {
IPage<HistoryAbnormalAlarmVo> pages = service.queryByEntity(entity,query);
return R.data(pages);
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java

@ -25,7 +25,7 @@ public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormal
IPage<HistoryAbnormalAlarmVo> getAlarmTime(Query query, HistoryAbnormalAlarmEntity entity);
IPage<HistoryAbnormalAlarmEntity> queryByEntity(HistoryAbnormalAlarmEntity entity,Query query);
IPage<HistoryAbnormalAlarmVo> queryByEntity(HistoryAbnormalAlarmEntity entity,Query query);
// 智能告警数量: 时间范围当天
List<IntelligentAlarmCountVo> alarmCount();

30
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java

@ -158,25 +158,45 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
private QueryWrapper<HistoryAbnormalAlarmEntity> getAlarmEntityQueryWrapper(HistoryAbnormalAlarmEntity entity) {
QueryWrapper<HistoryAbnormalAlarmEntity> queryWrapper = new QueryWrapper<>();
if (entity.getStationName() != null) {
queryWrapper.lambda().eq(HistoryAbnormalAlarmEntity::getStationName, entity.getStationName());
queryWrapper.lambda().like(HistoryAbnormalAlarmEntity::getStationName, entity.getStationName());
}
if (entity.getType() != null) {
queryWrapper.lambda().eq(HistoryAbnormalAlarmEntity::getType, entity.getType());
}
if (entity.getStartTime() != null) {
queryWrapper.lambda().le(HistoryAbnormalAlarmEntity::getStartTime, entity.getStartTime());
queryWrapper.lambda().ge(HistoryAbnormalAlarmEntity::getStartTime, entity.getStartTime());
}
if (entity.getEndTime() != null) {
queryWrapper.lambda().ge(HistoryAbnormalAlarmEntity::getStartTime, entity.getEndTime());
queryWrapper.lambda().le(HistoryAbnormalAlarmEntity::getStartTime, entity.getEndTime());
}
return queryWrapper;
}
@Override
public IPage<HistoryAbnormalAlarmEntity> queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) {
public IPage<HistoryAbnormalAlarmVo> queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) {
QueryWrapper<HistoryAbnormalAlarmEntity> alarmEntityQueryWrapper = getAlarmEntityQueryWrapper(entity);
IPage<HistoryAbnormalAlarmEntity> historyAbnormalAlarmEntityIPage = this.baseMapper.selectPage(Condition.getPage(query), alarmEntityQueryWrapper);
return historyAbnormalAlarmEntityIPage;
List<HistoryAbnormalAlarmEntity> records = historyAbnormalAlarmEntityIPage.getRecords();
List<HistoryAbnormalAlarmVo> voList =new ArrayList<>();
if (records.size()>0) {
List<HistoryAbnormalAlarmVo> historyAbnormalAlarmVos = BeanUtil.copy(records, HistoryAbnormalAlarmVo.class);
//赋值空的endTime
if (ObjectUtils.isNotEmpty(entity.getEndTime())) {
historyAbnormalAlarmVos.stream().filter(s -> s.getEndTime() == null).forEach(s -> s.setEndTime(entity.getEndTime()));
} else {
historyAbnormalAlarmVos.stream().filter(s -> s.getEndTime() == null).forEach(s -> s.setEndTime(new Date()));
}
voList= historyAbnormalAlarmVos.parallelStream().map(s -> {
long duration = s.getEndTime().getTime() - s.getStartTime().getTime();
double v = BigDecimal.valueOf(duration / (1000 * 60 * 60.00)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
s.setDuration(v);
return s;
}).collect(Collectors.toList());
}
IPage<HistoryAbnormalAlarmVo> page = Condition.getPage(query);
page.setTotal(historyAbnormalAlarmEntityIPage.getTotal());
page.setRecords(voList);
return page;
}
/**

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

@ -501,6 +501,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
iter.setServeType(stationEntity.getServeType());
}
iter.setContent(iter.getSoeExplain());
iter.setType(iter.getSoeType());
iter.setSoeType(array[Integer.valueOf(iter.getSoeType())]);
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/vo/SoeDataVo.java

@ -24,4 +24,6 @@ public class SoeDataVo extends SoeData {
private String serveType;
private String type;
}

Loading…
Cancel
Save