From 9a4434b86b84c72a59afe2fc956971a9faad5c80 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Mon, 26 Feb 2024 10:09:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E8=83=BD=E8=AF=8A=E6=96=AD=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/constants/AlarmHandleConstant.java | 2 +- .../hzims/alarm/config/entity/AlarmEntity.java | 6 +++ .../hnac/hzims/fdp/feign/IFdpDiagnoseClient.java | 2 +- .../fdp/controller/FdpHistoryDataController.java | 18 +++++++++ .../hzims/fdp/controller/FdpMonitorController.java | 2 +- .../hnac/hzims/fdp/feign/FdpDiagnoseClient.java | 3 +- .../impl/FdpFocusSurveillanceServiceImpl.java | 13 +----- .../service/impl/FdpHistoryDataServiceImpl.java | 2 +- .../service/impl/FdpListTableDataServiceImpl.java | 4 +- .../fdp/service/impl/FdpMonitorServiceImpl.java | 46 ++++++++++++---------- .../hzims/fdp/service/impl/FdpTaskServiceImpl.java | 16 +++++--- .../service/impl/AlarmHandleFlowServiceImpl.java | 22 +++++++++-- .../show/service/impl/AlarmHandleServiceImpl.java | 34 +++++++++------- .../source/service/impl/FdpAlarmServiceImpl.java | 2 + 14 files changed, 107 insertions(+), 65 deletions(-) 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 2694dbd..f5fa4b6 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 @@ -26,7 +26,7 @@ public interface AlarmHandleConstant { String FAULT = "3"; /**预警**/ - Long EARLY_WARNING = 20L; + Long EARLY_WARNING = 30L; String WEBSOCKET_FAULT = "3"; diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmEntity.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmEntity.java index 24442c8..a938a80 100644 --- a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmEntity.java +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmEntity.java @@ -49,6 +49,12 @@ public class AlarmEntity extends TenantEntity { @ApiModelProperty(value = "告警内容") private String alarmContext; + @ApiModelProperty(value = "初步分析原因") + private String diagReason; + + @ApiModelProperty(value = "建议处置方式") + private String diagSolution; + @ApiModelProperty(value = "告警状态") private Integer alarmStatus; 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 5073e28..49532f3 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 @@ -34,5 +34,5 @@ public interface IFdpDiagnoseClient { @PostMapping(GET_HISTORY_DATA) List getHistoryData(@RequestBody FDPFaultTableDTO req); @PostMapping(SET_FAULT_STATUS_INFO) - R setFaultStatusInfo(Map map); + R setFaultStatusInfo(@RequestBody Map map); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpHistoryDataController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpHistoryDataController.java index c29bf40..ce5abfd 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpHistoryDataController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpHistoryDataController.java @@ -10,6 +10,7 @@ import com.hnac.hzims.fdp.dto.FDPFaultTableDTO; import com.hnac.hzims.fdp.dto.FdpTaskDTO; import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity; import com.hnac.hzims.fdp.entity.FdpTaskEntity; +import com.hnac.hzims.fdp.service.IFdpFocusSurveillanceService; import com.hnac.hzims.fdp.service.IFdpHistoryDataService; import com.hnac.hzims.fdp.service.IFdpTaskService; import com.hnac.hzims.fdp.vo.FdpTaskVO; @@ -32,6 +33,8 @@ import org.springblade.core.tool.utils.StringUtil; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.util.HashMap; +import java.util.Map; /** * 故障诊断任务表 @@ -46,6 +49,8 @@ import javax.validation.Valid; public class FdpHistoryDataController extends BladeController { private final IFdpHistoryDataService service; + + private final IFdpFocusSurveillanceService fdpFocusSurveillanceService; /** * 分页 */ @@ -61,5 +66,18 @@ public class FdpHistoryDataController extends BladeController { } + /** + * 分页 + */ + @ApiLog + @PostMapping("/updateFaultHistory") + @ApiOperationSupport(order = 50) + @ApiOperation(value = "分页 查询参数:name,emId,faultId,reasonId,satisfaction") + @OperationAnnotation(moduleName = "智能诊断",title = "智能诊断任务",operatorType = OperatorType.MOBILE,businessType = + BusinessType.GENCODE, + action = "分页查询智能诊断任务列表") + public R> updateFaultHistory(@RequestBody Map map) { + return fdpFocusSurveillanceService.setFaultStatusInfo(map); + } } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java index 23a796a..9defa4c 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java @@ -194,7 +194,7 @@ public class FdpMonitorController extends BladeController { @ApiOperationSupport(order = 160) @ApiOperation(value = "数据追溯") public R dataBack(@RequestBody DataBackVo vo) { - service.dataBackV2(vo.getFaultId()); +// service.dataBackV2(vo.getFaultId()); return service.dataBackV2(vo.getFaultId()); } 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 03f1c07..1011563 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 @@ -11,6 +11,7 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; 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; import java.util.List; @@ -42,7 +43,7 @@ public class FdpDiagnoseClient implements IFdpDiagnoseClient { @Override @PostMapping(SET_FAULT_STATUS_INFO) - public R setFaultStatusInfo(Map map) { + public R setFaultStatusInfo(@RequestBody Map map) { return iFdpFocusSurveillanceService.setFaultStatusInfo(map); } } 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 index 1f0bfd9..44891f0 100644 --- 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 @@ -33,18 +33,6 @@ import java.util.*; @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; @@ -56,6 +44,7 @@ public class FdpFocusSurveillanceServiceImpl implements IFdpFocusSurveillanceSer */ @Override public R setFaultStatusInfo( Map map) { +// map.put("diag_reason",""); String post = HttpRequestUtil.postCallObjectParam(map, setFaultStatusInfo, "POST"); R r = JSONObject.parseObject(post, new TypeReference() {{}}); return r; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpHistoryDataServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpHistoryDataServiceImpl.java index 9859103..3f28c81 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpHistoryDataServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpHistoryDataServiceImpl.java @@ -50,7 +50,7 @@ public class FdpHistoryDataServiceImpl implements IFdpHistoryDataService { @Override public R> getHistoryData(FDPFaultTableDTO req) { IPage page = new Page<>(); - page.setSize(req.getPageSize()); + page.setSize(req.getPageSize()-1); page.setCurrent(req.getPageIndex()); req.setOrderBy("CREATE_TIME"); if (StringUtil.isBlank(req.getSource())){ diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpListTableDataServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpListTableDataServiceImpl.java index 03eb3c1..9ba5b68 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpListTableDataServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpListTableDataServiceImpl.java @@ -73,9 +73,9 @@ public class FdpListTableDataServiceImpl implements IFdpListTableDataService { public R getListByProperty(FDPFaultListInfoDTO req) { IPage page = new Page<>(); page.setSize(req.getPageSize()); - page.setCurrent(req.getPageIndex()); + page.setCurrent(req.getPageIndex()-1); req.setDisplay(1); - req.setIsRoot(1); + req.setIsRoot(0); req.setOrderBy("NAME"); req.setOrderKind("desc"); String result = HttpRequestUtil.postCallObjectParam(req, getNeoFaultTableData, "POST"); 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 393d0fc..041b7b6 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 @@ -392,12 +392,12 @@ 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("获取对应故障对象失败"); - } +// 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("获取对应故障对象失败"); +// } //拿到最近一次未完成的任务 FdpTaskEntity fdpTaskEntity = fdpTaskService.getOne(new LambdaQueryWrapper() {{ eq(FdpTaskEntity::getFaultId, taskDTO.getFaultId()); @@ -440,7 +440,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(FdpFaultEntity::getFdpId, diagnoseFaultReq.getFaultId()).last("limit 1"); - FdpFaultEntity fdpFaultEntity = fdpFaultService.getOne(wrapper); - if (ObjectUtil.isEmpty(fdpFaultEntity)) { - throw new ServiceException("获取对应故障对象失败"); - } - Boolean hasKey = redisTemplate.hasKey(KEY_FOR_FDP_TASK_ID + "_" + diagnoseFaultReq.getTaskId().toString()); - //Redis中不存在,该任务过期 - if (!hasKey) { - return R.fail("该任务已过期,请重新生成任务"); +// /**获取故障对象**/ +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.eq(FdpFaultEntity::getFdpId, diagnoseFaultReq.getFaultId()).last("limit 1"); +// FdpFaultEntity fdpFaultEntity = fdpFaultService.getOne(wrapper); +// if (ObjectUtil.isEmpty(fdpFaultEntity)) { +// throw new ServiceException("获取对应故障对象失败"); +// } + if(StringUtil.isNotBlank(diagnoseFaultReq.getTaskId())){ + Boolean hasKey = redisTemplate.hasKey(KEY_FOR_FDP_TASK_ID + "_" + diagnoseFaultReq.getTaskId().toString()); + //Redis中不存在,该任务过期 + if (!hasKey) { + return R.fail("该任务已过期,请重新生成任务"); + } } + /**更新故障状态**/ DiagnoseFaultAllReq faultAllReq = new DiagnoseFaultAllReq(); /**推送数据**/ @@ -608,14 +611,15 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl getFdpTaskEntityWrapper(TaskStatisticsVo statisticsVo) { 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 index f8fe32b..88ccba6 100644 --- 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 @@ -63,6 +63,7 @@ public class AlarmHandleFlowServiceImpl extends BaseServiceImpl map = new HashMap<>(); + map.put("uuid", alarmHandleFlowEntity.getAlarmId()); if (1l == alarmHandleFlowEntity.getHandleWay()) { //如果是误诊,把处理结果复制到误报原因 alarmHandleFlowEntity.setFalseAlarmDesc(alarmHandleFlowEntity.getDealDesc()); @@ -77,6 +80,18 @@ public class AlarmHandleFlowServiceImpl extends BaseServiceImpllambdaUpdate() + .set(AlarmHandleEntity::getHandleWay, alarmHandleFlowEntity.getHandleWay()) + .set(AlarmHandleEntity::getDelayCause, alarmHandleFlowEntity.getDelayCause()) + .set(AlarmHandleEntity::getDelayTime, alarmHandleFlowEntity.getDelayTime()) + .eq(AlarmHandleEntity::getAlarmId, alarmHandleFlowEntity.getAlarmId())); + map.put("result", "延后处理"); + map.put("result_info", alarmHandleFlowEntity.getDealDesc()); + map.put("diag_solution",""); } else { //流程结束把告警状态修改为结束 alarmHandleFlowEntity.setHandleWay(6L); @@ -85,13 +100,12 @@ public class AlarmHandleFlowServiceImpl extends BaseServiceImpl map = new HashMap<>(); - map.put("uuid", alarmHandleFlowEntity.getAlarmId()); - map.put("result", alarmHandleFlowEntity.getHandleWay()); - map.put("result_info", alarmHandleFlowEntity.getDealDesc()); //流程结束后才,调用fdp修改状态的接口 R r = iFdpDiagnoseClient.setFaultStatusInfo(map); if (!r.isSuccess()) { 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 23a6ebc..17310fe 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 @@ -74,21 +74,6 @@ 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("修改告警状态异常,请稍后重试!"); - } - } // 处理记录 AlarmHandleEntity entity = new AlarmHandleEntity(); entity.setAlarmId(param.getAlarmId()); @@ -112,6 +97,25 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl map=new HashMap<>(); + map.put("uuid",param.getAlarmId()); + if (1l==way){ + map.put("result","误报"); + map.put("diag_solution",param.getFalseAlarmDesc()); + } else if (2l==way){ + map.put("result","延后处理"); + map.put("result_info",param.getDelayCause()); + }else { + map.put("result","处理中"); + } + R r = iFdpDiagnoseClient.setFaultStatusInfo(map); + if (!r.isSuccess()){ + log.error("setFaultStatusInfo接口修改处理状态异常,参数为:"+param); + throw new ServiceException("修改告警状态异常,请稍后重试!"); + } + } //开启流程 if (AlarmHandleConstant.HANDLE.contains(way)) { alarmHandleFlowMapper.insert(param); 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 9e8d089..ca23e68 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 @@ -93,6 +93,8 @@ public class FdpAlarmServiceImpl implements FdpAlarmService { entity.setAlarmStatus(Integer.valueOf(item.getStatus())); entity.setAlarmValue(item.getInfo()); entity.setStationId(item.getStation()); + entity.setDiagReason(item.getDiagReason()); + entity.setDiagSolution(item.getDiagSolution()); entity.setAlarmSource(EARLY_WARNING); entity.setTenantId("200000"); R stationByCode = stationClient.getStationByCode(item.getStation());