Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 2 years ago
parent
commit
dd8048f17e
  1. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
  2. 47
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java
  3. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java
  4. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java
  5. 70
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/LevelAlarmController.java
  6. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryLevelAlarmMapper.java
  7. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryLevelAlarmMapper.xml
  8. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java
  9. 21
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryLevelAlarmService.java
  10. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java
  11. 42
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  12. 106
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java
  13. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

5
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java

@ -18,9 +18,8 @@ public interface AbnormalAlarmConstant {
String WEBSOCKET_FAULT = "3";
List<String> ALARM_WARN_TYPES = Arrays.asList("0","1","2");
String[] TYPE_NAMES = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"};
String[] TYPE_NAMES = {"默认", "系统", "告警"
, "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"};
/**处理、延后、误报*/
List<Long> HANDLE_WAY = Arrays.asList(1L,2L,3L,4L);

47
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/HistoryLevelAlarmEntity.java

@ -0,0 +1,47 @@
package com.hnac.hzims.operational.alert.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.util.Date;
/**
* @author ysj
*/
@Data
@TableName("hzims_history_level_alarm")
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "数据中断告警对象")
public class HistoryLevelAlarmEntity extends BaseEntity {
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("站点编码")
private String stationId;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("告警编码")
private Long alarmId;
@ApiModelProperty("检查点")
private String realId;
@ApiModelProperty("告警开始时间")
private Date alarmTime;
@ApiModelProperty("告警类型")
private String type;
@ApiModelProperty("状态")
private Integer status;
@ApiModelProperty("告警原因")
private String soeExplain;
}

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java

@ -26,7 +26,7 @@ public class AlarmMergeVo{
private String realId;
@ApiModelProperty("告警编号")
private String alarmCode;
private Long alarmCode;
@ApiModelProperty("告警类型")
private String type;

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

@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* @author ysj
*/
@Api(tags = {"通讯中断、数据异常"})
@RestController
@AllArgsConstructor
@ -122,18 +125,6 @@ public class AbnormalAlarmController extends BladeController {
}
/**
*
*/
@ApiLog
@ApiOperation(value = "等级告警接口")
@ApiOperationSupport(order = 7)
@RequestMapping(value = "/terrace_alarms", method = {RequestMethod.GET, RequestMethod.POST})
public R<SoeReustVo> terrace_alarms(SoeParamVo param){
return R.data(service.terrace_alarms(param));
}
/**
* 智能告警数量: 时间范围当天
*/
@ApiLog

70
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/LevelAlarmController.java

@ -0,0 +1,70 @@
package com.hnac.hzims.operational.alert.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity;
import com.hnac.hzims.operational.alert.service.HistoryLevelAlarmService;
import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* @author ysj
*/
@Api(tags = {"等级告警"})
@RestController
@AllArgsConstructor
@RequestMapping("/level/alarm")
public class LevelAlarmController extends BladeController {
private HistoryLevelAlarmService service;
/**
* 分页
*/
@ApiLog
@GetMapping("/list")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "分页", notes = "传入HistoryAbnormalAlarmEntity")
public R<IPage<HistoryLevelAlarmEntity>> list(HistoryLevelAlarmEntity entity, Query query) {
IPage<HistoryLevelAlarmEntity> pages = service.pageCondition(query, entity);
return R.data(pages);
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(service.deleteLogic(Func.toLongList(ids)));
}
/**
* 智能告警数量: 时间范围当天
*/
@ApiLog
@ApiOperation(value = "智能告警数量")
@ApiOperationSupport(order = 3)
@RequestMapping(value = "/count", method = {RequestMethod.GET, RequestMethod.POST})
public R<List<IntelligentAlarmCountVo>> count(){
return R.data(service.alarmCount());
}
}

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryLevelAlarmMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.operational.alert.mapper;
import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author YSJ
*/
public interface HistoryLevelAlarmMapper extends UserDataScopeBaseMapper<HistoryLevelAlarmEntity> {
}

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryLevelAlarmMapper.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.operational.alert.mapper.HistoryLevelAlarmMapper">
</mapper>

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

@ -36,5 +36,4 @@ public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormal
List<String> queryStationName();
SoeReustVo terrace_alarms(SoeParamVo param);
}

21
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryLevelAlarmService.java

@ -0,0 +1,21 @@
package com.hnac.hzims.operational.alert.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity;
import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import java.util.List;
/**
* 等级告警数据查询
* @author ysj
*/
public interface HistoryLevelAlarmService extends BaseService<HistoryLevelAlarmEntity> {
IPage<HistoryLevelAlarmEntity> pageCondition(Query query, HistoryLevelAlarmEntity entity);
List<IntelligentAlarmCountVo> alarmCount();
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java

@ -80,7 +80,7 @@ public class AlertMerageServiceImpl implements AlarmMergeService {
// 处理告警记录
List<AlarmHandleEntity> handles = alarmHandleService.list(Wrappers.<AlarmHandleEntity>lambdaQuery()
.in(AlarmHandleEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()))
.in(AlarmHandleEntity::getAlarmType, AbnormalAlarmConstant.ALARM_WARN_TYPES)
.in(AlarmHandleEntity::getAlarmType, AbnormalAlarmConstant.TYPE_LIST)
.between(AlarmHandleEntity::getCreateTime,start,end)
);
List<AlarmMergeVo> alarms = new ArrayList<>();
@ -94,6 +94,7 @@ public class AlertMerageServiceImpl implements AlarmMergeService {
alarm.setContent(fault.getSoeExplain());
alarm.setDate(fault.getStartTime());
alarm.setRealId(fault.getRealId());
alarm.setAlarmCode(fault.getAlarmId());
alarm.setType(AbnormalAlarmConstant.WEBSOCKET_FAULT);
return alarm;
}).collect(Collectors.toList()));

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

@ -286,48 +286,6 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
}
/**
* 等级告警查询接口
* @param param
* @return
*/
@Override
public SoeReustVo terrace_alarms(SoeParamVo param) {
// 查询站点
LambdaQueryWrapper<StationEntity> wrapper = Wrappers.lambdaQuery();
if(StringUtils.isNotEmpty(param.getCode())){
wrapper.eq(StationEntity::getCode,param.getCode());
}
List<StationEntity> stations = stationService.list(wrapper);
if(CollectionUtil.isEmpty(stations)){
return new SoeReustVo();
}
// 参数设置
SoeDTO soe_params = new SoeDTO();
//soe_params.setProjectId();
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME) + " 00:00:00";
soe_params.setBeginTime(DateUtil.parse(start,DateUtil.PATTERN_DATETIME));
soe_params.setEndTime(DateUtil.parse(end,DateUtil.PATTERN_DATETIME));
soe_params.setNeedPage(true);
soe_params.setPage(param.getCurrent());
soe_params.setPageSize(param.getSize());
if(ObjectUtil.isEmpty(param.getType())){
soe_params.setTypes(AbnormalAlarmConstant.SOE_TYPE_LIST);
}else{
soe_params.setTypes(Collections.singletonList(param.getType()));
}
// 查询等级告警数据
Result<HzPage<SoeVO>> soes = soeClient.pageQuery(soe_params);
if(!soes.isSuccess() || ObjectUtil.isEmpty(soes.getData())){
return new SoeReustVo();
}
List<Long> handles = this.getAlarmHandleIds();
return null;
}
/**
* 获取处理数据ID集合

106
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryLevelAlarmServiceImpl.java

@ -0,0 +1,106 @@
package com.hnac.hzims.operational.alert.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant;
import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity;
import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity;
import com.hnac.hzims.operational.alert.mapper.HistoryLevelAlarmMapper;
import com.hnac.hzims.operational.alert.service.AlarmHandleService;
import com.hnac.hzims.operational.alert.service.HistoryLevelAlarmService;
import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 等级告警实现类
* @author ysj
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class HistoryLevelAlarmServiceImpl extends BaseServiceImpl<HistoryLevelAlarmMapper, HistoryLevelAlarmEntity> implements HistoryLevelAlarmService {
private final IStationService stationService;
private final AlarmHandleService handleServicel;
/**
* 列表查询
* @param query
* @param entity
* @return
*/
@Override
public IPage<HistoryLevelAlarmEntity> pageCondition(Query query, HistoryLevelAlarmEntity entity) {
LambdaQueryWrapper<HistoryLevelAlarmEntity> wrapper = new LambdaQueryWrapper();
wrapper.between(HistoryLevelAlarmEntity::getAlarmTime, DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00",
DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME));
if(ObjectUtil.isNotEmpty(entity.getType())){
wrapper.eq(HistoryLevelAlarmEntity::getType, entity.getType());
}
if(ObjectUtil.isNotEmpty(entity.getStationId())){
wrapper.eq(HistoryLevelAlarmEntity::getStationId, entity.getStationId());
}
return super.page(Condition.getPage(query), wrapper);
}
/**
* 告警数量:时间范围-当天
* @return
*/
@Override
public List<IntelligentAlarmCountVo> alarmCount() {
// 步骤1.查询用户权限站点
List<StationEntity> stations = stationService.list();
if(CollectionUtil.isEmpty(stations)){
return null;
}
// 步骤2. 过滤已处理等級告警
LambdaQueryWrapper<AlarmHandleEntity> handleWarpper = new LambdaQueryWrapper();
handleWarpper.between(AlarmHandleEntity::getCreateTime, DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00",
DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME));
handleWarpper.in(AlarmHandleEntity::getStationCode, stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
List<AlarmHandleEntity> handles = handleServicel.list();
// 步骤2.查询告警数据
LambdaQueryWrapper<HistoryLevelAlarmEntity> wrapper = new LambdaQueryWrapper();
wrapper.between(HistoryLevelAlarmEntity::getAlarmTime, DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00",
DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME));
wrapper.in(HistoryLevelAlarmEntity::getStationId, stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
wrapper.in(HistoryLevelAlarmEntity::getType,AbnormalAlarmConstant.TYPE_LIST);
if(CollectionUtil.isNotEmpty(handles)){
wrapper.notIn(HistoryLevelAlarmEntity::getAlarmId,handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()));
}
List<HistoryLevelAlarmEntity> levels = this.list(wrapper);
// 步骤4.遍历获取
return AbnormalAlarmConstant.TYPE_LIST.stream().map(type->{
IntelligentAlarmCountVo count = new IntelligentAlarmCountVo();
count.setType(type);
count.setName(AbnormalAlarmConstant.TYPE_NAMES[Integer.valueOf(type)]);
if(CollectionUtil.isEmpty(levels)){
count.setCount(0L);
}else{
count.setCount(levels.stream().filter(level->level.getType().equals(type)).count());
}
return count;
}).collect(Collectors.toList());
}
}

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

@ -530,7 +530,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 计划发电量、实际发电量、发电完成率
this.powerMonth(planList, actualMap, oldActualMap, areaStationList, areaMonthReport);
// 操作票、操作票合格率/ 工作票、工作票合格率
this.doubleMonth(areaStationList, areaMonthReport, mon + "-01 00:00:00", getStrEndTime(mon));
this.doubleMonth(area, areaMonthReport, mon + "-01 00:00:00", getStrEndTime(mon));
// 日常维护、巡检任务、缺陷数、消缺率、检修任务
this.taskMonth(areaStationList, areaMonthReport, mon + "-01 00:00:00", getStrEndTime(mon));
// 预测
@ -742,16 +742,15 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
/**
* 区域-操作票操作票合格率/ 工作票工作票合格率
*
* @param areaStationList
* @param area
* @param areaMonthReport
*/
private void doubleMonth(List<StationEntity> areaStationList, AreaMonthReportVo areaMonthReport, String startTime, String endTime) {
private void doubleMonth(Dept area, AreaMonthReportVo areaMonthReport, String startTime, String endTime) {
// 站点归属机构集合
List<Long> list = areaStationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
Map<String, Object> map = new HashMap<>();
map.put("startDate", startTime);
map.put("endDate", endTime);
map.put("deptList", list);
map.put("deptList", Collections.singletonList(area.getId()));
R<TicketMonthVO> R = ticketInfoClient.getOperateWorkStatistic(map);
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) {
areaMonthReport.setOperate(0);

Loading…
Cancel
Save