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 e0f78b8..2cf138e 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 @@ -22,7 +22,6 @@ import com.hnac.hzims.monitor.dto.FdpMonitorBindingDTO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeInstanceFieldVO; import io.swagger.annotations.*; import lombok.AllArgsConstructor; -import org.apache.ibatis.annotations.Param; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.log.annotation.ApiLog; import org.springblade.core.mp.support.Condition; @@ -274,7 +273,8 @@ public class FdpMonitorController extends BladeController { @ApiOperationSupport(order = 180) @ApiOperation(value = "获取实时、历史数据返回生成ID-旧版") public R getRealTimeHisData(@RequestBody FdpTaskDTO taskDTO){ - return service.getRealTimeHisData(taskDTO); +// return service.getRealTimeHisData(taskDTO); + return R.fail("此端口弃用,请访问新的接口"); } @PostMapping("/updateFaultStateAll/getRealTimeHisDataNew") diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/DiagnoseFaultReq.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/DiagnoseFaultReq.java index 2dd8825..d215ec5 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/DiagnoseFaultReq.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/request/DiagnoseFaultReq.java @@ -1,7 +1,6 @@ package com.hnac.hzims.fdp.request; import com.alibaba.fastjson.annotation.JSONField; -import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -24,7 +23,7 @@ public class DiagnoseFaultReq implements Serializable { @ApiModelProperty(value = "故障可信度 人工诊断点击或者人工发现时,该故障的状态,发生为1,不发生为0。不确认发生或没发生时填入0-1之间的值。", required = true) @JSONField(name = "confidence") - private Double status; + private Double confidence; @ApiModelProperty("是否有效") @JSONField(name = "is_deleted") diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java index 1c1a221..f70139a 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java @@ -13,7 +13,6 @@ import com.hnac.hzims.fdp.response.DiagnoseNextstepResp; import com.hnac.hzims.fdp.service.IFdpFaultService; import com.hnac.hzims.fdp.util.HttpRequestUtil; import com.hnac.hzims.fdp.vo.FdpHttpResponseVo; -import com.hnac.hzims.fdp.vo.FdpRealTimeAndHisDataVo; import lombok.extern.slf4j.Slf4j; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; @@ -50,13 +49,13 @@ public class ThreadTask { //诊断 - public static void fdpTask(FdpTaskDTO taskDTO, FdpFaultEntity fdpFaultEntity, FdpRealTimeAndHisDataVo vo, String key) { + public static void fdpTask(FdpTaskDTO taskDTO, FdpFaultEntity fdpFaultEntity, String key) { try { Runnable runnable = new Runnable() { @Override public void run() { //异步任务 - updateFaultState(taskDTO, fdpFaultEntity, vo, key); + updateFaultState(taskDTO, fdpFaultEntity, key); } }; Thread thread = new Thread(runnable); @@ -84,6 +83,24 @@ public class ThreadTask { // } // } + + + //诊断 + public static void fdpTaskNew(FdpTaskDTO taskDTO, FdpFaultEntity fdpFaultEntity, String key) { + try { + Runnable runnable = new Runnable() { + @Override + public void run() { + //异步任务 + updateFaultStateNew(taskDTO, fdpFaultEntity, key); + } + }; + Thread thread = new Thread(runnable); + thread.start(); + } catch (Exception e) { + log.error(e.getMessage(), e.toString()); + } + } // 声明对象 public static ThreadTask threadTask; @@ -102,20 +119,18 @@ public class ThreadTask { /** * 修改诊断状态 - * - * @param vo * @param key */ - private static void updateFaultState(FdpTaskDTO req, FdpFaultEntity fdpFaultEntity, FdpRealTimeAndHisDataVo vo, String key) { + private static void updateFaultState(FdpTaskDTO req, FdpFaultEntity fdpFaultEntity, String key) { /**更新故障状态**/ DiagnoseFaultAllReq faultAllReq = new DiagnoseFaultAllReq(); - faultAllReq.setAutoData(vo); +// faultAllReq.setAutoData(vo); faultAllReq.setStationId(fdpFaultEntity.getStationId()); DiagnoseFaultReq diagnoseFaultReq = new DiagnoseFaultReq(); diagnoseFaultReq.setTaskId(req.getId().toString()); diagnoseFaultReq.setFaultId(req.getFaultId()); - diagnoseFaultReq.setStatus(1.0); + diagnoseFaultReq.setConfidence(1.0); diagnoseFaultReq.setLifeTime(1); diagnoseFaultReq.setPriority(2); diagnoseFaultReq.setTenantId(fdpFaultEntity.getStationId()); @@ -181,20 +196,18 @@ public class ThreadTask { /** * 修改诊断状态 - * - * @param vo * @param key */ - private static void updateFaultStateNew(FdpTaskDTO req, FdpFaultEntity fdpFaultEntity, FdpRealTimeAndHisDataVo vo, String key) { + private static void updateFaultStateNew(FdpTaskDTO req, FdpFaultEntity fdpFaultEntity, String key) { /**更新故障状态**/ DiagnoseFaultAllReq faultAllReq = new DiagnoseFaultAllReq(); - faultAllReq.setAutoData(vo); +// faultAllReq.setAutoData(vo); faultAllReq.setStationId(fdpFaultEntity.getStationId()); DiagnoseFaultReq diagnoseFaultReq = new DiagnoseFaultReq(); diagnoseFaultReq.setTaskId(req.getId().toString()); diagnoseFaultReq.setFaultId(req.getFaultId()); - diagnoseFaultReq.setStatus(1.0); + diagnoseFaultReq.setConfidence(1.0); diagnoseFaultReq.setLifeTime(1); diagnoseFaultReq.setPriority(2); diagnoseFaultReq.setTenantId(fdpFaultEntity.getStationId()); diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java index 95d8f2f..e36e698 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java @@ -1,6 +1,5 @@ package com.hnac.hzims.fdp.service; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.fdp.dto.FdpMonitorDTO; import com.hnac.hzims.fdp.dto.FdpMonitorExtendDTO; @@ -148,7 +147,7 @@ public interface IFdpMonitorService extends BaseService { R updateFaultState(@RequestBody DiagnoseFaultReq diagnoseFaultReq); - R getRealTimeHisData(@RequestBody FdpTaskDTO taskDTO); +// R getRealTimeHisData(@RequestBody FdpTaskDTO taskDTO); R getRealTimeHisDataNew(@RequestBody FdpTaskDTO taskDTO); 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 4bcb9c1..80df684 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 @@ -418,32 +418,32 @@ 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("获取对应故障对象失败"); - } - /**获取实时、历史数据**/ - FdpRealTimeAndHisDataVo pushResp = this.dataPushByPartition(fdpFaultEntity.getFdpPartition(), fdpFaultEntity.getCreateDept()); - - - //String key = UUID.randomUUID().toString(); - boolean flag = fdpTaskService.save(taskDTO); - if (!flag) { - return R.fail("诊断任务保存失败"); - } - String key = taskDTO.getId().toString(); - //异步处理 - ThreadTask.fdpTask(taskDTO, fdpFaultEntity, pushResp, key); - //获取数据成功-》 告知前端 - Map map = new HashMap<>(); - map.put("id", key); - return R.data(map); - } +// @Override +// public R getRealTimeHisData(FdpTaskDTO taskDTO) { +// /**获取故障对象**/ +// 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("获取对应故障对象失败"); +// } +// /**获取实时、历史数据**/ +// FdpRealTimeAndHisDataVo pushResp = this.dataPushByPartition(fdpFaultEntity.getFdpPartition(), fdpFaultEntity.getCreateDept()); +// +// +// //String key = UUID.randomUUID().toString(); +// boolean flag = fdpTaskService.save(taskDTO); +// if (!flag) { +// return R.fail("诊断任务保存失败"); +// } +// String key = taskDTO.getId().toString(); +// //异步处理 +// ThreadTask.fdpTask(taskDTO, fdpFaultEntity, pushResp, key); +// //获取数据成功-》 告知前端 +// Map map = new HashMap<>(); +// map.put("id", key); +// return R.data(map); +// } @Override public R getRealTimeHisDataNew(FdpTaskDTO taskDTO) { @@ -456,14 +456,14 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl map = new HashMap<>(); map.put("id", key); @@ -582,7 +582,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl