diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java index 74a49b0..79bddc2 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java @@ -2,6 +2,7 @@ package com.hnac.hzims.operational.alert.vo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; +import io.swagger.models.auth.In; import lombok.Data; import org.springblade.core.tool.utils.DateUtil; import org.springframework.format.annotation.DateTimeFormat; @@ -28,9 +29,15 @@ public class AlarmMergeVo{ @ApiModelProperty("告警编号") private String alarmCode; + @ApiModelProperty("告警等级") + private String level; + @ApiModelProperty("告警类型") private String type; + @ApiModelProperty("类型:0-系统告警、2-智能告警") + private Integer alarmType; + @ApiModelProperty("告警内容") private String content; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/DutyGroupVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/DutyGroupVo.java index 3844d02..5ea4db1 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/DutyGroupVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/DutyGroupVo.java @@ -19,24 +19,7 @@ public class DutyGroupVo { @ApiModelProperty("区域名称") private String areaName; - @ApiModelProperty("工作票数量") + @ApiModelProperty("数量") @JsonSerialize(nullsUsing = NullSerializer.class) - private Integer work; - - @ApiModelProperty("操作票数量") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Integer operateoperate; - - @ApiModelProperty("巡检任务数量") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Integer inspect; - - - @ApiModelProperty("消缺数量") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Integer defect; - - @ApiModelProperty("定期工作数量") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Integer regularly; + private Integer count; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java index b492f7e..30f464f 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java @@ -266,7 +266,7 @@ public interface HomePageConstant { * 有功功率 **/ String PV_LOAD = "active_power"; - /** + /**1 * 正向无功 **/ String PV_REACTIVE_POWER = "reactive_power"; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryLevelAlarmMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryLevelAlarmMapper.java index 19eb927..9eb6c3b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryLevelAlarmMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryLevelAlarmMapper.java @@ -1,11 +1,11 @@ package com.hnac.hzims.operational.alert.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity; -import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; /** * @author YSJ */ -public interface HistoryLevelAlarmMapper extends UserDataScopeBaseMapper { +public interface HistoryLevelAlarmMapper extends BaseMapper { } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java index ab5864c..ad687cb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java @@ -81,7 +81,7 @@ public class AlertMerageServiceImpl implements AlarmMergeService { List alarms = new ArrayList<>(); if(CollectionUtil.isNotEmpty(faults)){ alarms.addAll(faults.stream().filter(o -> CollectionUtil.isEmpty(handles) - || !handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(o.getAlarmId())). + || !handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(o.getAlarmId().toString())). map(fault->{ AlarmMergeVo alarm = new AlarmMergeVo(); alarm.setStationCode(fault.getStationId()); @@ -91,6 +91,7 @@ public class AlertMerageServiceImpl implements AlarmMergeService { alarm.setRealId(fault.getRealId()); alarm.setAlarmCode(String.valueOf(fault.getAlarmId())); alarm.setType(fault.getType()); + alarm.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); return alarm; }).collect(Collectors.toList())); } @@ -111,8 +112,10 @@ public class AlertMerageServiceImpl implements AlarmMergeService { alarm.setContent(level.getSoeExplain()); alarm.setDate(level.getAlarmTime()); alarm.setRealId(level.getRealId()); + alarm.setLevel(level.getAlarmLevel()); alarm.setAlarmCode(level.getAlarmId()); alarm.setType(level.getType()); + alarm.setAlarmType(AbnormalAlarmConstant.INTELLIGENCE_ALARM); return alarm; }).collect(Collectors.toList())); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java index 9445c1f..a0cd6d6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java @@ -60,9 +60,6 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl s.getEndTime() == null).forEach(s -> s.setEndTime(new Date())); } - List voList = historyAbnormalAlarmVos.parallelStream().map(s -> { - s.setTimes((s.getEndTime().getTime() - s.getStartTime().getTime())); - return s; - }).collect(Collectors.toList()); + List voList = historyAbnormalAlarmVos.parallelStream().peek(s -> s.setTimes((s.getEndTime().getTime() - s.getStartTime().getTime()))).collect(Collectors.toList()); //次数统计 Map timesList = voList.stream().collect(Collectors.groupingBy(HistoryAbnormalAlarmEntity::getStationName, Collectors.counting())); @@ -166,7 +160,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); if (entity.getStationName() != null) { String[] list = entity.getStationName().split(","); - queryWrapper.lambda().in(HistoryAbnormalAlarmEntity::getStationName, list); + queryWrapper.lambda().in(HistoryAbnormalAlarmEntity::getStationName, Arrays.stream(list).collect(Collectors.toList())); } if (entity.getType() != null) { queryWrapper.lambda().eq(HistoryAbnormalAlarmEntity::getType, entity.getType()); @@ -194,11 +188,10 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl s.getEndTime() == null).forEach(s -> s.setEndTime(new Date())); } - voList= historyAbnormalAlarmVos.parallelStream().map(s -> { + voList= historyAbnormalAlarmVos.parallelStream().peek(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 page = Condition.getPage(query); @@ -225,24 +218,13 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl types = Arrays.asList(param.getType().split(",")); condition.setTypes(types); Result> result = alarmClient.getByStationsAndTime(condition); @@ -314,7 +296,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImplStringUtils.isNotEmpty(station.getCode())).map(StationEntity::getCode).collect(Collectors.toList())); + condition.setStationIds(stations.stream().map(StationEntity::getCode).filter(StringUtils::isNotEmpty).collect(Collectors.toList())); // nacos中配置告警类型:"0-默认", "1-系统", "2-告警", "3-故障", "4-用户操作", "5-遥测越限", "6-遥信变位", "7-注册信息", // "8-信息提示", "9-设备巡检", "10-遥控操作", "11-遥测越限恢复","12-未定义","13-通讯中断","14-数据异常" condition.setTypes(Arrays.asList(types.split(","))); @@ -323,10 +305,10 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl{ + return Arrays.stream(types.split(",")).map(type->{ IntelligentAlarmCountVo count = new IntelligentAlarmCountVo(); count.setType(type); - count.setName(AbnormalAlarmConstant.TYPE_NAMES[Integer.valueOf(type)]); + count.setName(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(type)]); if(result.isSuccess() && !ObjectUtil.isEmpty(result.getData())){ count.setCount(result.getData().getRecords().stream().filter(record->type.equals(record.getSoeType())).count()); }else { @@ -363,7 +345,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImplStringUtils.isNotEmpty(station.getCode())).map(StationEntity::getCode).collect(Collectors.toList())); + condition.setStationIds(stations.stream().map(StationEntity::getCode).filter(StringUtils::isNotEmpty).collect(Collectors.toList())); // nacos中配置告警类型:"0-默认", "1-系统", "2-告警", "3-故障", "4-用户操作", "5-遥测越限", "6-遥信变位", "7-注册信息", // "8-信息提示", "9-设备巡检", "10-遥控操作", "11-遥测越限恢复","12-未定义","13-通讯中断","14-数据异常" condition.setTypes(type_list); @@ -392,7 +374,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl stations = stationService.list(); + if(CollectionUtil.isNotEmpty(stations)){ + wrapper.in(HistoryLevelAlarmEntity::getStationId,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); + } } IPage page = super.page(Condition.getPage(query), wrapper); List records = page.getRecords(); @@ -64,7 +69,7 @@ public class HistoryLevelAlarmServiceImpl extends BaseServiceImpl handles = handleService.handles(ObjectUtil.isEmpty(entity.getType()) ? AbnormalAlarmConstant.LONG_TYPE_LIST : Collections.singletonList(Long.parseLong(entity.getType())),AbnormalAlarmConstant.INTELLIGENCE_ALARM); page.setRecords(records.stream().peek(record-> { - record.setIsHandle(CollectionUtil.isNotEmpty(handles) || handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(record.getAlarmId())); + record.setIsHandle(CollectionUtil.isNotEmpty(handles) && handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(record.getAlarmId())); record.setAlarmType(AbnormalAlarmConstant.INTELLIGENCE_ALARM); }).collect(Collectors.toList())); return page; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java index b607b2c..25c78ad 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/LevelAlarmServiceImpl.java @@ -2,6 +2,8 @@ package com.hnac.hzims.operational.alert.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.equipment.entity.EmInfoEntity; +import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.dto.MessagePushRecordDto; @@ -43,7 +45,7 @@ public class LevelAlarmServiceImpl implements LevelAlarmService { private final IStationService stationService; - private final IMainSystemMonitoringService deviceService; + private final IEmInfoClient deviceClient; private final HistoryLevelAlarmService historyLevelAlarmService; @@ -93,7 +95,7 @@ public class LevelAlarmServiceImpl implements LevelAlarmService { } // 设备 - List devices = deviceService.getEmInfoList(); + List devices = deviceClient.list(); // 查询当天已经记录的告警 List historys = historyLevelAlarmService.list(Wrappers.lambdaQuery() @@ -114,7 +116,7 @@ public class LevelAlarmServiceImpl implements LevelAlarmService { // 根据设备找站点 if(CollectionUtil.isNotEmpty(devices)){ // 找到设备 - List alarmDevices = devices.stream().filter(device->device.getEmCode().equals(item.getDevicecode())).collect(Collectors.toList()); + List alarmDevices = devices.stream().filter(device->device.getNumber().equals(item.getDevicecode())).collect(Collectors.toList()); if(CollectionUtil.isNotEmpty(alarmDevices)){ // 找到站点 List alarmStations = stations.stream().filter(station->station.getRefDept().equals(alarmDevices.get(0).getCreateDept())).collect(Collectors.toList()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java index d2fe088..d1ea07f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java @@ -139,7 +139,7 @@ public class TargetController { } @ApiLog - @ApiOperation("集团操作票/工作票") + @ApiOperation("集团当班数据") @GetMapping("/duty-group") @ApiOperationSupport(order = 14) public R dutygroup(@RequestParam(value = "areaName",required = false) String areaName,@RequestParam(value = "type") Long type) { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java index b79e535..fd77958 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java @@ -1027,19 +1027,19 @@ public class TargetServiceImpl implements TargetService { } // 操作票 if (type == 0) { - duty.setOperateoperate(dutys.get(0).getOperationTicketCount()); + duty.setCount(dutys.get(0).getOperationTicketCount()); // 工作票 } else if (type == 1) { - duty.setWork(dutys.get(0).getWorkTicketCount()); + duty.setCount(dutys.get(0).getWorkTicketCount()); // 巡检 } else if (type == 2) { - duty.setInspect(dutys.get(0).getInspectionSum()); + duty.setCount(dutys.get(0).getInspectionSum()); // 缺陷 } else if (type == 3) { - duty.setDefect(dutys.get(0).getShortagesSum()); + duty.setCount(dutys.get(0).getShortagesSum()); // 定期工作 } else if (type == 4) { - duty.setRegularly(dutys.get(0).getWorkRegularlySum()); + duty.setCount(dutys.get(0).getWorkRegularlySum()); } return duty; }).collect(Collectors.toList()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java index 70d8ce4..25a9bcc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/LevelAlarmRegular.java @@ -29,7 +29,7 @@ public class LevelAlarmRegular{ private LevelAlarmService levelAlarmService; // 定时发送消息 - @Scheduled(cron = "0/40 * * * * ?") + @Scheduled(cron = "0 0/30 * * * ?") private void regular(){ // 检查链接存活状态 if(ObjectUtil.isNotEmpty(client) && client.isOpen()){ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java index e08e9e6..0550817 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java @@ -139,7 +139,6 @@ public class DeptServiceImpl implements IDeptService { @Override public List alarmDeptByCurrentUser() { List stations = stationService.list(Wrappers.lambdaQuery() - .in(StationEntity::getType, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC,HomePageConstant.PUMPING)) .eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE) ); if(CollectionUtil.isEmpty(stations)){