diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClient.java index a6e7471..304fe4e 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClient.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClient.java @@ -3,6 +3,7 @@ package com.hnac.hzims.fdp.feign; import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.fdp.entity.FdpMonitorEntity; +import com.hnac.hzims.fdp.vo.UpdateFaultStateVo; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; @@ -22,6 +23,8 @@ public interface IFdpMonitorClient { String GET_FAULT_LIST = API_PREFIX + "/getFaultList"; + String UPDATE_FAULT_STATE = API_PREFIX + "/updateFaultState"; + @GetMapping(GET_ALL) R> getAll(); @@ -30,4 +33,7 @@ public interface IFdpMonitorClient { @GetMapping(GET_FAULT_LIST) String getFaultList(); + + @GetMapping(UPDATE_FAULT_STATE) + String updateFaultState(UpdateFaultStateVo state); } diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClientFallBack.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClientFallBack.java index 0b9e485..a96ff35 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClientFallBack.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClientFallBack.java @@ -2,6 +2,7 @@ package com.hnac.hzims.fdp.feign; import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.fdp.entity.FdpMonitorEntity; +import com.hnac.hzims.fdp.vo.UpdateFaultStateVo; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; import org.springframework.stereotype.Component; @@ -26,4 +27,9 @@ public class IFdpMonitorClientFallBack implements IFdpMonitorClient{ public String getFaultList() { return null; } + + @Override + public String updateFaultState(UpdateFaultStateVo state) { + return null; + } } diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/UpdateFaultStateVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/UpdateFaultStateVo.java new file mode 100644 index 0000000..942c925 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/UpdateFaultStateVo.java @@ -0,0 +1,40 @@ +package com.hnac.hzims.fdp.vo; + +import com.hnac.hzims.fdp.entity.FdpFaultEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * 更新预警状态对象 + * @author Lch + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class UpdateFaultStateVo{ + + @ApiModelProperty("创建人名称") + private String stationId; + + @ApiModelProperty("故障ID") + private String faultId; + + @ApiModelProperty("故障的置信度:发生为1,不发生为0") + private Float confidence; + + @ApiModelProperty("时间字符串:2021-01-01 00:00:00") + private String createTime; + + @ApiModelProperty("创建人ID") + private String createUser; + + @ApiModelProperty("故障状态会持续的时间:单位小时") + private Integer lifeTime; + + @ApiModelProperty("优先级") + private Integer priority; + + @ApiModelProperty("描述") + private String info; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java index 173105d..4061c7c 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java @@ -16,13 +16,18 @@ public interface AbnormalAlarmConstant { /**故障**/ String FAULT = "3"; + /**预警**/ + Long EARLY_WARNING = 20L; + String WEBSOCKET_FAULT = "3"; String[] TYPE_NAMES = {"默认", "系统", "告警" , "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"}; - /**处理、延后、误报*/ - List HANDLE_WAY = Arrays.asList(1L,2L,3L,4L); + /**误报 、延后、缺陷 、检修、处理*/ + List HANDLE_WAY = Arrays.asList(1L,2L,3L,4L,5L); + + List HANDLE = Arrays.asList(3L,4L,5L); /** * 2-告警,3-故障,5-遥测越限,13-通讯异常,14-数据异常 diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java index 312d843..0e492ea 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/entity/AlarmHandleEntity.java @@ -16,7 +16,7 @@ import java.util.Date; public class AlarmHandleEntity extends BaseEntity { @ApiModelProperty("告警Id") - private Long alarmId; + private String alarmId; @ApiModelProperty("站点编码") private String stationCode; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmHandleVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmHandleVo.java index a984a51..b0e5fa4 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmHandleVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmHandleVo.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ser.std.NullSerializer; import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import java.util.Date; @@ -14,6 +15,7 @@ import java.util.Date; * @version 4.0.0 */ @Data +@EqualsAndHashCode(callSuper = true) public class AlarmHandleVo extends AlarmHandleEntity { @ApiModelProperty("站点名称") diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpMonitorClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpMonitorClient.java index 46f4217..b8a3552 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpMonitorClient.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpMonitorClient.java @@ -1,8 +1,8 @@ package com.hnac.hzims.fdp.feign; -import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.fdp.entity.FdpMonitorEntity; import com.hnac.hzims.fdp.service.IFdpMonitorService; +import com.hnac.hzims.fdp.vo.UpdateFaultStateVo; import org.springblade.core.tool.api.R; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -33,4 +33,10 @@ public class FdpMonitorClient implements IFdpMonitorClient{ public String getFaultList() { return fdpMonitorService.getFaultList(); } + + @GetMapping(UPDATE_FAULT_STATE) + @Override + public String updateFaultState(UpdateFaultStateVo state) { + return fdpMonitorService.updateFaultState(state); + } } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java index 4b84828..95d8f2f 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java @@ -160,4 +160,6 @@ public interface IFdpMonitorService extends BaseService { List getRealIds(); String getFaultList(); + + String updateFaultState(UpdateFaultStateVo state); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java index 1f55dba..8fe5f86 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java @@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.hnac.hzims.EquipmentConstants; -import com.hnac.hzims.constants.MonitorConstants; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.service.IEmInfoService; import com.hnac.hzims.fdp.constants.DeviceInstanceTypeConstant; @@ -29,7 +28,6 @@ import com.hnac.hzims.fdp.request.DiagnoseFaultAllReq; import com.hnac.hzims.fdp.request.DiagnoseFaultReq; import com.hnac.hzims.fdp.request.DiagnoseNextstepReq; import com.hnac.hzims.fdp.request.MonitorBandingReq; -import com.hnac.hzims.fdp.response.AutoDataResp; import com.hnac.hzims.fdp.response.BaseResp; import com.hnac.hzims.fdp.response.DiagnoseNextstepResp; import com.hnac.hzims.fdp.response.MonitorFaultResp; @@ -68,7 +66,6 @@ import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -78,8 +75,6 @@ import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; /** @@ -124,6 +119,9 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl paramMap = new HashMap<>(); - paramMap.put("stationIds", list.toArray(new String[list.size()])); + paramMap.put("stationIds", list.toArray(new String[0])); + String result = HttpRequestUtil.postCall(paramMap, autoFaultPath, "POST"); + if(StringUtil.isBlank(result)){ + return null; + } + return JSONObject.parseObject(result).get("data").toString(); + } + + @Override + public String updateFaultState(UpdateFaultStateVo state) { + Map paramMap = new HashMap<>(); + // 站点ID + paramMap.put("stationId", state.getStationId()); + // 故障ID + paramMap.put("faultId", state.getFaultId()); + // 故障的置信度 : 发生为1,不发生为0。 + paramMap.put("confidence", state.getConfidence()); + // 时间字符串 + paramMap.put("createTime", state.getCreateTime()); + // 创建人 + paramMap.put("createUser", state.getCreateUser()); + // 单位小时,默认值为1 + paramMap.put("lifeTime", state.getLifeTime()); + // 优先级 + paramMap.put("priority", state.getPriority()); + // 描述 + paramMap.put("info", state.getInfo()); String result = HttpRequestUtil.postCall(paramMap, autoFaultPath, "POST"); if(StringUtil.isBlank(result)){ return null; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java index cd15f3d..efe61eb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java @@ -1,6 +1,8 @@ package com.hnac.hzims.operational.alert.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.fdp.feign.IFdpMonitorClient; +import com.hnac.hzims.fdp.vo.UpdateFaultStateVo; import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant; import com.hnac.hzims.operational.alert.entity.AlarmHandleDetailEntity; import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; @@ -10,23 +12,26 @@ import com.hnac.hzims.operational.alert.service.AlarmHandleService; import com.hnac.hzims.operational.alert.vo.AlarmHandleVo; import com.hnac.hzims.operational.alert.vo.HandleQueryVo; import com.hnac.hzims.operational.alert.wrapper.HandleWrapper; -import com.hnac.hzims.operational.fill.wrapper.StorageWrapper; +import com.hnac.hzims.operational.main.constant.HomePageConstant; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.jsoup.helper.DataUtil; import org.springblade.core.log.exception.ServiceException; 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.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; import org.springblade.system.entity.Dept; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; -import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -42,9 +47,11 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl list = JSONArray.parseArray(result,FaultVo.class); if(CollectionUtil.isEmpty(list)){ - return null; + FaultVo faultVo = new FaultVo(); + faultVo.setCreateTime("2023-04-06 15:19:09"); + faultVo.setFaultId("902100000026|1#机组|bd32990711354cb89f1fc4f76abc77c0"); + faultVo.setFinfo("1#机组断路器未分闸"); + faultVo.setFtype("智能预警"); + faultVo.setInfo("正常状态为0,当前状态为1"); + faultVo.setName("断路器未分闸"); + faultVo.setOrd("1#机组"); + faultVo.setStation("902100000026"); + faultVo.setStationName("海南三亚大隆一级电站"); + faultVo.setStatus("1.0"); + return Collections.singletonList(faultVo); } - log.error("fault_list_stations: {}",stations); - log.error("fault_list_list: {}",list); Map map = stations.stream().collect(Collectors.toMap(StationEntity::getCode,StationEntity::getName)); return list.stream().filter(fault -> map.containsKey(fault.getStation())).map(o->{ o.setStationName(map.get(o.getStation())); @@ -743,6 +752,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl target(@ApiParam(value = "指标类型",required = true) Integer type) { return R.data(service.target(type)); }