Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
liwen 9 months ago
parent
commit
be8a7fce59
  1. 6
      hzims-service-api/alarm-api/pom.xml
  2. 38
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/constants/AlarmHandleConstant.java
  3. 31
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmHandleEntity.java
  4. 104
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmHandleFlowEntity.java
  5. 22
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/feign/Fallback/IAlarmHandleClientFallback.java
  6. 33
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/feign/IAlarmHandleClient.java
  7. 3
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/AlarmHandleVo.java
  8. 17
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/FdpAlarmVo.java
  9. 3
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClient.java
  10. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClientFallBack.java
  11. 2
      hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java
  12. 11
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpListTableDataController.java
  13. 9
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpDiagnoseClient.java
  14. 14
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java
  15. 17
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpFocusSurveillanceService.java
  16. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFaultServiceImpl.java
  17. 73
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFocusSurveillanceServiceImpl.java
  18. 18
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java
  19. 3
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/AlarmHandleController.java
  20. 26
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/feign/AlarmHandleClient.java
  21. 16
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleFlowMapper.java
  22. 6
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleFlowMapper.xml
  23. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml
  24. 18
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleFlowService.java
  25. 3
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java
  26. 137
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java
  27. 99
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java
  28. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java
  29. 74
      hzims-service/hzims-alarm/src/main/resources/db/1.0.0.sql
  30. 62
      hzims-service/hzims-alarm/src/main/resources/dict/dict.sql
  31. 6
      hzims-service/hzims-middle/pom.xml
  32. 68
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/AlarmDealFlowServiceImpl.java

6
hzims-service-api/alarm-api/pom.xml

@ -7,6 +7,12 @@
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<version>4.0.0-SNAPSHOT</version> <version>4.0.0-SNAPSHOT</version>
</parent> </parent>
<dependencies>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>middle-api</artifactId>
</dependency>
</dependencies>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>alarm-api</artifactId> <artifactId>alarm-api</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>

38
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 * @author YSJ
*/ */
public interface AlarmHandleConstant { public interface AlarmHandleConstant {
List<String> INTERRUPT_LIST = Arrays.asList("13","14");
List<String> TYPE_LIST = Arrays.asList("3","2","5","10","13","14");
List<Long> LONG_TYPE_LIST = Arrays.asList(3L,2L,5L,10L,13L,14L);
List<String> 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 SYSTEM_TYPE_LIST = "3,2,5,13,14";
/**通讯恢复*/
String ABNORMAL_STATUS = "1";
/**故障**/ /**故障**/
String FAULT = "3"; String FAULT = "3";
/**预警**/ /**预警**/
Long EARLY_WARNING = 20L; Long EARLY_WARNING = 20L;
String WEBSOCKET_FAULT = "3";
String[] TYPE_NAMES = {"默认", "系统", "告警"
, "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"};
/**误报 、延后、缺陷 、检修、处理*/ /**误报 、延后、缺陷 、检修、处理*/
List<Long> HANDLE_WAY = Arrays.asList(1L,2L,3L,4L,5L); List<Long> HANDLE_WAY = Arrays.asList(1L,2L,3L,4L,5L);
List<Long> HANDLE = Arrays.asList(3L,4L,5L); List<Long> HANDLE = Arrays.asList(3L,4L,5L);
String dealAlarm = "dealAlarm";
/** /**
* 2-告警,3-故障,5-遥测越限,13-通讯异常,14-数据异常
*/
List<Integer> SOE_TYPE_LIST = Arrays.asList(2,3,5,13,14);
/**
* 告警等级: 0 - 1级告警 1-二级告警
*/
List<String> LEVEL_LIST = Arrays.asList("0","1");
/**
* 告警类型: HZ3000告警
*/
Integer SYSTEM_ALARM = 0;
/**
* 告警类型: 智能告警
*/
Integer INTELLIGENCE_ALARM = 1;
/**
* 告警类型: 视频告警 * 告警类型: 视频告警
*/ */
Integer VIDEO_ALARM = 4; Integer VIDEO_ALARM = 4;

31
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("告警内容") @ApiModelProperty("告警内容")
private String alarmContent; private String alarmContent;
@ApiModelProperty("处理方式") @ApiModelProperty("告警处理状态 1L,2L,3L,4L,5L,6l 误报 、延后、缺陷 、检修、处理中、处理完毕 ")
private Long handleWay; 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;
} }

104
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;
}

22
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;
}
}

33
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);
}

3
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("通知处理人") @ApiModelProperty("通知处理人")
private Long handleUser; private Long handleUser;
@ApiModelProperty("通知处理人")
private String handleUserFlow;
@ApiModelProperty("现象Id") @ApiModelProperty("现象Id")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)

17
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 Date createTime;
/**
* 处置状态
*/
private String result;
/**
* 初步分析结果
*/
private String diagReason;
/**
* 处置方式
*/
private String diagSolution;
} }

3
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 API_PREFIX = "/feign/fdp/diagnose";
String GET_STATISTIC_STATUS = API_PREFIX + "/getStatisticStatus"; String GET_STATISTIC_STATUS = API_PREFIX + "/getStatisticStatus";
String GET_HISTORY_DATA = API_PREFIX + "/getHistoryData"; String GET_HISTORY_DATA = API_PREFIX + "/getHistoryData";
String SET_FAULT_STATUS_INFO = API_PREFIX + "/setFaultStatusInfo";
@PostMapping(GET_STATISTIC_STATUS) @PostMapping(GET_STATISTIC_STATUS)
R<Map<String,List<StatisticStatusVO>>> getStatisticStatus(@RequestBody StatisticStatusDTO req); R<Map<String,List<StatisticStatusVO>>> getStatisticStatus(@RequestBody StatisticStatusDTO req);
@PostMapping(GET_HISTORY_DATA) @PostMapping(GET_HISTORY_DATA)
List<FdpFaultHistoryDataEntity> getHistoryData(@RequestBody FDPFaultTableDTO req); List<FdpFaultHistoryDataEntity> getHistoryData(@RequestBody FDPFaultTableDTO req);
@PostMapping(SET_FAULT_STATUS_INFO)
R setFaultStatusInfo(Map<String, Object> map);
} }

5
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<FdpFaultHistoryDataEntity> getHistoryData(FDPFaultTableDTO req) { public List<FdpFaultHistoryDataEntity> getHistoryData(FDPFaultTableDTO req) {
return new ArrayList<>(); return new ArrayList<>();
} }
@Override
public R setFaultStatusInfo(Map<String, Object> map) {
return R.fail("调用接口失败");
}
} }

2
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 DUTY_REC = "duty_rec";
public static final String DEAL_ALARM = "dealAlarm";
/** /**
* 线下工作票 * 线下工作票
*/ */

11
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpListTableDataController.java

@ -32,24 +32,27 @@ public class FdpListTableDataController extends BladeController {
@Resource @Resource
private final IFdpListTableDataService service; private final IFdpListTableDataService service;
/** /**
* * 下拉列表
*/ */
@ApiLog @ApiLog
@GetMapping("/getProperty") @GetMapping("/getProperty")
@ApiOperationSupport(order = 50) @ApiOperationSupport(order = 50)
@ApiOperation(value = "分页 查询参数:name,emId,faultId,reasonId,satisfaction") @ApiOperation(value = "分页 查询参数:name,emId,faultId,reasonId,satisfaction")
@OperationAnnotation(moduleName = "智能诊断",title = "智能诊断任务",operatorType = OperatorType.MOBILE,businessType = @OperationAnnotation(moduleName = "智能诊断",title = "下拉列表页",operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE, BusinessType.GENCODE,
action = "分页查询智能诊断任务列表") action = "下拉列表页")
public R getProperty(String property) { public R getProperty(String property) {
return service.getProperty(property); return service.getProperty(property);
} }
/**
* 分页查询智能诊断任务列表
*/
@ApiLog @ApiLog
@PostMapping ("/getListByProperty") @PostMapping ("/getListByProperty")
@ApiOperationSupport(order = 50) @ApiOperationSupport(order = 50)
@ApiOperation(value = "分页 查询参数:name,emId,faultId,reasonId,satisfaction") @ApiOperation(value = "分页 查询参数:name,emId,faultId,reasonId,satisfaction")
@OperationAnnotation(moduleName = "智能诊断",title = "智能诊断任务",operatorType = OperatorType.MOBILE,businessType = @OperationAnnotation(moduleName = "智能诊断",title = "分页查询智能诊断任务列表",operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE, BusinessType.GENCODE,
action = "分页查询智能诊断任务列表") action = "分页查询智能诊断任务列表")
public R getListByProperty(@RequestBody FDPFaultListInfoDTO req) { public R getListByProperty(@RequestBody FDPFaultListInfoDTO req) {

9
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.dto.StatisticStatusDTO;
import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity; import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity;
import com.hnac.hzims.fdp.proxy.IDiagnoseProxy; 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.service.IFdpHistoryDataService;
import com.hnac.hzims.fdp.vo.FdpFaultHistoryDataVo;
import com.hnac.hzims.fdp.vo.StatisticStatusVO; import com.hnac.hzims.fdp.vo.StatisticStatusVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -26,6 +26,7 @@ public class FdpDiagnoseClient implements IFdpDiagnoseClient {
private final IDiagnoseProxy service; private final IDiagnoseProxy service;
private final IFdpHistoryDataService fdpHistoryDataService; private final IFdpHistoryDataService fdpHistoryDataService;
private final IFdpFocusSurveillanceService iFdpFocusSurveillanceService;
@Override @Override
@PostMapping(GET_STATISTIC_STATUS) @PostMapping(GET_STATISTIC_STATUS)
@ -38,4 +39,10 @@ public class FdpDiagnoseClient implements IFdpDiagnoseClient {
public List<FdpFaultHistoryDataEntity> getHistoryData(FDPFaultTableDTO req) { public List<FdpFaultHistoryDataEntity> getHistoryData(FDPFaultTableDTO req) {
return fdpHistoryDataService.exportHistoryData(req); return fdpHistoryDataService.exportHistoryData(req);
} }
@Override
@PostMapping(SET_FAULT_STATUS_INFO)
public R setFaultStatusInfo(Map<String, Object> map) {
return iFdpFocusSurveillanceService.setFaultStatusInfo(map);
}
} }

14
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 { try {
Runnable runnable = new Runnable() { Runnable runnable = new Runnable() {
@Override @Override
public void run() { public void run() {
//异步任务 //异步任务
updateFaultStateNew(taskDTO, fdpFaultEntity, key); updateFaultStateNew(taskDTO, key);
} }
}; };
Thread thread = new Thread(runnable); Thread thread = new Thread(runnable);
@ -198,19 +198,19 @@ public class ThreadTask {
* 修改诊断状态 * 修改诊断状态
* @param key * @param key
*/ */
private static void updateFaultStateNew(FdpTaskDTO req, FdpFaultEntity fdpFaultEntity, String key) { private static void updateFaultStateNew(FdpTaskDTO req, String key) {
/**更新故障状态**/ /**更新故障状态**/
DiagnoseFaultAllReq faultAllReq = new DiagnoseFaultAllReq(); DiagnoseFaultAllReq faultAllReq = new DiagnoseFaultAllReq();
// faultAllReq.setAutoData(vo); // faultAllReq.setAutoData(vo);
faultAllReq.setStationId(fdpFaultEntity.getStationId()); faultAllReq.setStationId(req.getStation());
DiagnoseFaultReq diagnoseFaultReq = new DiagnoseFaultReq(); DiagnoseFaultReq diagnoseFaultReq = new DiagnoseFaultReq();
diagnoseFaultReq.setTaskId(key); diagnoseFaultReq.setTaskId(key);
diagnoseFaultReq.setFaultId(req.getFaultId()); diagnoseFaultReq.setFaultId(req.getFaultId());
diagnoseFaultReq.setConfidence(1.0); diagnoseFaultReq.setConfidence(1.0);
diagnoseFaultReq.setLifeTime(24*3);//设置有效期3天 diagnoseFaultReq.setLifeTime(24*3);//设置有效期3天
diagnoseFaultReq.setPriority(2); diagnoseFaultReq.setPriority(-1);
diagnoseFaultReq.setTenantId(fdpFaultEntity.getStationId()); diagnoseFaultReq.setTenantId(req.getStation());
diagnoseFaultReq.setCreateUser(ObjectUtil.isEmpty(AuthUtil.getUser()) ? "告警推送" : AuthUtil.getUser().getUserName()); diagnoseFaultReq.setCreateUser(ObjectUtil.isEmpty(AuthUtil.getUser()) ? "告警推送" : AuthUtil.getUser().getUserName());
faultAllReq.setManualData(diagnoseFaultReq); faultAllReq.setManualData(diagnoseFaultReq);
@ -240,7 +240,7 @@ public class ThreadTask {
r2.setData(diagnoseStatusVo); r2.setData(diagnoseStatusVo);
threadTask.redisTemplate.opsForValue().set(threadTask.fdpReturnValuePath + "_" + key, JSONObject.toJSONString(r2)); threadTask.redisTemplate.opsForValue().set(threadTask.fdpReturnValuePath + "_" + key, JSONObject.toJSONString(r2));
if (r1.isSuccess()) { 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.setStatus(4);
diagnoseStatusVo.setMessage("诊断成功"); diagnoseStatusVo.setMessage("诊断成功");
diagnoseStatusVo.setData(nextstep.getData()); diagnoseStatusVo.setData(nextstep.getData());

17
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<String, Object> map);
}

2
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpFaultServiceImpl.java

@ -104,7 +104,7 @@ public class FdpFaultServiceImpl extends BaseServiceImpl<FdpFaultMapper, FdpFaul
public List<FaultStateResp> getFaultAmountTrend(String stationId, String faultId , String start, String end){ public List<FaultStateResp> getFaultAmountTrend(String stationId, String faultId , String start, String end){
Map<String,Object> params = new HashMap<>(3); Map<String,Object> params = new HashMap<>(3);
/**获取故障stationId**/ /**获取故障stationId**/
stationId = this.getStationIdByFdpId(faultId); // stationId = this.getStationIdByFdpId(faultId);
if(StringUtil.isEmpty(stationId)){ if(StringUtil.isEmpty(stationId)){
throw new ServiceException("获取当前故障站点ID失败"); throw new ServiceException("获取当前故障站点ID失败");
} }

73
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<String, Object> map) {
String post = HttpRequestUtil.postCallObjectParam(map, setFaultStatusInfo, "POST");
R r = JSONObject.parseObject(post, new TypeReference<R>() {{}});
return r;
// if (r.isSuccess()){
// return R.success("修改成功");
// }else {
// return R.fail(r.getMsg());
// }
}
}

18
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java

@ -518,14 +518,14 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
@Override @Override
public R getRealTimeHisDataNew(FdpTaskDTO taskDTO) { public R getRealTimeHisDataNew(FdpTaskDTO taskDTO) {
/**获取故障对象**/ // /**获取故障对象**/
LambdaQueryWrapper<FdpFaultEntity> wrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<FdpFaultEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FdpFaultEntity::getFdpId, taskDTO.getFaultId()).last("limit 1"); // wrapper.eq(FdpFaultEntity::getFdpId, taskDTO.getFaultId()).last("limit 1");
FdpFaultEntity fdpFaultEntity = fdpFaultService.getOne(wrapper); // FdpFaultEntity fdpFaultEntity = fdpFaultService.getOne(wrapper);
if (ObjectUtil.isEmpty(fdpFaultEntity)) { // if (ObjectUtil.isEmpty(fdpFaultEntity)) {
throw new ServiceException("获取对应故障对象失败"); // throw new ServiceException("获取对应故障对象失败");
} // }
taskDTO.setFdpDeviceName(fdpFaultEntity.getFdpDeviceName()); // taskDTO.setFdpDeviceName(fdpFaultEntity.getFdpDeviceName());
// /**获取实时、历史数据**/ // /**获取实时、历史数据**/
// FdpRealTimeAndHisDataVo pushResp = this.dataPushByPartition(fdpFaultEntity.getFdpPartition(), fdpFaultEntity.getCreateDept()); // FdpRealTimeAndHisDataVo pushResp = this.dataPushByPartition(fdpFaultEntity.getFdpPartition(), fdpFaultEntity.getCreateDept());
// String key = UUID.randomUUID().toString(); // String key = UUID.randomUUID().toString();
@ -567,7 +567,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
redisTemplate.expire(KEY_FOR_FDP_TASK_ID + "_" + key, 3, TimeUnit.DAYS); redisTemplate.expire(KEY_FOR_FDP_TASK_ID + "_" + key, 3, TimeUnit.DAYS);
} }
// //异步处理 20230426 此接口弃用 // //异步处理 20230426 此接口弃用
ThreadTask.fdpTaskNew(taskDTO, fdpFaultEntity, key); ThreadTask.fdpTaskNew(taskDTO, key);
//获取数据成功-》 告知前端 //获取数据成功-》 告知前端
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("id", key); map.put("id", key);

3
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.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; 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.config.vo.AlarmHandleVo;
import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.alarm.show.service.AlarmHandleService;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
@ -40,7 +41,7 @@ public class AlarmHandleController extends BladeController {
@PostMapping("/execute") @PostMapping("/execute")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "告警处理", notes = "传入AlarmHandleEntity") @ApiOperation(value = "告警处理", notes = "传入AlarmHandleEntity")
public R execute(@RequestBody AlarmHandleVo param) { public R execute(@RequestBody AlarmHandleFlowEntity param) {
return R.status(service.execute(param)); return R.status(service.execute(param));
} }

26
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);
}
}

16
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<AlarmHandleFlowEntity> {
}

6
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleFlowMapper.xml

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

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHandleMapper.xml

@ -38,14 +38,12 @@
<select id="handles" resultType="java.lang.String"> <select id="handles" resultType="java.lang.String">
SELECT HANDLER.ALARM_ID SELECT HANDLER.ALARM_ID
FROM HZIMS_ALARM_HANDLE HANDLER FROM HZIMS_ALARM_HANDLE HANDLER
LEFT JOIN HZIMS_ALARM_HANDLE_DETAIL DETAIL
ON HANDLER.DETAIL_ID = DETAIL.ID
<where> <where>
HANDLER.IS_DELETED = 0 HANDLER.IS_DELETED = 0
<if test="start != null and end != null"> <if test="start != null and end != null">
AND HANDLER.CREATE_TIME BETWEEN #{start} AND #{end} AND HANDLER.CREATE_TIME BETWEEN #{start} AND #{end}
</if> </if>
AND (DETAIL.DELAY_TIME &gt; #{end} OR DETAIL.DELAY_TIME IS NULL) AND (HANDLER.DELAY_TIME &gt; #{end} OR HANDLER.DELAY_TIME IS NULL)
</where> </where>
</select> </select>
</mapper> </mapper>

18
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<AlarmHandleFlowEntity> {
R listenAndUpdate(ProcessWorkFlowResponse processWorkFlowResponse);
}

3
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.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.entity.AlarmHandleEntity; 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.alarm.config.vo.AlarmHandleVo;
import com.hnac.hzims.operational.alert.vo.HandleQueryVo; import com.hnac.hzims.operational.alert.vo.HandleQueryVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
@ -17,7 +18,7 @@ import java.util.List;
*/ */
public interface AlarmHandleService extends BaseService<AlarmHandleEntity> { public interface AlarmHandleService extends BaseService<AlarmHandleEntity> {
boolean execute(AlarmHandleVo param); boolean execute(AlarmHandleFlowEntity param);
IPage<AlarmHandleVo> pageCondition(Query query, HandleQueryVo param); IPage<AlarmHandleVo> pageCondition(Query query, HandleQueryVo param);

137
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<AlarmHandleFlowMapper, AlarmHandleFlowEntity> 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<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables();
//现象缺陷全表更新
alarmHandleFlowEntity= JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<AlarmHandleFlowEntity>(){});
} 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<String, Object> 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.<AlarmHandleEntity>lambdaUpdate()
.set(AlarmHandleEntity::getHandleWay, alarmHandleFlowEntity.getHandleWay())
.set(AlarmHandleEntity::getFalseAlarmDesc, alarmHandleFlowEntity.getDealDesc())
.eq(AlarmHandleEntity::getAlarmId, alarmHandleFlowEntity.getAlarmId()));
}else {
//设置处理完成
alarmHandleMapper.update(null,Wrappers.<AlarmHandleEntity>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<String> 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);
}
}
}

99
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; package com.hnac.hzims.alarm.show.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.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.mapper.AlarmHandleMapper;
import com.hnac.hzims.alarm.show.service.AlarmHandleDetailService; import com.hnac.hzims.alarm.show.service.AlarmHandleDetailService;
import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.alarm.show.service.AlarmHandleService;
import com.hnac.hzims.alarm.show.wrapper.HandleWrapper; import com.hnac.hzims.alarm.show.wrapper.HandleWrapper;
import com.hnac.hzims.alarm.config.vo.AlarmHandleVo; 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.feign.IFdpMonitorClient;
import com.hnac.hzims.fdp.vo.UpdateFaultStateVo; import com.hnac.hzims.fdp.vo.UpdateFaultStateVo;
import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; 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.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; 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.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.feign.ISysClient;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.xml.ws.WebServiceException;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -47,6 +59,13 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
private final IFdpMonitorClient fdpMonitorClient; private final IFdpMonitorClient fdpMonitorClient;
private final IFlowClient processClient;
private final IFdpDiagnoseClient iFdpDiagnoseClient;
private final AlarmHandleFlowMapper alarmHandleFlowMapper;
/** /**
* 告警处理 * 告警处理
* *
@ -54,60 +73,66 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
* @return * @return
*/ */
@Override @Override
public boolean execute(AlarmHandleVo param) { public boolean execute(AlarmHandleFlowEntity param) {
Long way = param.getHandleWay(); Long way = param.getHandleWay();
if (!AlarmHandleConstant.HANDLE_WAY.contains(way)) { if (!AlarmHandleConstant.HANDLE_WAY.contains(way)) {
throw new ServiceException("无效处理!"); throw new ServiceException("无效处理!");
} }
// 预警 // 预警
if(AlarmHandleConstant.EARLY_WARNING.equals(param.getAlarmType())){ if(AlarmHandleConstant.EARLY_WARNING.equals(param.getAlarmType())){
this.updateFalultState(param); Map<String, Object> 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(); AlarmHandleEntity entity = new AlarmHandleEntity();
entity.setAlarmId(param.getAlarmId()); entity.setAlarmId(param.getAlarmId());
entity.setType(param.getType()); entity.setType(param.getType());
// entity.setDetailId(detail.getId());
entity.setAlarmTime(param.getAlarmTime()); entity.setAlarmTime(param.getAlarmTime());
entity.setAlarmContent(param.getAlarmContent()); entity.setAlarmContent(param.getAlarmContent());
entity.setHandleWay(param.getHandleWay()); entity.setHandleWay(param.getHandleWay());
entity.setStationCode(param.getStationCode()); entity.setStationCode(param.getStationCode());
entity.setAlarmType(param.getAlarmType()); entity.setAlarmType(param.getAlarmType());
return this.save(entity); // entity.setAccessId(param.getAccessId());
} // entity.setPhenomenonId(param.getPhenomenonId());
entity.setHandleUser(param.getHandleUser());
/** entity.setHandleUser(param.getHandleUser());
* 预警处理推送智能诊断服务 entity.setDelayTime(param.getDelayTime());
* @param param entity.setDelayCause(param.getDelayCause());
*/ entity.setFalseAlarmDesc(param.getFalseAlarmDesc());
private void updateFalultState(AlarmHandleVo param) { entity.setFilePath(param.getFilePath());
try{ if (StringUtils.isNotBlank(AuthUtil.getUserName())){
UpdateFaultStateVo state = new UpdateFaultStateVo(); entity.setCreateUserName(AuthUtil.getNickName());
state.setStationId(param.getStationCode()); entity.setCreateDeptName(param.getCreateDeptName());
state.setFaultId(param.getAlarmId()); }
if(AlarmHandleConstant.HANDLE.contains(param.getHandleWay())){ this.save(entity);
state.setConfidence(1f); //开启流程
}else{ if (AlarmHandleConstant.HANDLE.contains(way)) {
state.setConfidence(0f); alarmHandleFlowMapper.insert(param);
// 流程名称
String processName = "[" + AuthUtil.getUserName() + "] 发起 " + "【" + param.getAlarmContent() + "】告警处理流程";
// 开启告警处理流程
String businessKey = FlowUtil.getBusinessKey("hzims_alarm_handle", "" + param.getId());
Map<String, Object> variable = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(param,DateUtil.PATTERN_DATETIME), Map.class);
R<BladeFlow> 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)); param.setProcessInstanceId(result.getData().getProcessInstanceId());
state.setCreateUser(String.valueOf(AuthUtil.getUserId())); alarmHandleFlowMapper.updateById(param);
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());
} }
return true;
} }
/** /**

2
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.setAlarmTime(item.getCreateTime());
entity.setAlarmContext(item.getFinfo()); entity.setAlarmContext(item.getFinfo());
entity.setAlarmType(EARLY); entity.setAlarmType(EARLY);
entity.setDeviceCode(item.getDeviceCode()); entity.setDeviceCode(item.getDeviceId());
entity.setDeviceName(item.getDeviceName()); entity.setDeviceName(item.getDeviceName());
entity.setAlarmStatus(Integer.valueOf(item.getStatus())); entity.setAlarmStatus(Integer.valueOf(item.getStatus()));
entity.setStationId(item.getStation()); entity.setStationId(item.getStation());

74
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`; DROP TABLE IF EXISTS `HZIMS_ALARM_HANDLE`;
CREATE TABLE `HZIMS_ALARM_HANDLE` ( CREATE TABLE `HZIMS_ALARM_HANDLE` (
`ID` bigint(20) NOT NULL COMMENT '主键ID', `ID` bigint(20) NOT NULL COMMENT '主键ID',
`ALARM_ID` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 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 '站点编号', `STATION_CODE` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点编号',
`ALARM_TYPE` smallint(6) NULL DEFAULT NULL COMMENT '告警类型', `ALARM_TYPE` smallint(6) NULL DEFAULT NULL COMMENT '告警类型',
`ALARM_TIME` datetime(0) 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 '告警内容', `ALARM_CONTENT` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '告警内容',
`TYPE` tinyint(1) NULL DEFAULT NULL COMMENT '类型:0-系统告警 1-智能告警', `TYPE` tinyint(1) NULL DEFAULT NULL COMMENT '类型:0-系统告警 1-智能告警',
`HANDLE_WAY` smallint(6) NULL DEFAULT NULL COMMENT '处理方式', `HANDLE_WAY` smallint(6) NULL DEFAULT NULL COMMENT '处理方式',
`TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
`CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间', `CREATE_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', `UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人',
`UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人',
`IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
`STATUS` tinyint(4) NOT NULL DEFAULT 0 COMMENT '状态', `STATUS` tinyint(4) NOT NULL DEFAULT 0 COMMENT '状态',
`CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门', `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
`HANDLE_USER` bigint(20) NULL DEFAULT NULL COMMENT '通知处理人', `HANDLE_USER` bigint(20) NULL DEFAULT NULL COMMENT '通知处理人',
`PHENOMENON_ID` bigint(20) NULL DEFAULT NULL COMMENT '现象ID', `PHENOMENON_ID` bigint(20) NULL DEFAULT NULL COMMENT '现象ID',
`ACCESS_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_TIME` datetime(0) NULL DEFAULT NULL COMMENT '延后时间',
`DELAY_CAUSE` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci 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 '误报描述', `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 '附件路径', `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_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 '创建机构名称', `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 '创建部门',
PRIMARY KEY (`ID`) USING BTREE PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC; ) ENGINE = INNODB CHARACTER SET = UTF8 COLLATE = UTF8_GENERAL_CI ROW_FORMAT = DYNAMIC;

62
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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (1658763247160922116, 1658763247160922111, 'HZ3000_ALARM', '14', '数据异常', 0, '', 0, 0, 1, -1, 'HZIMS-ALARM');

6
hzims-service/hzims-middle/pom.xml

@ -116,6 +116,12 @@
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>middle-api</artifactId> <artifactId>middle-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>alarm-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

68
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);
}
}
Loading…
Cancel
Save