问题单整改

This commit is contained in:
zhuxinyu
2023-05-05 13:02:44 +08:00
parent bc603fdb5e
commit d4ba963d98
5 changed files with 21 additions and 33 deletions

View File

@@ -85,9 +85,12 @@ public class RmpEventDetailPO implements Serializable {
private String sagsource;
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
private LocalDateTime startTime;
@ApiModelProperty(value = "格式化开始时间")
@TableField(exist = false)
private String formatTime;
@ApiModelProperty(value = "持续时间,单位秒")
private Double duration;

View File

@@ -1019,9 +1019,9 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
);
Map<String, List<RmpEventDetailPO>> map = eventDetailList.stream().filter(x -> data.getId().equals(x.getEventType()))
.collect(Collectors.groupingBy(s -> s.getStartTime().toString()));
.peek(t ->t.setFormatTime(t.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.collect(Collectors.groupingBy(RmpEventDetailPO::getFormatTime));
Set<String> keySet = map.keySet();
LocalDate parse1 = LocalDate.parse(startTime);
LocalDate parse2 = LocalDate.parse(endTime);
while (!parse1.equals(parse2.plus(1, ChronoUnit.DAYS))){
@@ -1107,8 +1107,8 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
for (DictData data : typeData) {
typeMap.put(data.getName(), 0);
if (detail.getAdvanceType().equals(data.getId())) {
details = BeanUtil.copyProperties(detail, EventDetail.class);
detail.setAdvanceType(data.getName());
// details = BeanUtil.copyProperties(detail, EventDetail.class);
details.setAdvanceType(data.getName());
}
}
list.add(details);

View File

@@ -27,27 +27,25 @@ public class TopMsgPO extends BaseEntity {
*/
private Integer deviceLevel;
private Integer offtimeFlag;
/**
* 通信中断次数
*/
private Integer comOutCount;
/**
* 通信中断时间段描述
*/
private String comOutDescription;
/**
* 数据完整性标识 0.不达标 1.达标
*/
private Integer integrityFlag;
/**
* 数据完成性百分比
*/
private Float integrityValue;
private Integer alarmCountFlag;
/**
* 告警次数
*/
@@ -58,8 +56,6 @@ public class TopMsgPO extends BaseEntity {
*/
private String alarmDesc;
private Integer alarmCountFlag;
/**
* 流量超标标识 0.不达标 1.达标
*/
@@ -74,8 +70,6 @@ public class TopMsgPO extends BaseEntity {
private float onlineRateValue;
private Integer offtimeFlag;
private List<Communicate> communicates;
/**

View File

@@ -58,7 +58,7 @@
<select id="getIntegrityByLineIds" resultType="com.njcn.prepare.harmonic.pojo.mysql.po.line.AlarmPO">
SELECT
device.id AS deviceId,
IFNULL(SUM(integrity.due_time),0) AS due,
IFNULL(SUM(integrity.due_time),3.14159) AS due,
IFNULL(SUM(integrity.real_time),0) AS `real`,
CONVERT(SUM(integrity.real_time)*100/SUM(integrity.due_time),DECIMAL(15,2)) AS integrity
FROM r_stat_integrity_d integrity
@@ -150,7 +150,7 @@
<select id="getOnlineRateByDevice" resultType="com.njcn.prepare.harmonic.pojo.mysql.po.line.AlarmPO">
SELECT
rsod.dev_index,
rsod.dev_index deviceId,
rsod.online_min/(rsod.online_min+rsod.offline_min) onlineRate
FROM r_stat_onlinerate_d rsod
WHERE rsod.dev_index IN

View File

@@ -73,12 +73,11 @@ public class DeviceAbnormaStatisticsServiceImpl implements DeviceAbnormalStatist
DateUtil.endOfDay(DateUtil.parse(param.getTime())));
Map<String, List<AlarmPO>> deviceOnlineMap = deviceOnlineRate.stream().collect(Collectors.groupingBy(AlarmPO::getDeviceId));
// 获取设备流量
List<AlarmPO> deviceFlow = deviceAbnormaStatisticsMapper.getFlowByDevice(devIds,param.getTime().substring(0,6));
List<AlarmPO> deviceFlow = deviceAbnormaStatisticsMapper.getFlowByDevice(devIds,param.getTime().substring(0,7));
if (CollectionUtil.isNotEmpty(deviceFlow)) {
deviceFlowMap = deviceFlow.stream().collect(Collectors.groupingBy(AlarmPO::getDeviceId));
}
// 获取通信中断信息
// List<String> list = Arrays.asList("025fa0e4c91f72ad7f1c1bd29026f20a");
List<TopMsgPO> comMsgs = getCommunicate(devIds, param.getTime());
if (CollectionUtil.isNotEmpty(comMsgs)) {
comMap = comMsgs.stream().collect(Collectors.groupingBy(TopMsgPO::getDevId));
@@ -86,17 +85,8 @@ public class DeviceAbnormaStatisticsServiceImpl implements DeviceAbnormalStatist
// 整合装置信息
List<TopMsgPO> topMsgPOS = new ArrayList<>();
for (Map.Entry<String, List<AlarmPO>> devEntry : devMap.entrySet()) {
// if (!lineIntegrityMap.containsKey(devEntry.getKey()) && !lineAlarmsMap.containsKey(devEntry.getKey())
// && !deviceFlowMap.containsKey(devEntry.getKey()) && !comMap.containsKey(devEntry.getKey()) && !deviceOnlineMap.containsKey(devEntry.getKey())) {
// continue;
// }
TopMsgPO topMsg = new TopMsgPO();
topMsg.setDevId(devEntry.getKey());
topMsg.setIntegrityFlag(1);
topMsg.setOfftimeFlag(1);
topMsg.setFlowFlag(1);
topMsg.setOnlineRateFlag(1);
topMsg.setAlarmCountFlag(1);
int deviceLevel = devEntry.getValue().stream().mapToInt(AlarmPO::getLevel).min().orElse(-1);
// 装置等级
topMsg.setDeviceLevel(deviceLevel);
@@ -118,6 +108,7 @@ public class DeviceAbnormaStatisticsServiceImpl implements DeviceAbnormalStatist
topMsg.setAlarmCount(alarmCount);
topMsg.setAlarmDesc(alarmDesc);
} else {
topMsg.setAlarmCountFlag(1);
topMsg.setAlarmCount(0);
}
// 在线率
@@ -158,8 +149,8 @@ public class DeviceAbnormaStatisticsServiceImpl implements DeviceAbnormalStatist
log.error("ParseException "+e);
}
}
if (topMsg.getFlowFlag() !=1 || topMsg.getIntegrityFlag() !=1 || topMsg.getOfftimeFlag() != 1
|| topMsg.getAlarmCountFlag() !=1 || topMsg.getOnlineRateFlag() !=1) {
if (topMsg.getFlowFlag() ==0 || topMsg.getIntegrityFlag() ==0 || topMsg.getOfftimeFlag() == 0
|| topMsg.getAlarmCountFlag() ==0 || topMsg.getOnlineRateFlag() ==0) {
topMsgPOS.add(topMsg);
}