Browse Source

#告警、班组数据bug修改

zhongwei
yang_shj 1 year ago
parent
commit
51471bec61
  1. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DutyServiceImpl.java
  2. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java
  3. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/MonitorService.java
  4. 27
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java
  5. 2
      hzims-service/hzims-scheduled/src/main/resources/mapper/operation/DutyMapper.xml
  6. 54
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DutyServiceImpl.java

@ -171,6 +171,20 @@ public class DutyServiceImpl extends BaseServiceImpl<DutyMapper, ImsDutyMainEnti
dutyMainInfoVo.setDutyGroupId(imsDutyGroupEntity.getId()); dutyMainInfoVo.setDutyGroupId(imsDutyGroupEntity.getId());
dutyMainInfoVo.setManagerId(imsDutyGroupEntity.getManagerId().toString()); dutyMainInfoVo.setManagerId(imsDutyGroupEntity.getManagerId().toString());
} }
if (ObjectUtil.isEmpty(dutyMainInfoVo)) {
return null;
}
// 赋值
dutyMainInfoVo.setClassName(dutyMainInfoVo.getClassName());
dutyMainInfoVo.setDateTime(dutyMainInfoVo.getDateTime());
dutyMainInfoVo.setStartTime(dutyMainInfoVo.getStartTime());
dutyMainInfoVo.setEndTime(dutyMainInfoVo.getEndTime());
// 负责人
User user = UserCache.getUser(Long.valueOf(dutyMainInfoVo.getManagerId()));
if (ObjectUtil.isNotEmpty(user)) {
dutyMainInfoVo.setManagerName(user.getName());
dutyMainInfoVo.setManagerPhone(user.getPhone());
}
return dutyMainInfoVo; return dutyMainInfoVo;
} }
} }

4
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java

@ -1265,7 +1265,7 @@ public class ShowServiceImpl implements ShowService {
if(CollectionUtil.isEmpty(points)){ if(CollectionUtil.isEmpty(points)){
return "0"; return "0";
} }
String realId = points.get(HomePageConstant.JOINT_RELAY); String realId = points.get(HomePageConstant.ACTIVE_POWER);
if(StringUtil.isEmpty(realId)){ if(StringUtil.isEmpty(realId)){
return "0"; return "0";
} }
@ -1276,7 +1276,7 @@ public class ShowServiceImpl implements ShowService {
if(StringUtil.isEmpty(value)){ if(StringUtil.isEmpty(value)){
return "0"; return "0";
} }
if (value.contains("1") || "1.0".equals(value)) { if (Math.abs(Double.parseDouble(value)) > 0) {
return o.getEmCode(); return o.getEmCode();
} }
return "0"; return "0";

4
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/MonitorService.java

@ -1,9 +1,5 @@
package com.hnac.hzims.scheduled.service.operation.monitor; package com.hnac.hzims.scheduled.service.operation.monitor;
import org.springblade.core.tool.api.R;
import java.util.Map;
/** /**
* WEB水电站首页接口 * WEB水电站首页接口
* @author ysj * @author ysj

27
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java

@ -149,7 +149,7 @@ public class MonitorServiceImpl implements MonitorService {
@Override @Override
public void loadRealData(String param) { public void loadRealData(String param) {
// 获取设备 // 获取设备
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});; List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});
// 设备开关机集合监测点 // 设备开关机集合监测点
List<String> switchOnOff = devices.stream().map(o->{ List<String> switchOnOff = devices.stream().map(o->{
Map<String,String> points = o.getPoint(); Map<String,String> points = o.getPoint();
@ -328,6 +328,8 @@ public class MonitorServiceImpl implements MonitorService {
}); });
// 设备状态 // 设备状态
this.getDeviceParam(devices, deviceClassifyMap, deviceList); this.getDeviceParam(devices, deviceClassifyMap, deviceList);
// 运行设备状态设置
this.deviceState(deviceList);
station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList()));
stationList.add(station); stationList.add(station);
}); });
@ -384,6 +386,29 @@ public class MonitorServiceImpl implements MonitorService {
} }
/** /**
* 设备状态
* @param deviceList
*/
private void deviceState(List<RealDeviceVo> deviceList) {
deviceList.forEach(device->{
// 设备属性列表
List<RealAttributeVo> attbts = device.getAttbtList();
if(CollectionUtil.isEmpty(attbts)){
return;
}
// 功率属性记录
List<RealAttributeVo> powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(powers)){
return;
}
if("0.000000".equals(powers.get(0).getValue()) || "-".equals(powers.get(0).getValue()) || HomePageConstant.ON.equals(powers.get(0).getValue())){
return;
}
device.setState(1);
});
}
/**
* 获取站点属性 * 获取站点属性
* @param stationEntityList * @param stationEntityList
* @param item * @param item

2
hzims-service/hzims-scheduled/src/main/resources/mapper/operation/DutyMapper.xml

@ -23,7 +23,7 @@
limit 1; limit 1;
</select> </select>
<select id="selectDuty" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo"> <select id="selectDuty" resultType="com.hnac.hzims.operational.duty.vo.DutyMainInfoVo">
SELECT DM.*, DC.`CLASS_NAME` as managerId, DC.`START_TIME`, DC.`END_TIME` SELECT DM.*, DC.`CLASS_NAME`, DC.`START_TIME`, DC.`END_TIME`
FROM hz_ims_duty_main DM FROM hz_ims_duty_main DM
JOIN hz_ims_duty_class DC JOIN hz_ims_duty_class DC
ON DM.`CLASS_ID` = DC.`ID` ON DM.`CLASS_ID` = DC.`ID`

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

@ -30,10 +30,13 @@ import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -59,9 +62,9 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
private final AlarmHandleService handleService; private final AlarmHandleService handleService;
private final ISoeClient alarmClient; private final ISysClient sysClient;
private final RedisTemplate redisTemplate; private final ISoeClient alarmClient;
@Value("${hzims.operation.alarm.types}") @Value("${hzims.operation.alarm.types}")
private String types; private String types;
@ -213,16 +216,16 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
*/ */
@Override @Override
public AlarmReustVo alarms(AlarmParamVo param) { public AlarmReustVo alarms(AlarmParamVo param) {
AlarmReustVo alarmReustVo = (AlarmReustVo) redisTemplate.opsForValue().get(param.getType() + param.getSize() + param.getCurrent()); // 查询用户权限机构
if(ObjectUtil.isNotEmpty(alarmReustVo)){ R<List<Dept>> result = sysClient.getDeptByCurrentUser();
return alarmReustVo; if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new AlarmReustVo();
} }
// 查询站点 // 查询站点
LambdaQueryWrapper<StationEntity> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<StationEntity> wrapper = Wrappers.lambdaQuery();
wrapper.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE); wrapper.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE);
if(StringUtils.isNotEmpty(param.getCode())){ wrapper.in(StationEntity::getRefDept,result.getData().stream().map(Dept::getId).collect(Collectors.toList()));
wrapper.eq(StationEntity::getCode,param.getCode());
}
List<StationEntity> stations = stationService.list(wrapper); List<StationEntity> stations = stationService.list(wrapper);
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return new AlarmReustVo(); return new AlarmReustVo();
@ -237,8 +240,8 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
condition.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); condition.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
List<String> types = Arrays.asList(param.getType().split(",")); List<String> types = Arrays.asList(param.getType().split(","));
condition.setTypes(types); condition.setTypes(types);
Result<HzPage<SoeData>> result = alarmClient.getByStationsAndTime(condition); Result<HzPage<SoeData>> soe = alarmClient.getByStationsAndTime(condition);
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ if(!soe.isSuccess() || ObjectUtil.isEmpty(soe.getData()) || CollectionUtil.isEmpty(soe.getData().getRecords())){
return new AlarmReustVo(); return new AlarmReustVo();
} }
@ -247,7 +250,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
// 返回数据 // 返回数据
AlarmReustVo response = new AlarmReustVo(); AlarmReustVo response = new AlarmReustVo();
List<AlarmDataVo> datas = result.getData().getRecords().stream().map(alarm -> { List<AlarmDataVo> datas = soe.getData().getRecords().stream().map(alarm -> {
AlarmDataVo record = new AlarmDataVo(); AlarmDataVo record = new AlarmDataVo();
// 继承类属性拷贝 // 继承类属性拷贝
BeanUtil.copyProperties(alarm, record); BeanUtil.copyProperties(alarm, record);
@ -271,10 +274,9 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
}).sorted(Comparator.comparing(AlarmDataVo::getIsHandle) }).sorted(Comparator.comparing(AlarmDataVo::getIsHandle)
.thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList()); .thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList());
response.setCount((int) (result.getData().getTotal() - handles.size())); response.setCount((int) (soe.getData().getTotal() - handles.size()));
response.setSoeList(datas); response.setSoeList(datas);
response.setTotal(result.getData().getTotal()); response.setTotal(soe.getData().getTotal());
redisTemplate.opsForValue().set(param.getType() + param.getSize() + param.getCurrent(),response,1, TimeUnit.MINUTES);
return response; return response;
} }
@ -298,20 +300,30 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
*/ */
@Override @Override
public List<IntelligentAlarmCountVo> alarmCount() { public List<IntelligentAlarmCountVo> alarmCount() {
// 查询用户权限机构
R<List<Dept>> result = sysClient.getDeptByCurrentUser();
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
// 步骤1.查询用户权限站点 // 步骤1.查询用户权限站点
List<StationEntity> stations = stationService.list(); LambdaQueryWrapper<StationEntity> wrapper = Wrappers.lambdaQuery();
wrapper.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE);
wrapper.in(StationEntity::getRefDept,result.getData().stream().map(Dept::getId).collect(Collectors.toList()));
List<StationEntity> stations = stationService.list(wrapper);
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
}
// 步骤2.查询告警数据 // 步骤2.查询告警数据
SoeQueryConditionByStation condition = new SoeQueryConditionByStation(); SoeQueryConditionByStation condition = new SoeQueryConditionByStation();
DateTimeFormatter format = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); condition.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00", DateUtil.DATETIME_FORMATTER));
condition.setBeginTime(LocalDateTime.parse(/*DateUtil.format(new Date(), DateUtil.PATTERN_DATE) +*/ "2022-12-01 00:00:00", format)); condition.setEndTime(LocalDateTime.now());
condition.setEndTime(LocalDateTime.parse(/*DateUtil.format(new Date(), DateUtil.PATTERN_DATE) +*/ "2022-12-28 00:00:00", format));
condition.setNeedPage(false); condition.setNeedPage(false);
condition.setStationIds(stations.stream().map(StationEntity::getCode).filter(StringUtils::isNotEmpty).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-注册信息", // nacos中配置告警类型:"0-默认", "1-系统", "2-告警", "3-故障", "4-用户操作", "5-遥测越限", "6-遥信变位", "7-注册信息",
// "8-信息提示", "9-设备巡检", "10-遥控操作", "11-遥测越限恢复","12-未定义","13-通讯中断","14-数据异常" // "8-信息提示", "9-设备巡检", "10-遥控操作", "11-遥测越限恢复","12-未定义","13-通讯中断","14-数据异常"
condition.setTypes(Arrays.asList(types.split(","))); condition.setTypes(Arrays.asList(types.split(",")));
Result<HzPage<SoeData>> result = alarmClient.getByStationsAndTime(condition); Result<HzPage<SoeData>> soe = alarmClient.getByStationsAndTime(condition);
// 步骤3. TODO 过滤已处理告警 // 步骤3. TODO 过滤已处理告警
@ -320,8 +332,8 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
IntelligentAlarmCountVo count = new IntelligentAlarmCountVo(); IntelligentAlarmCountVo count = new IntelligentAlarmCountVo();
count.setType(type); count.setType(type);
count.setName(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(type)]); count.setName(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(type)]);
if(result.isSuccess() && !ObjectUtil.isEmpty(result.getData())){ if(soe.isSuccess() && !ObjectUtil.isEmpty(soe.getData())){
count.setCount(result.getData().getRecords().stream().filter(record->type.equals(record.getSoeType())).count()); count.setCount(soe.getData().getRecords().stream().filter(record->type.equals(record.getSoeType())).count());
}else { }else {
count.setCount(0L); count.setCount(0L);
} }

Loading…
Cancel
Save