|
|
|
@ -392,12 +392,12 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
|
|
|
|
|
return R.fail("未传入faultId参数"); |
|
|
|
|
} |
|
|
|
|
/**获取故障对象**/ |
|
|
|
|
LambdaQueryWrapper<FdpFaultEntity> 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<FdpFaultEntity> 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<FdpTaskEntity>() {{ |
|
|
|
|
eq(FdpTaskEntity::getFaultId, taskDTO.getFaultId()); |
|
|
|
@ -440,7 +440,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
|
|
|
|
|
r2.setSuccess(true); |
|
|
|
|
r2.setMsg("获取信息成功"); |
|
|
|
|
DiagnoseStatusVo diagnoseStatusVo = new DiagnoseStatusVo(); |
|
|
|
|
R nextstep = fdpFaultService.getNextStepWithTree(fdpFaultEntity.getFdpId(), fdpFaultEntity.getStationId()); |
|
|
|
|
R nextstep = fdpFaultService.getNextStepWithTree(taskDTO.getFaultId(), taskDTO.getStation()); |
|
|
|
|
diagnoseStatusVo.setStatus(4); |
|
|
|
|
diagnoseStatusVo.setMessage("诊断成功"); |
|
|
|
|
diagnoseStatusVo.setData(nextstep.getData()); |
|
|
|
@ -589,18 +589,21 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
|
|
|
|
|
@Override |
|
|
|
|
public R updateFaultState(DiagnoseFaultReq diagnoseFaultReq) { |
|
|
|
|
diagnoseFaultReq.setPriority(2); |
|
|
|
|
/**获取故障对象**/ |
|
|
|
|
LambdaQueryWrapper<FdpFaultEntity> 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<FdpFaultEntity> 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<FdpMonitorMapper, Fdp
|
|
|
|
|
// FdpRealTimeAndHisDataVo pushResp = this.dataPushByPartition(fdpFaultEntity.getFdpPartition(), fdpFaultEntity.getCreateDept());
|
|
|
|
|
// faultAllReq.setAutoData(pushResp);
|
|
|
|
|
|
|
|
|
|
faultAllReq.setStationId(fdpFaultEntity.getStationId()); |
|
|
|
|
diagnoseFaultReq.setTenantId(fdpFaultEntity.getStationId()); |
|
|
|
|
faultAllReq.setStationId(diagnoseFaultReq.getTenantId()); |
|
|
|
|
diagnoseFaultReq.setLifeTime(24*3);//一旦用户进行修改,智能诊断时效性刷新为3天
|
|
|
|
|
faultAllReq.setManualData(diagnoseFaultReq); |
|
|
|
|
String jsonString = JSONObject.toJSONString(faultAllReq); |
|
|
|
|
System.out.println(jsonString); |
|
|
|
|
HttpResponse r = HttpClientUtils.post(updateFaultStateAll, JSONObject.toJSONString(faultAllReq)); |
|
|
|
|
redisTemplate.expire(KEY_FOR_FDP_TASK_ID + "_" + diagnoseFaultReq.getTaskId(), 3, TimeUnit.DAYS); |
|
|
|
|
if(StringUtil.isNotBlank(diagnoseFaultReq.getTaskId())) { |
|
|
|
|
redisTemplate.expire(KEY_FOR_FDP_TASK_ID + "_" + diagnoseFaultReq.getTaskId(), 3, TimeUnit.DAYS); |
|
|
|
|
} |
|
|
|
|
return JSONObject.parseObject(r.getData(), BaseResp.class).convert2R(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|