diff --git a/hzims-service-api/alarm-api/pom.xml b/hzims-service-api/alarm-api/pom.xml index d2a3b9b..d5c5b91 100644 --- a/hzims-service-api/alarm-api/pom.xml +++ b/hzims-service-api/alarm-api/pom.xml @@ -7,6 +7,12 @@ com.hnac.hzims 4.0.0-SNAPSHOT + + + com.hnac.hzims + middle-api + + 4.0.0 alarm-api jar diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmHandleConstant.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmHandleConstant.java index 4bdbaa1..2694dbd 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmHandleConstant.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmHandleConstant.java @@ -7,20 +7,58 @@ import java.util.List; * @author YSJ */ public interface AlarmHandleConstant { + + List INTERRUPT_LIST = Arrays.asList("13","14"); + + List TYPE_LIST = Arrays.asList("3","2","5","10","13","14"); + + List LONG_TYPE_LIST = Arrays.asList(3L,2L,5L,10L,13L,14L); + + List SEND_MESSSAGE_TYPE_LIST = Arrays.asList("3","13","14"); + + String LEVEL_TYPE_LIST = "3,2,5,10,13,14"; String SYSTEM_TYPE_LIST = "3,2,5,13,14"; + /**通讯恢复*/ + String ABNORMAL_STATUS = "1"; + /**故障**/ String FAULT = "3"; /**预警**/ Long EARLY_WARNING = 20L; + String WEBSOCKET_FAULT = "3"; + + String[] TYPE_NAMES = {"默认", "系统", "告警" + , "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"}; + /**误报 、延后、缺陷 、检修、处理*/ List HANDLE_WAY = Arrays.asList(1L,2L,3L,4L,5L); List HANDLE = Arrays.asList(3L,4L,5L); + String dealAlarm = "dealAlarm"; /** + * 2-告警,3-故障,5-遥测越限,13-通讯异常,14-数据异常 + */ + List SOE_TYPE_LIST = Arrays.asList(2,3,5,13,14); + + /** + * 告警等级: 0 - 1级告警 1-二级告警 + */ + List LEVEL_LIST = Arrays.asList("0","1"); + + /** + * 告警类型: HZ3000告警 + */ + Integer SYSTEM_ALARM = 0; + + /** + * 告警类型: 智能告警 + */ + Integer INTELLIGENCE_ALARM = 1; + /** * 告警类型: 视频告警 */ Integer VIDEO_ALARM = 4; diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmHandleEntity.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmHandleEntity.java index fda07e8..3494a73 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmHandleEntity.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmHandleEntity.java @@ -38,6 +38,35 @@ public class AlarmHandleEntity extends BaseEntity { @ApiModelProperty("告警内容") private String alarmContent; - @ApiModelProperty("处理方式") + @ApiModelProperty("告警处理状态 1L,2L,3L,4L,5L,6l 误报 、延后、缺陷 、检修、处理中、处理完毕 ") private Long handleWay; + +// @ApiModelProperty("处理详情ID") +// private Long detailId; + + @ApiModelProperty("通知处理人") + private Long handleUser; + +// @ApiModelProperty("现象ID") +// private Long phenomenonId; +// +// @ApiModelProperty("检修ID") +// private Long accessId; + + @ApiModelProperty("延后时间") + private Date delayTime; + + @ApiModelProperty("延后原因") + private String delayCause; + + @ApiModelProperty("误报描述") + private String falseAlarmDesc; + + @ApiModelProperty("附件路径") + private String filePath; + @ApiModelProperty("创建用户名称") + private String createUserName; + @ApiModelProperty("创建用户名称") + private String createDeptName; + } diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmHandleFlowEntity.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmHandleFlowEntity.java new file mode 100644 index 0000000..270ab77 --- /dev/null +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmHandleFlowEntity.java @@ -0,0 +1,104 @@ +package com.hnac.hzims.alarm.config.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +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_alarm_handle_flow") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "告警处理对象") +public class AlarmHandleFlowEntity extends BaseEntity { + + @ApiModelProperty("告警Id") + private String alarmId; + + @ApiModelProperty("站点编码") + private String stationCode; + + @ApiModelProperty("告警类型") + private Long alarmType; + + @ApiModelProperty("告警所属类型:0-系统告警 1-智能告警") + private Integer type; + + @ApiModelProperty("告警时间") + private Date alarmTime; + + @ApiModelProperty("告警内容") + private String alarmContent; + + @ApiModelProperty("告警状态 1L,2L,3L,4L,5L 误报 、延后、缺陷 、检修、处理 ") + private Long handleWay; + +// @ApiModelProperty("处理详情ID") +// private Long detailId; + + @ApiModelProperty("通知处理人") + private Long handleUser; + + @ApiModelProperty("通知处理人") + @TableField(exist=false) + private String handleUserFlow; + + @ApiModelProperty("现象ID") + private Long phenomenonId; + + @ApiModelProperty("检修ID") + private Long accessId; + + @ApiModelProperty("延后时间") + private Date delayTime; + + @ApiModelProperty("延后原因") + private String delayCause; + + @ApiModelProperty("误报描述") + private String falseAlarmDesc; + + @ApiModelProperty("附件路径") + private String filePath; + + + @ApiModelProperty("处理方式") + private String dealType; + @ApiModelProperty("处理结果") + private String dealResult; + @ApiModelProperty("处理描述") + private String dealDesc; + @ApiModelProperty("处理附件") + private String dealPath; + @ApiModelProperty("审批结果 0,不通过;1为通过") + private Integer checkFlag; + @ApiModelProperty("审批说明") + private String checkDesc; + @JsonSerialize(nullsUsing = NullSerializer.class) + @ApiModelProperty(value = "当前处理环节") + private String currentOperator; + @JsonSerialize(nullsUsing = NullSerializer.class) + @ApiModelProperty(value = "当前环节处理人") + private String currentLinkHandler; + @ApiModelProperty(value = "流程实例") + private String processInstanceId; + @ApiModelProperty("创建用户姓名") + private String createUserName; + @ApiModelProperty("处理人姓名") + private String handleUserName; + @ApiModelProperty("审批人") + private String approvalUser; + @ApiModelProperty("审批人姓名") + private String approvalUserName; + @ApiModelProperty("创建机构名称") + private String createDeptName; +} diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/feign/Fallback/IAlarmHandleClientFallback.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/feign/Fallback/IAlarmHandleClientFallback.java new file mode 100644 index 0000000..08e163c --- /dev/null +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/feign/Fallback/IAlarmHandleClientFallback.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.alarm.config.feign.Fallback; + +import com.hnac.hzims.alarm.config.feign.IAlarmHandleClient; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Component; + + +/** + * @author ty + */ +@Slf4j +@Component +public class IAlarmHandleClientFallback implements IAlarmHandleClient { + + @Override + public R listenAndUpdateAlarm(ProcessWorkFlowResponse processWorkFlowResponse) { + log.error("远程调用失败,接口:" + LISTEN_ALARM); + return null; + } +} diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/feign/IAlarmHandleClient.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/feign/IAlarmHandleClient.java new file mode 100644 index 0000000..d38ef36 --- /dev/null +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/feign/IAlarmHandleClient.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.alarm.config.feign; + + +import com.hnac.hzims.alarm.config.constants.AlarmConstants; +import com.hnac.hzims.alarm.config.feign.Fallback.IAlarmHandleClientFallback; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + + +/** + * @author xiashandong + * @created 2021/6/10 15:21 + **/ +@FeignClient( + value = AlarmConstants.APP_NAME, + fallback = IAlarmHandleClientFallback.class +) +public interface IAlarmHandleClient { + + String API_PREFIX = "/feign/alarm"; + + String LISTEN_ALARM = API_PREFIX + "/listenAndUpdateAlarm"; + + + @PostMapping(LISTEN_ALARM) + R listenAndUpdateAlarm(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse); + + + +} diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHandleVo.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHandleVo.java index 2dca453..dd95823 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHandleVo.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHandleVo.java @@ -35,6 +35,9 @@ public class AlarmHandleVo extends AlarmHandleEntity { @ApiModelProperty("通知处理人") private Long handleUser; + @ApiModelProperty("通知处理人") + private String handleUserFlow; + @ApiModelProperty("现象Id") @JsonSerialize(nullsUsing = NullSerializer.class) diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/FdpAlarmVo.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/FdpAlarmVo.java index 30c8d7a..bdecf17 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/FdpAlarmVo.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/FdpAlarmVo.java @@ -62,7 +62,7 @@ public class FdpAlarmVo { /** * 设备名称 */ - private String deviceCode; + private String deviceId; // /** // * 报警内容 // */ @@ -71,4 +71,19 @@ public class FdpAlarmVo { * 创建时间 */ private Date createTime; + + /** + * 处置状态 + */ + private String result; + + /** + * 初步分析结果 + */ + private String diagReason; + + /** + * 处置方式 + */ + private String diagSolution; } \ No newline at end of file diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClient.java index 695f0af..5073e28 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClient.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClient.java @@ -27,9 +27,12 @@ public interface IFdpDiagnoseClient { String API_PREFIX = "/feign/fdp/diagnose"; String GET_STATISTIC_STATUS = API_PREFIX + "/getStatisticStatus"; String GET_HISTORY_DATA = API_PREFIX + "/getHistoryData"; + String SET_FAULT_STATUS_INFO = API_PREFIX + "/setFaultStatusInfo"; @PostMapping(GET_STATISTIC_STATUS) R>> getStatisticStatus(@RequestBody StatisticStatusDTO req); @PostMapping(GET_HISTORY_DATA) List getHistoryData(@RequestBody FDPFaultTableDTO req); + @PostMapping(SET_FAULT_STATUS_INFO) + R setFaultStatusInfo(Map map); } diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClientFallBack.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClientFallBack.java index 07ee9ee..6155159 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClientFallBack.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClientFallBack.java @@ -28,4 +28,9 @@ public class IFdpDiagnoseClientFallBack implements IFdpDiagnoseClient { public List getHistoryData(FDPFaultTableDTO req) { return new ArrayList<>(); } + + @Override + public R setFaultStatusInfo(Map map) { + return R.fail("调用接口失败"); + } } diff --git a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java index d4098d5..e4a7222 100644 --- a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java +++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java @@ -58,6 +58,8 @@ public class TicketProcessConstant { */ public static final String DUTY_REC = "duty_rec"; + public static final String DEAL_ALARM = "dealAlarm"; + /** * 线下工作票 */ diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpListTableDataController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpListTableDataController.java index a8b2bc1..0f3b654 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpListTableDataController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpListTableDataController.java @@ -32,24 +32,27 @@ public class FdpListTableDataController extends BladeController { @Resource private final IFdpListTableDataService service; /** - * 分页 + * 下拉列表页 */ @ApiLog @GetMapping("/getProperty") @ApiOperationSupport(order = 50) @ApiOperation(value = "分页 查询参数:name,emId,faultId,reasonId,satisfaction") - @OperationAnnotation(moduleName = "智能诊断",title = "智能诊断任务",operatorType = OperatorType.MOBILE,businessType = + @OperationAnnotation(moduleName = "智能诊断",title = "下拉列表页",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, - action = "分页查询智能诊断任务列表") + action = "下拉列表页") public R getProperty(String property) { return service.getProperty(property); } + /** + * 分页查询智能诊断任务列表 + */ @ApiLog @PostMapping ("/getListByProperty") @ApiOperationSupport(order = 50) @ApiOperation(value = "分页 查询参数:name,emId,faultId,reasonId,satisfaction") - @OperationAnnotation(moduleName = "智能诊断",title = "智能诊断任务",operatorType = OperatorType.MOBILE,businessType = + @OperationAnnotation(moduleName = "智能诊断",title = "分页查询智能诊断任务列表",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, action = "分页查询智能诊断任务列表") public R getListByProperty(@RequestBody FDPFaultListInfoDTO req) { diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpDiagnoseClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpDiagnoseClient.java index 33f51e3..03f1c07 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpDiagnoseClient.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpDiagnoseClient.java @@ -4,8 +4,8 @@ import com.hnac.hzims.fdp.dto.FDPFaultTableDTO; import com.hnac.hzims.fdp.dto.StatisticStatusDTO; import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity; import com.hnac.hzims.fdp.proxy.IDiagnoseProxy; +import com.hnac.hzims.fdp.service.IFdpFocusSurveillanceService; import com.hnac.hzims.fdp.service.IFdpHistoryDataService; -import com.hnac.hzims.fdp.vo.FdpFaultHistoryDataVo; import com.hnac.hzims.fdp.vo.StatisticStatusVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -26,6 +26,7 @@ public class FdpDiagnoseClient implements IFdpDiagnoseClient { private final IDiagnoseProxy service; private final IFdpHistoryDataService fdpHistoryDataService; + private final IFdpFocusSurveillanceService iFdpFocusSurveillanceService; @Override @PostMapping(GET_STATISTIC_STATUS) @@ -38,4 +39,10 @@ public class FdpDiagnoseClient implements IFdpDiagnoseClient { public List getHistoryData(FDPFaultTableDTO req) { return fdpHistoryDataService.exportHistoryData(req); } + + @Override + @PostMapping(SET_FAULT_STATUS_INFO) + public R setFaultStatusInfo(Map map) { + return iFdpFocusSurveillanceService.setFaultStatusInfo(map); + } } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java index fa14570..08920bd 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java @@ -86,13 +86,13 @@ public class ThreadTask { //诊断 - public static void fdpTaskNew(FdpTaskDTO taskDTO, FdpFaultEntity fdpFaultEntity, String key) { + public static void fdpTaskNew(FdpTaskDTO taskDTO, String key) { try { Runnable runnable = new Runnable() { @Override public void run() { //异步任务 - updateFaultStateNew(taskDTO, fdpFaultEntity, key); + updateFaultStateNew(taskDTO, key); } }; Thread thread = new Thread(runnable); @@ -198,19 +198,19 @@ public class ThreadTask { * 修改诊断状态 * @param key */ - private static void updateFaultStateNew(FdpTaskDTO req, FdpFaultEntity fdpFaultEntity, String key) { + private static void updateFaultStateNew(FdpTaskDTO req, String key) { /**更新故障状态**/ DiagnoseFaultAllReq faultAllReq = new DiagnoseFaultAllReq(); // faultAllReq.setAutoData(vo); - faultAllReq.setStationId(fdpFaultEntity.getStationId()); + faultAllReq.setStationId(req.getStation()); DiagnoseFaultReq diagnoseFaultReq = new DiagnoseFaultReq(); diagnoseFaultReq.setTaskId(key); diagnoseFaultReq.setFaultId(req.getFaultId()); diagnoseFaultReq.setConfidence(1.0); diagnoseFaultReq.setLifeTime(24*3);//设置有效期3天 - diagnoseFaultReq.setPriority(2); - diagnoseFaultReq.setTenantId(fdpFaultEntity.getStationId()); + diagnoseFaultReq.setPriority(-1); + diagnoseFaultReq.setTenantId(req.getStation()); diagnoseFaultReq.setCreateUser(ObjectUtil.isEmpty(AuthUtil.getUser()) ? "告警推送" : AuthUtil.getUser().getUserName()); faultAllReq.setManualData(diagnoseFaultReq); @@ -240,7 +240,7 @@ public class ThreadTask { r2.setData(diagnoseStatusVo); threadTask.redisTemplate.opsForValue().set(threadTask.fdpReturnValuePath + "_" + key, JSONObject.toJSONString(r2)); if (r1.isSuccess()) { - R nextstep = threadTask.fdpFaultService.getNextStepWithTree(fdpFaultEntity.getFdpId(), fdpFaultEntity.getStationId()); + R nextstep = threadTask.fdpFaultService.getNextStepWithTree(req.getFaultId(), req.getStation()); diagnoseStatusVo.setStatus(4); diagnoseStatusVo.setMessage("诊断成功"); diagnoseStatusVo.setData(nextstep.getData()); diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpFocusSurveillanceService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpFocusSurveillanceService.java new file mode 100644 index 0000000..894cdc8 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpFocusSurveillanceService.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.fdp.service; + +import org.springblade.core.tool.api.R; + +import java.util.Map; + +/** + * 服务类 + * + * @author xiashandong + * @created 2021-05-25 17:32 + **/ +public interface IFdpFocusSurveillanceService { + + R setFaultStatusInfo( Map map); + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFaultServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFaultServiceImpl.java index a1bb75e..8c89517 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFaultServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFaultServiceImpl.java @@ -104,7 +104,7 @@ public class FdpFaultServiceImpl extends BaseServiceImpl getFaultAmountTrend(String stationId, String faultId , String start, String end){ Map params = new HashMap<>(3); /**获取故障stationId**/ - stationId = this.getStationIdByFdpId(faultId); +// stationId = this.getStationIdByFdpId(faultId); if(StringUtil.isEmpty(stationId)){ throw new ServiceException("获取当前故障站点ID失败"); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFocusSurveillanceServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFocusSurveillanceServiceImpl.java new file mode 100644 index 0000000..1f0bfd9 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFocusSurveillanceServiceImpl.java @@ -0,0 +1,73 @@ +package com.hnac.hzims.fdp.service.impl; + + + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.hnac.hzims.equipment.service.IEmInfoService; +import com.hnac.hzims.fdp.mapper.FdpDeviceMapper; +import com.hnac.hzims.fdp.mapper.FdpMonitorNoScopeMapper; +import com.hnac.hzims.fdp.proxy.IDiagnoseProxy; +import com.hnac.hzims.fdp.service.IFdpFaultService; +import com.hnac.hzims.fdp.service.IFdpFocusSurveillanceService; +import com.hnac.hzims.fdp.service.IFdpTaskService; +import com.hnac.hzims.fdp.util.HttpRequestUtil; +import com.hnac.hzims.operational.station.feign.IStationClient; +import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; +import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient; +import com.hnac.hzinfo.datasearch.real.IRealDataSearchClient; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import java.util.*; + + +/** + * @author 86187 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class FdpFocusSurveillanceServiceImpl implements IFdpFocusSurveillanceService { + private final FdpDeviceMapper fdpDeviceMapper; + private final IEmInfoService emInfoService; + private final IAnalyseInstanceClient deviceInstanceClient; + private final IAnalyseInstanceClient analyseInstanceClient; + private final IRealDataSearchClient realDataSearchClient; + private final IAnalyseDataSearchClient deviceDataSearchClient; + private final IFdpTaskService fdpTaskService; + private final IDiagnoseProxy diagnoseProxy; + private final FdpMonitorNoScopeMapper fdpMonitorNoScopeMapper; + private final IStationClient stationClient; + private final IFdpFaultService fdpFaultService; + private final RedisTemplate redisTemplate; + + @Value("${url.setFaultStatusInfo}") + public String setFaultStatusInfo; + + /** + * 集中监控智能预警-处理状态推送 + * @param map + * @return + */ + @Override + public R setFaultStatusInfo( Map map) { + String post = HttpRequestUtil.postCallObjectParam(map, setFaultStatusInfo, "POST"); + R r = JSONObject.parseObject(post, new TypeReference() {{}}); + return r; +// if (r.isSuccess()){ +// return R.success("修改成功"); +// }else { +// return R.fail(r.getMsg()); +// } + } + + + +} + + 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 f1c67a4..393d0fc 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 @@ -518,14 +518,14 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(FdpFaultEntity::getFdpId, taskDTO.getFaultId()).last("limit 1"); - FdpFaultEntity fdpFaultEntity = fdpFaultService.getOne(wrapper); - if (ObjectUtil.isEmpty(fdpFaultEntity)) { - throw new ServiceException("获取对应故障对象失败"); - } - taskDTO.setFdpDeviceName(fdpFaultEntity.getFdpDeviceName()); +// /**获取故障对象**/ +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.eq(FdpFaultEntity::getFdpId, taskDTO.getFaultId()).last("limit 1"); +// FdpFaultEntity fdpFaultEntity = fdpFaultService.getOne(wrapper); +// if (ObjectUtil.isEmpty(fdpFaultEntity)) { +// throw new ServiceException("获取对应故障对象失败"); +// } +// taskDTO.setFdpDeviceName(fdpFaultEntity.getFdpDeviceName()); // /**获取实时、历史数据**/ // FdpRealTimeAndHisDataVo pushResp = this.dataPushByPartition(fdpFaultEntity.getFdpPartition(), fdpFaultEntity.getCreateDept()); // String key = UUID.randomUUID().toString(); @@ -567,7 +567,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl map = new HashMap<>(); map.put("id", key); diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/AlarmHandleController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/AlarmHandleController.java index b42a329..88f9c4e 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/AlarmHandleController.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/AlarmHandleController.java @@ -3,6 +3,7 @@ package com.hnac.hzims.alarm.show.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.alarm.config.entity.AlarmHandleFlowEntity; import com.hnac.hzims.alarm.config.vo.AlarmHandleVo; import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; @@ -40,7 +41,7 @@ public class AlarmHandleController extends BladeController { @PostMapping("/execute") @ApiOperationSupport(order = 1) @ApiOperation(value = "告警处理", notes = "传入AlarmHandleEntity") - public R execute(@RequestBody AlarmHandleVo param) { + public R execute(@RequestBody AlarmHandleFlowEntity param) { return R.status(service.execute(param)); } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/feign/AlarmHandleClient.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/feign/AlarmHandleClient.java new file mode 100644 index 0000000..d265ede --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/feign/AlarmHandleClient.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.alarm.show.feign; + + +import com.hnac.hzims.alarm.config.feign.IAlarmHandleClient; +import com.hnac.hzims.alarm.show.service.AlarmHandleFlowService; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import lombok.AllArgsConstructor; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + + +@RestController +@AllArgsConstructor +public class AlarmHandleClient implements IAlarmHandleClient { + + + private final AlarmHandleFlowService alarmHandleFlowService; + + @PostMapping(LISTEN_ALARM) + @Override + public R listenAndUpdateAlarm(@RequestBody ProcessWorkFlowResponse processWorkFlowResponse) { + return alarmHandleFlowService.listenAndUpdate(processWorkFlowResponse); + } +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleFlowMapper.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleFlowMapper.java new file mode 100644 index 0000000..803e93c --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleFlowMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.alarm.show.mapper; + + +import com.hnac.hzims.alarm.config.entity.AlarmHandleFlowEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + + +/** + * @author ysj + * @date 2023/03/09 09:19:13 + * @version 4.0.0 + */ +public interface AlarmHandleFlowMapper extends UserDataScopeBaseMapper { + + +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleFlowMapper.xml b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleFlowMapper.xml new file mode 100644 index 0000000..e5e84b6 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleFlowMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml index b359e33..b32685f 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml @@ -38,14 +38,12 @@ diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleFlowService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleFlowService.java new file mode 100644 index 0000000..6101e4e --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleFlowService.java @@ -0,0 +1,18 @@ +package com.hnac.hzims.alarm.show.service; + +import com.hnac.hzims.alarm.config.entity.AlarmHandleFlowEntity; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import org.springblade.core.mp.base.BaseService; +import org.springblade.core.tool.api.R; + + +/** + * @author ysj + * @date 2023/03/09 09:19:13 + * @version 4.0.0 + */ +public interface AlarmHandleFlowService extends BaseService { + + R listenAndUpdate(ProcessWorkFlowResponse processWorkFlowResponse); + +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java index 0ae58b1..82d85e3 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java @@ -2,6 +2,7 @@ package com.hnac.hzims.alarm.show.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.alarm.config.entity.AlarmHandleEntity; +import com.hnac.hzims.alarm.config.entity.AlarmHandleFlowEntity; import com.hnac.hzims.alarm.config.vo.AlarmHandleVo; import com.hnac.hzims.operational.alert.vo.HandleQueryVo; import org.springblade.core.mp.base.BaseService; @@ -17,7 +18,7 @@ import java.util.List; */ public interface AlarmHandleService extends BaseService { - boolean execute(AlarmHandleVo param); + boolean execute(AlarmHandleFlowEntity param); IPage pageCondition(Query query, HandleQueryVo param); diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java new file mode 100644 index 0000000..0286009 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java @@ -0,0 +1,137 @@ +package com.hnac.hzims.alarm.show.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; +import com.hnac.hzims.alarm.config.entity.AlarmHandleEntity; +import com.hnac.hzims.alarm.config.entity.AlarmHandleFlowEntity; +import com.hnac.hzims.alarm.show.mapper.AlarmHandleFlowMapper; +import com.hnac.hzims.alarm.show.mapper.AlarmHandleMapper; +import com.hnac.hzims.alarm.show.service.AlarmHandleFlowService; +import com.hnac.hzims.common.logs.utils.StringUtils; +import com.hnac.hzims.fdp.feign.IFdpDiagnoseClient; +import com.hnac.hzims.message.MessageConstants; +import com.hnac.hzims.message.dto.BusinessMessageDTO; +import com.hnac.hzims.message.fegin.IMessageClient; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.api.R; +import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.system.feign.ISysClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; + +/** + * @author ysj + * @version 4.0.0 + * @date 2023/03/09 09:29:34 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class AlarmHandleFlowServiceImpl extends BaseServiceImpl implements AlarmHandleFlowService{ + + + private final IMessageClient messageClient; + + private final ISysClient sysClient; + + private final IFlowClient processClient; + @Autowired + private AlarmHandleMapper alarmHandleMapper; + + private final IFdpDiagnoseClient iFdpDiagnoseClient; + + @Override + public R listenAndUpdate(ProcessWorkFlowResponse processWorkFlowResponse) { + long taskId; + AlarmHandleFlowEntity alarmHandleFlowEntity; + log.info("消缺消息开始转换"+processWorkFlowResponse); + try { + Map variables = (Map) processWorkFlowResponse.getVariables(); + //现象缺陷全表更新 + alarmHandleFlowEntity= JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference(){}); + } catch (Exception e) { + log.info("消息转换失败:"+e.getMessage()); + return R.fail("消息转换失败"); + } + taskId=alarmHandleFlowEntity.getId(); + //设置当前环节+当前环节处理人 + if (StringUtils.isNotEmpty(processWorkFlowResponse.getNextStepOperator())) { + alarmHandleFlowEntity.setCurrentOperator(processWorkFlowResponse.getTaskName()); + alarmHandleFlowEntity.setCurrentLinkHandler(processWorkFlowResponse.getNextStepOperator()); + }else { + alarmHandleFlowEntity.setCurrentOperator("流程结束"); + alarmHandleFlowEntity.setCurrentLinkHandler(""); + // 预警 + if(AlarmHandleConstant.EARLY_WARNING.equals(alarmHandleFlowEntity.getAlarmType())){ + Map map=new HashMap<>(); + map.put("uuid",alarmHandleFlowEntity.getAlarmId()); + map.put("result",alarmHandleFlowEntity.getHandleWay()); + if (1l==alarmHandleFlowEntity.getHandleWay()){ + //处理发现误报,修改对应状态 + map.put("result_info",alarmHandleFlowEntity.getDealDesc()); + alarmHandleMapper.update(null,Wrappers.lambdaUpdate() + .set(AlarmHandleEntity::getHandleWay, alarmHandleFlowEntity.getHandleWay()) + .set(AlarmHandleEntity::getFalseAlarmDesc, alarmHandleFlowEntity.getDealDesc()) + .eq(AlarmHandleEntity::getAlarmId, alarmHandleFlowEntity.getAlarmId())); + + }else { + //设置处理完成 + alarmHandleMapper.update(null,Wrappers.lambdaUpdate() + .set(AlarmHandleEntity::getHandleWay, 6l) + .set(AlarmHandleEntity::getFalseAlarmDesc, alarmHandleFlowEntity.getDealDesc()) + .eq(AlarmHandleEntity::getAlarmId, alarmHandleFlowEntity.getAlarmId())); + map.put("result_info",alarmHandleFlowEntity.getDealDesc()); + } + //流程结束后才,调用fdp修改状态的接口 + R r = iFdpDiagnoseClient.setFaultStatusInfo(map); + if (!r.isSuccess()){ + throw new ServiceException("修改告警状态异常,请稍后重试!"); + } + } + } + this.updateById(alarmHandleFlowEntity); + //推送消息中心相关消息 + sendMessage(processWorkFlowResponse, alarmHandleFlowEntity,taskId); + log.info("消缺消息转换结束"+processWorkFlowResponse); + return R.success("消息保存成功"); + } + + + private void sendMessage(ProcessWorkFlowResponse processWorkFlowResponse, AlarmHandleFlowEntity alarmHandleFlowEntity,Long taskId) { + //推送消息 + if (processWorkFlowResponse.getTaskId() != null) { + BusinessMessageDTO message = new BusinessMessageDTO(); + message.setBusinessClassify("system"); + message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); + message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription()); + message.setTaskId(Optional.ofNullable(taskId).orElse(System.currentTimeMillis())); + message.setTenantId("200000"); + String countent = + "您的告警处理流程待审批!告警内容:".concat(Optional.ofNullable(alarmHandleFlowEntity.getAlarmContent()).orElse("")) + .concat(",审批环节:") + .concat(processWorkFlowResponse.getTaskName()); + message.setContent(countent); + message.setDeptId(alarmHandleFlowEntity.getCreateDept()); + R deptName = sysClient.getDeptName(alarmHandleFlowEntity.getCreateDept()); + if (deptName.isSuccess()) { + message.setDeptName(deptName.getData()); + } + String userIds = processWorkFlowResponse.getUserId(); + if (StringUtils.isBlank(userIds)) { + log.error("推送的消息不能为空哦,{}", userIds); + return; + } + message.setUserIds(userIds); + message.setCreateUser(alarmHandleFlowEntity.getCreateUser()); + messageClient.sendAppAndWsMsgByUsers(message); + } + } +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java index f9ad280..cc247c4 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java @@ -1,13 +1,17 @@ package com.hnac.hzims.alarm.show.service.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.alarm.config.entity.AlarmHandleDetailEntity; import com.hnac.hzims.alarm.config.entity.AlarmHandleEntity; +import com.hnac.hzims.alarm.config.entity.AlarmHandleFlowEntity; +import com.hnac.hzims.alarm.show.mapper.AlarmHandleFlowMapper; import com.hnac.hzims.alarm.show.mapper.AlarmHandleMapper; import com.hnac.hzims.alarm.show.service.AlarmHandleDetailService; import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.alarm.show.wrapper.HandleWrapper; import com.hnac.hzims.alarm.config.vo.AlarmHandleVo; +import com.hnac.hzims.common.logs.utils.StringUtils; +import com.hnac.hzims.fdp.feign.IFdpDiagnoseClient; import com.hnac.hzims.fdp.feign.IFdpMonitorClient; import com.hnac.hzims.fdp.vo.UpdateFaultStateVo; import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; @@ -19,14 +23,22 @@ 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.BeanUtil; import org.springblade.core.tool.utils.DateUtil; +import org.springblade.flow.core.entity.BladeFlow; +import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.flow.core.utils.FlowUtil; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; +import javax.xml.ws.WebServiceException; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -47,6 +59,13 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl map=new HashMap<>(); + map.put("uuid",param.getAlarmId()); + map.put("result",param.getHandleWay()); + if (1l==way){ + map.put("result_info",param.getFalseAlarmDesc()); + } else if (2l==way){ + map.put("result_info",param.getDelayCause()); + } + R r = iFdpDiagnoseClient.setFaultStatusInfo(map); + if (!r.isSuccess()){ + throw new ServiceException("修改告警状态异常,请稍后重试!"); + } } - // 详情 - AlarmHandleDetailEntity detail = new AlarmHandleDetailEntity(); - detail.setAccessId(param.getAccessId()); - detail.setPhenomenonId(param.getPhenomenonId()); - detail.setHandleUser(param.getHandleUser()); - detail.setDelayTime(param.getDelayTime()); - detail.setDelayCause(param.getDelayCause()); - detail.setFalseAlarmDesc(param.getFalseAlarmDesc()); - detail.setFilePath(param.getFilePath()); - detailService.save(detail); // 处理记录 AlarmHandleEntity entity = new AlarmHandleEntity(); entity.setAlarmId(param.getAlarmId()); entity.setType(param.getType()); +// entity.setDetailId(detail.getId()); entity.setAlarmTime(param.getAlarmTime()); entity.setAlarmContent(param.getAlarmContent()); entity.setHandleWay(param.getHandleWay()); entity.setStationCode(param.getStationCode()); entity.setAlarmType(param.getAlarmType()); - return this.save(entity); - } - - /** - * 预警处理推送智能诊断服务 - * @param param - */ - private void updateFalultState(AlarmHandleVo param) { - try{ - UpdateFaultStateVo state = new UpdateFaultStateVo(); - state.setStationId(param.getStationCode()); - state.setFaultId(param.getAlarmId()); - if(AlarmHandleConstant.HANDLE.contains(param.getHandleWay())){ - state.setConfidence(1f); - }else{ - state.setConfidence(0f); +// entity.setAccessId(param.getAccessId()); +// entity.setPhenomenonId(param.getPhenomenonId()); + entity.setHandleUser(param.getHandleUser()); + entity.setHandleUser(param.getHandleUser()); + entity.setDelayTime(param.getDelayTime()); + entity.setDelayCause(param.getDelayCause()); + entity.setFalseAlarmDesc(param.getFalseAlarmDesc()); + entity.setFilePath(param.getFilePath()); + if (StringUtils.isNotBlank(AuthUtil.getUserName())){ + entity.setCreateUserName(AuthUtil.getNickName()); + entity.setCreateDeptName(param.getCreateDeptName()); + } + this.save(entity); + //开启流程 + if (AlarmHandleConstant.HANDLE.contains(way)) { + alarmHandleFlowMapper.insert(param); + // 流程名称 + String processName = "[" + AuthUtil.getUserName() + "] 发起 " + "【" + param.getAlarmContent() + "】告警处理流程"; + // 开启告警处理流程 + String businessKey = FlowUtil.getBusinessKey("hzims_alarm_handle", "" + param.getId()); + Map variable = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(param,DateUtil.PATTERN_DATETIME), Map.class); + R result = processClient.startProcessInstanceContainNameByKey(AlarmHandleConstant.dealAlarm, businessKey, processName, variable); + // 流程开启失败 + if (!result.isSuccess()) { + throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getMsg()); } - state.setCreateTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); - state.setCreateUser(String.valueOf(AuthUtil.getUserId())); - state.setLifeTime(1); - state.setPriority(1); - state.setInfo(param.getFalseAlarmDesc()); - String result = fdpMonitorClient.updateFaultState(state); - }catch (Exception exception){ - log.error("update_falult_state: {}",exception.getMessage()); + param.setProcessInstanceId(result.getData().getProcessInstanceId()); + alarmHandleFlowMapper.updateById(param); } + return true; } /** diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java index 02c94ff..4cf5689 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java @@ -88,7 +88,7 @@ public class FdpAlarmServiceImpl implements FdpAlarmService { entity.setAlarmTime(item.getCreateTime()); entity.setAlarmContext(item.getFinfo()); entity.setAlarmType(EARLY); - entity.setDeviceCode(item.getDeviceCode()); + entity.setDeviceCode(item.getDeviceId()); entity.setDeviceName(item.getDeviceName()); entity.setAlarmStatus(Integer.valueOf(item.getStatus())); entity.setStationId(item.getStation()); diff --git a/hzims-service/hzims-alarm/src/main/resources/db/1.0.0.sql b/hzims-service/hzims-alarm/src/main/resources/db/1.0.0.sql index 30ba7e5..f3d977f 100644 --- a/hzims-service/hzims-alarm/src/main/resources/db/1.0.0.sql +++ b/hzims-service/hzims-alarm/src/main/resources/db/1.0.0.sql @@ -101,55 +101,31 @@ CREATE TABLE `HZIMS_ALARM_CONFIG_DETAIL` ( -- ---------------------------- DROP TABLE IF EXISTS `HZIMS_ALARM_HANDLE`; CREATE TABLE `HZIMS_ALARM_HANDLE` ( - `ID` bigint(20) NOT NULL COMMENT '主键ID', - `ALARM_ID` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '告警主键ID', - `STATION_CODE` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点编号', - `ALARM_TYPE` smallint(6) NULL DEFAULT NULL COMMENT '告警类型', - `ALARM_TIME` datetime(0) NULL DEFAULT NULL COMMENT '告警时间', - `ALARM_CONTENT` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '告警内容', - `TYPE` tinyint(1) NULL DEFAULT NULL COMMENT '类型:0-系统告警 1-智能告警', - `HANDLE_WAY` smallint(6) NULL DEFAULT NULL COMMENT '处理方式', - `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', - `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间', - `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', - `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', - `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', - `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', - `STATUS` tinyint(4) NOT NULL DEFAULT 0 COMMENT '状态', - `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门', - `HANDLE_USER` bigint(20) NULL DEFAULT NULL COMMENT '通知处理人', - `PHENOMENON_ID` bigint(20) NULL DEFAULT NULL COMMENT '现象ID', - `ACCESS_ID` bigint(20) NULL DEFAULT NULL COMMENT '检修ID', - `DELAY_TIME` datetime(0) NULL DEFAULT NULL COMMENT '延后时间', - `DELAY_CAUSE` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '延后原因', - `FALSE_ALARM_DESC` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '误报描述', - `FILE_PATH` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件路径', - `CREATE_USER_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建用户姓名', - `CREATE_DEPT_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建机构名称', - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- TABLE STRUCTURE FOR HZIMS_ALARM_HANDLE_DETAIL --- ---------------------------- -DROP TABLE IF EXISTS `HZIMS_ALARM_HANDLE_DETAIL`; -CREATE TABLE `HZIMS_ALARM_HANDLE_DETAIL` ( - `ID` BIGINT(20) NOT NULL COMMENT '主键ID', - `HANDLE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '通知处理人', - `PHENOMENON_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '现象ID', - `ACCESS_ID` BIGINT(20) NULL DEFAULT NULL COMMENT '检修ID', - `DELAY_TIME` DATETIME NULL DEFAULT NULL COMMENT '延后时间', - `DELAY_CAUSE` VARCHAR(1024) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '延后原因', - `FALSE_ALARM_DESC` VARCHAR(1024) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '误报描述', - `FILE_PATH` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '附件路径', - `TENANT_ID` VARCHAR(12) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '租户ID', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `UPDATE_TIME` DATETIME NULL DEFAULT NULL COMMENT '更新时间', - `CREATE_USER` BIGINT(20) NOT NULL COMMENT '创建人', - `UPDATE_USER` BIGINT(20) NULL DEFAULT NULL COMMENT '更新人', - `IS_DELETED` TINYINT(4) NOT NULL COMMENT '是否删除', - `STATUS` TINYINT(4) NOT NULL COMMENT '状态', - `CREATE_DEPT` BIGINT(20) NULL DEFAULT NULL COMMENT '创建部门', + `ID` bigint(20) NOT NULL COMMENT '主键ID', + `ALARM_ID` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '告警主键ID', + `STATION_CODE` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点编号', + `ALARM_TYPE` smallint(6) NULL DEFAULT NULL COMMENT '告警类型', + `ALARM_TIME` datetime(0) NULL DEFAULT NULL COMMENT '告警时间', + `ALARM_CONTENT` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '告警内容', + `TYPE` tinyint(1) NULL DEFAULT NULL COMMENT '类型:0-系统告警 1-智能告警', + `HANDLE_WAY` smallint(6) NULL DEFAULT NULL COMMENT '处理方式', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', + `STATUS` tinyint(4) NOT NULL DEFAULT 0 COMMENT '状态', + `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门', + `HANDLE_USER` bigint(20) NULL DEFAULT NULL COMMENT '通知处理人', + `PHENOMENON_ID` bigint(20) NULL DEFAULT NULL COMMENT '现象ID', + `ACCESS_ID` bigint(20) NULL DEFAULT NULL COMMENT '检修ID', + `DELAY_TIME` datetime(0) NULL DEFAULT NULL COMMENT '延后时间', + `DELAY_CAUSE` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '延后原因', + `FALSE_ALARM_DESC` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '误报描述', + `FILE_PATH` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件路径', + `CREATE_USER_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建用户姓名', + `CREATE_DEPT_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建机构名称', PRIMARY KEY (`ID`) USING BTREE ) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; diff --git a/hzims-service/hzims-alarm/src/main/resources/dict/dict.sql b/hzims-service/hzims-alarm/src/main/resources/dict/dict.sql index 2cd0b45..597d18b 100644 --- a/hzims-service/hzims-alarm/src/main/resources/dict/dict.sql +++ b/hzims-service/hzims-alarm/src/main/resources/dict/dict.sql @@ -1,31 +1,31 @@ -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1434847945152356354, 0, 'alarm_source', '-1', '告警来源', 0, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1434847945152356361, 1434847945152356354, 'alarm_source', '0', 'HZ3000告警', 1, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1434847945152356362, 1434847945152356354, 'alarm_source', '1', '等级告警', 2, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1434847945152356363, 1434847945152356354, 'alarm_source', '2', '条件告警', 3, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1434847945152356364, 1434847945152356354, 'alarm_source', '3', 'FDP智能预警', 1, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1434847945152356365, 1434847945152356354, 'alarm_source', '4', '视频预警', 2, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1434847945152356366, 1434847945152356354, 'alarm_source', '5', '开关机告警', 3, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1451741563297222651, 0, 'level_alarm', '-1', '等级告警', 0, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1451741563297222652, 1451741563297222651, 'level_alarm', '21', '一级告警', 0, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1451741563297222653, 1451741563297222651, 'level_alarm', '22', '二级告警', 0, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1451741563297222654, 1451741563297222651, 'level_alarm', '23', '三级告警', 0, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597001, 0, 'alarm_type', '-1', '告警类型', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597002, 1597833496933597001, 'alarm_type', '2', '告警', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597003, 1597833496933597001, 'alarm_type', '3', '故障', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597004, 1597833496933597001, 'alarm_type', '5', '遥测越限', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597005, 1597833496933597001, 'alarm_type', '13', '通讯中断', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597006, 1597833496933597001, 'alarm_type', '14', '数据异常', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597007, 1597833496933597001, 'alarm_type', '21', '一级告警', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597008, 1597833496933597001, 'alarm_type', '22', '二级告警', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597009, 1597833496933597001, 'alarm_type', '23', '三级告警', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597010, 1597833496933597001, 'alarm_type', '30', '智能预警', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597011, 1597833496933597001, 'alarm_type', '40', '条件告警', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597012, 1597833496933597001, 'alarm_type', '50', '视频告警', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597013, 1597833496933597001, 'alarm_type', '60', '开机告警', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1597833496933597014, 1597833496933597001, 'alarm_type', '61', '关机告警', 0, '', 0, 0, 0, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160922111, 0, 'HZ3000_alarm', '-1', 'HZ3000告警', 0, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160922112, 1658763247160922111, 'HZ3000_alarm', '2', '告警', 0, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160922113, 1658763247160922111, 'HZ3000_alarm', '3', '故障', 0, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160922114, 1658763247160922111, 'HZ3000_alarm', '5', '遥测越限', 0, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160922115, 1658763247160922111, 'HZ3000_alarm', '13', '通讯中断', 0, '', 0, 0, 1, -1, 'hzims-alarm'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1658763247160922116, 1658763247160922111, 'HZ3000_alarm', '14', '数据异常', 0, '', 0, 0, 1, -1, 'hzims-alarm'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1434847945152356354, 0, 'ALARM_SOURCE', '-1', '告警来源', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1434847945152356361, 1434847945152356354, 'ALARM_SOURCE', '0', 'HZ3000告警', 1, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1434847945152356362, 1434847945152356354, 'ALARM_SOURCE', '1', '等级告警', 2, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1434847945152356363, 1434847945152356354, 'ALARM_SOURCE', '2', '条件告警', 3, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1434847945152356364, 1434847945152356354, 'ALARM_SOURCE', '3', 'FDP智能预警', 1, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1434847945152356365, 1434847945152356354, 'ALARM_SOURCE', '4', '视频预警', 2, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1434847945152356366, 1434847945152356354, 'ALARM_SOURCE', '5', '开关机告警', 3, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1451741563297222651, 0, 'LEVEL_ALARM', '-1', '等级告警', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1451741563297222652, 1451741563297222651, 'LEVEL_ALARM', '21', '一级告警', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1451741563297222653, 1451741563297222651, 'LEVEL_ALARM', '22', '二级告警', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1451741563297222654, 1451741563297222651, 'LEVEL_ALARM', '23', '三级告警', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597001, 0, 'ALARM_TYPE', '-1', '告警类型', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597002, 1597833496933597001, 'ALARM_TYPE', '2', '告警', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597003, 1597833496933597001, 'ALARM_TYPE', '3', '故障', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597004, 1597833496933597001, 'ALARM_TYPE', '5', '遥测越限', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597005, 1597833496933597001, 'ALARM_TYPE', '13', '通讯中断', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597006, 1597833496933597001, 'ALARM_TYPE', '14', '数据异常', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597007, 1597833496933597001, 'ALARM_TYPE', '21', '一级告警', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597008, 1597833496933597001, 'ALARM_TYPE', '22', '二级告警', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597009, 1597833496933597001, 'ALARM_TYPE', '23', '三级告警', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597010, 1597833496933597001, 'ALARM_TYPE', '30', '智能预警', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597011, 1597833496933597001, 'ALARM_TYPE', '40', '条件告警', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597012, 1597833496933597001, 'ALARM_TYPE', '50', '视频告警', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597013, 1597833496933597001, 'ALARM_TYPE', '60', '开机告警', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1597833496933597014, 1597833496933597001, 'ALARM_TYPE', '61', '关机告警', 0, '', 0, 0, 0, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1658763247160922111, 0, 'HZ3000_ALARM', '-1', 'HZ3000告警', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1658763247160922112, 1658763247160922111, 'HZ3000_ALARM', '2', '告警', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1658763247160922113, 1658763247160922111, 'HZ3000_ALARM', '3', '故障', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1658763247160922114, 1658763247160922111, 'HZ3000_ALARM', '5', '遥测越限', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1658763247160922115, 1658763247160922111, 'HZ3000_ALARM', '13', '通讯中断', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); +INSERT INTO `BLADEX`.`BLADE_DICT` (`ID`, `PARENT_ID`, `CODE`, `DICT_KEY`, `DICT_VALUE`, `SORT`, `REMARK`, `IS_SEALED`, `IS_DELETED`, `DICT_TYPE`, `APP_ID`, `APP_CODE`) VALUES (1658763247160922116, 1658763247160922111, 'HZ3000_ALARM', '14', '数据异常', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM'); diff --git a/hzims-service/hzims-middle/pom.xml b/hzims-service/hzims-middle/pom.xml index 95e026b..920d06e 100644 --- a/hzims-service/hzims-middle/pom.xml +++ b/hzims-service/hzims-middle/pom.xml @@ -116,6 +116,12 @@ com.hnac.hzims middle-api + + com.hnac.hzims + alarm-api + 4.0.0-SNAPSHOT + compile + diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/AlarmDealFlowServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/AlarmDealFlowServiceImpl.java new file mode 100644 index 0000000..6abec03 --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/AlarmDealFlowServiceImpl.java @@ -0,0 +1,68 @@ +package com.hnac.hzims.middle.processflow.strategy.serviceimpl; + +import com.hnac.hzims.alarm.config.feign.IAlarmHandleClient; +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.processflow.service.ProcessDictService; +import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService; +import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Service; + +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.DEAL_ALARM; + +/** + * 交接班v4 + * + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/7/26 9:04 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class AlarmDealFlowServiceImpl extends ProcessAbstractService { + + + private final ProcessDictService processDictService; + + + private final IAlarmHandleClient alarmHandleClient; + + /** + * 设置执行那种实现类 + * + * @param flowQueue + * @return + */ + @Override + public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { + String dictValue = processDictService.selectDictValueByKey(DEAL_ALARM); + if (dictValue.equals(flowQueue.getProcessDefinitionKey())) { + log.info("已执行告警处理流程程环节操作~~~~"); + return true; + } + log.error("未执行告警处理流程环节操作,请联系管理员~~~~"); + return false; + } + + + /** + * 交接班v4业务方法 + * + * @param response + */ + @Override + public void calculate(ProcessWorkFlowResponse response) { + log.info("告警处理流程执行中,param"+response); + R r = alarmHandleClient.listenAndUpdateAlarm(response); + if (!r.isSuccess()){ + log.error("消费告警处理失败"+response); + throw new ServiceException("告警处理流程消费失败"); + } + log.info("告警处理流程结束,param"+response); + } +}