|
|
@ -392,12 +392,12 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp |
|
|
|
return R.fail("未传入faultId参数"); |
|
|
|
return R.fail("未传入faultId参数"); |
|
|
|
} |
|
|
|
} |
|
|
|
/**获取故障对象**/ |
|
|
|
/**获取故障对象**/ |
|
|
|
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("获取对应故障对象失败");
|
|
|
|
} |
|
|
|
// }
|
|
|
|
//拿到最近一次未完成的任务
|
|
|
|
//拿到最近一次未完成的任务
|
|
|
|
FdpTaskEntity fdpTaskEntity = fdpTaskService.getOne(new LambdaQueryWrapper<FdpTaskEntity>() {{ |
|
|
|
FdpTaskEntity fdpTaskEntity = fdpTaskService.getOne(new LambdaQueryWrapper<FdpTaskEntity>() {{ |
|
|
|
eq(FdpTaskEntity::getFaultId, taskDTO.getFaultId()); |
|
|
|
eq(FdpTaskEntity::getFaultId, taskDTO.getFaultId()); |
|
|
@ -440,7 +440,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp |
|
|
|
r2.setSuccess(true); |
|
|
|
r2.setSuccess(true); |
|
|
|
r2.setMsg("获取信息成功"); |
|
|
|
r2.setMsg("获取信息成功"); |
|
|
|
DiagnoseStatusVo diagnoseStatusVo = new DiagnoseStatusVo(); |
|
|
|
DiagnoseStatusVo diagnoseStatusVo = new DiagnoseStatusVo(); |
|
|
|
R nextstep = fdpFaultService.getNextStepWithTree(fdpFaultEntity.getFdpId(), fdpFaultEntity.getStationId()); |
|
|
|
R nextstep = fdpFaultService.getNextStepWithTree(taskDTO.getFaultId(), taskDTO.getStation()); |
|
|
|
diagnoseStatusVo.setStatus(4); |
|
|
|
diagnoseStatusVo.setStatus(4); |
|
|
|
diagnoseStatusVo.setMessage("诊断成功"); |
|
|
|
diagnoseStatusVo.setMessage("诊断成功"); |
|
|
|
diagnoseStatusVo.setData(nextstep.getData()); |
|
|
|
diagnoseStatusVo.setData(nextstep.getData()); |
|
|
@ -589,18 +589,21 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R updateFaultState(DiagnoseFaultReq diagnoseFaultReq) { |
|
|
|
public R updateFaultState(DiagnoseFaultReq diagnoseFaultReq) { |
|
|
|
diagnoseFaultReq.setPriority(2); |
|
|
|
diagnoseFaultReq.setPriority(2); |
|
|
|
/**获取故障对象**/ |
|
|
|
// /**获取故障对象**/
|
|
|
|
LambdaQueryWrapper<FdpFaultEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
// LambdaQueryWrapper<FdpFaultEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
wrapper.eq(FdpFaultEntity::getFdpId, diagnoseFaultReq.getFaultId()).last("limit 1"); |
|
|
|
// wrapper.eq(FdpFaultEntity::getFdpId, diagnoseFaultReq.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("获取对应故障对象失败");
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(diagnoseFaultReq.getTaskId())){ |
|
|
|
Boolean hasKey = redisTemplate.hasKey(KEY_FOR_FDP_TASK_ID + "_" + diagnoseFaultReq.getTaskId().toString()); |
|
|
|
Boolean hasKey = redisTemplate.hasKey(KEY_FOR_FDP_TASK_ID + "_" + diagnoseFaultReq.getTaskId().toString()); |
|
|
|
//Redis中不存在,该任务过期
|
|
|
|
//Redis中不存在,该任务过期
|
|
|
|
if (!hasKey) { |
|
|
|
if (!hasKey) { |
|
|
|
return R.fail("该任务已过期,请重新生成任务"); |
|
|
|
return R.fail("该任务已过期,请重新生成任务"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**更新故障状态**/ |
|
|
|
/**更新故障状态**/ |
|
|
|
DiagnoseFaultAllReq faultAllReq = new DiagnoseFaultAllReq(); |
|
|
|
DiagnoseFaultAllReq faultAllReq = new DiagnoseFaultAllReq(); |
|
|
|
/**推送数据**/ |
|
|
|
/**推送数据**/ |
|
|
@ -608,14 +611,15 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp |
|
|
|
// FdpRealTimeAndHisDataVo pushResp = this.dataPushByPartition(fdpFaultEntity.getFdpPartition(), fdpFaultEntity.getCreateDept());
|
|
|
|
// FdpRealTimeAndHisDataVo pushResp = this.dataPushByPartition(fdpFaultEntity.getFdpPartition(), fdpFaultEntity.getCreateDept());
|
|
|
|
// faultAllReq.setAutoData(pushResp);
|
|
|
|
// faultAllReq.setAutoData(pushResp);
|
|
|
|
|
|
|
|
|
|
|
|
faultAllReq.setStationId(fdpFaultEntity.getStationId()); |
|
|
|
faultAllReq.setStationId(diagnoseFaultReq.getTenantId()); |
|
|
|
diagnoseFaultReq.setTenantId(fdpFaultEntity.getStationId()); |
|
|
|
|
|
|
|
diagnoseFaultReq.setLifeTime(24*3);//一旦用户进行修改,智能诊断时效性刷新为3天
|
|
|
|
diagnoseFaultReq.setLifeTime(24*3);//一旦用户进行修改,智能诊断时效性刷新为3天
|
|
|
|
faultAllReq.setManualData(diagnoseFaultReq); |
|
|
|
faultAllReq.setManualData(diagnoseFaultReq); |
|
|
|
String jsonString = JSONObject.toJSONString(faultAllReq); |
|
|
|
String jsonString = JSONObject.toJSONString(faultAllReq); |
|
|
|
System.out.println(jsonString); |
|
|
|
System.out.println(jsonString); |
|
|
|
HttpResponse r = HttpClientUtils.post(updateFaultStateAll, JSONObject.toJSONString(faultAllReq)); |
|
|
|
HttpResponse r = HttpClientUtils.post(updateFaultStateAll, JSONObject.toJSONString(faultAllReq)); |
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(diagnoseFaultReq.getTaskId())) { |
|
|
|
redisTemplate.expire(KEY_FOR_FDP_TASK_ID + "_" + diagnoseFaultReq.getTaskId(), 3, TimeUnit.DAYS); |
|
|
|
redisTemplate.expire(KEY_FOR_FDP_TASK_ID + "_" + diagnoseFaultReq.getTaskId(), 3, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
return JSONObject.parseObject(r.getData(), BaseResp.class).convert2R(); |
|
|
|
return JSONObject.parseObject(r.getData(), BaseResp.class).convert2R(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|