From ccd33fa7b036810b1ef77bb4dd7f174b043d4f1e Mon Sep 17 00:00:00 2001 From: huangfeng Date: Mon, 1 Jul 2024 14:01:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3icd=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E7=9A=84eqmid=E6=94=B9=E7=94=A8sensorId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cac/controller/ParamBindController.java | 17 ++++++------ .../java/com/xydl/cac/model/BindDetail.java | 4 +-- .../java/com/xydl/cac/model/BindingModel.java | 6 ++--- .../xydl/cac/service/ParamBindService.java | 4 +-- .../service/impl/ParamBindServiceImpl.java | 26 +++++++++---------- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/xydl/cac/controller/ParamBindController.java b/src/main/java/com/xydl/cac/controller/ParamBindController.java index fee28e1..407a7a9 100644 --- a/src/main/java/com/xydl/cac/controller/ParamBindController.java +++ b/src/main/java/com/xydl/cac/controller/ParamBindController.java @@ -2,7 +2,6 @@ package com.xydl.cac.controller; import com.xydl.cac.entity.Bdz; import com.xydl.cac.entity.IcdConfigTypeInst; -import com.xydl.cac.entity.Rptparamindex; import com.xydl.cac.exception.BusinessException; import com.xydl.cac.model.BindDetail; import com.xydl.cac.model.BindingModel; @@ -57,21 +56,21 @@ public class ParamBindController extends BasicController { @PostMapping("unbind") @ApiOperation("解绑") - public Response unbind(@Validated @NotNull(message = "eqmid不能为空!") @Param("eqmid") Integer eqmid) throws Exception { - if (eqmid == null) { - throw new BusinessException("eqmid不能为空!"); + public Response unbind(@Validated @NotNull(message = "sensorId不能为空!") @Param("sensorId") Integer sensorId) throws Exception { + if (sensorId == null) { + throw new BusinessException("sensorId不能为空!"); } - bindService.unbind(eqmid); + bindService.unbind(sensorId); return Response.success("OK"); } @GetMapping("getBind") @ApiOperation("查询绑定信息") - public Response getBind(@Validated @NotNull(message = "eqmid不能为空!") @Param("eqmid") Integer eqmid) throws Exception { - if (eqmid == null) { - throw new BusinessException("eqmid不能为空!"); + public Response getBind(@Validated @NotNull(message = "sensorId不能为空!") @Param("sensorId") Integer sensorId) throws Exception { + if (sensorId == null) { + throw new BusinessException("sensorId不能为空!"); } - BindDetail result = bindService.getBind(eqmid); + BindDetail result = bindService.getBind(sensorId); return Response.success(result); } diff --git a/src/main/java/com/xydl/cac/model/BindDetail.java b/src/main/java/com/xydl/cac/model/BindDetail.java index 8d207e1..d103d76 100644 --- a/src/main/java/com/xydl/cac/model/BindDetail.java +++ b/src/main/java/com/xydl/cac/model/BindDetail.java @@ -8,8 +8,8 @@ import java.util.List; @Data public class BindDetail { - @ApiModelProperty("eqmid") - Integer eqmid; + @ApiModelProperty("sensorId") + Integer sensorId; @ApiModelProperty("逻辑设备实例的Id") Integer icdid; @ApiModelProperty("iedName") diff --git a/src/main/java/com/xydl/cac/model/BindingModel.java b/src/main/java/com/xydl/cac/model/BindingModel.java index f04a9f1..0ca99f6 100644 --- a/src/main/java/com/xydl/cac/model/BindingModel.java +++ b/src/main/java/com/xydl/cac/model/BindingModel.java @@ -7,9 +7,9 @@ import javax.validation.constraints.NotNull; @Data public class BindingModel { - @NotNull(message = "eqmid不能为空") - @ApiModelProperty("eqmid") - Integer eqmid; + @NotNull(message = "sensorId不能为空") + @ApiModelProperty("sensorId") + Integer sensorId; @NotNull(message = "逻辑设备实例的Id不能为空") @ApiModelProperty("逻辑设备实例的Id") Integer icdid; diff --git a/src/main/java/com/xydl/cac/service/ParamBindService.java b/src/main/java/com/xydl/cac/service/ParamBindService.java index 1556d96..3e3b22e 100644 --- a/src/main/java/com/xydl/cac/service/ParamBindService.java +++ b/src/main/java/com/xydl/cac/service/ParamBindService.java @@ -20,9 +20,9 @@ public interface ParamBindService { void bind(BindingModel item) throws Exception; - void unbind(Integer eqmid) throws Exception; + void unbind(Integer sensorId) throws Exception; - BindDetail getBind(Integer eqmid) throws Exception; + BindDetail getBind(Integer sensorId) throws Exception; String generateParamindex() throws Exception; diff --git a/src/main/java/com/xydl/cac/service/impl/ParamBindServiceImpl.java b/src/main/java/com/xydl/cac/service/impl/ParamBindServiceImpl.java index 9e9e824..a4c3228 100644 --- a/src/main/java/com/xydl/cac/service/impl/ParamBindServiceImpl.java +++ b/src/main/java/com/xydl/cac/service/impl/ParamBindServiceImpl.java @@ -134,9 +134,9 @@ public class ParamBindServiceImpl implements ParamBindService { @Override public Response preview(BindingModel item) throws Exception { - Optional optionalNSensor = sensorRepository.findById(item.getEqmid()); + Optional optionalNSensor = sensorRepository.findById(item.getSensorId()); if (!optionalNSensor.isPresent()) { - throw new BusinessException("未找到该监测装置, eqmid=" + item.getEqmid()); + throw new BusinessException("未找到该监测装置, sensorId=" + item.getSensorId()); } NSensor sensor = optionalNSensor.get(); if (sensor.getTypeId() == null) { @@ -187,9 +187,9 @@ public class ParamBindServiceImpl implements ParamBindService { @Override public void bind(BindingModel item) throws Exception { - Optional optionalNSensor = sensorRepository.findById(item.getEqmid()); + Optional optionalNSensor = sensorRepository.findById(item.getSensorId()); if (!optionalNSensor.isPresent()) { - throw new BusinessException("未找到该监测装置, eqmid=" + item.getEqmid()); + throw new BusinessException("未找到该监测装置, sensorId=" + item.getSensorId()); } NSensor sensor = optionalNSensor.get(); @@ -204,7 +204,7 @@ public class ParamBindServiceImpl implements ParamBindService { } IcdConfigType type = optionalType.get(); - List list = sensorRepository.findByIcdIdAndIdIsNot(item.getIcdid(), item.getEqmid()); + List list = sensorRepository.findByIcdIdAndIdIsNot(item.getIcdid(), item.getSensorId()); if (!CollectionUtils.isEmpty(list)) { throw new BusinessException("该逻辑设备实例已被" + list.get(0).getName() + "绑定"); } @@ -235,10 +235,10 @@ public class ParamBindServiceImpl implements ParamBindService { } @Override - public void unbind(Integer eqmid) throws Exception { - Optional optionalNSensor = sensorRepository.findById(eqmid); + public void unbind(Integer sensorId) throws Exception { + Optional optionalNSensor = sensorRepository.findById(sensorId); if (!optionalNSensor.isPresent()) { - throw new BusinessException("未找到该监测装置, eqmid=" + eqmid); + throw new BusinessException("未找到该监测装置, sensorId=" + sensorId); } NSensor sensor = optionalNSensor.get(); sensor.setIcdId(null); @@ -246,8 +246,8 @@ public class ParamBindServiceImpl implements ParamBindService { } @Override - public BindDetail getBind(Integer eqmid) throws Exception { - Optional optionalNSensor = sensorRepository.findById(eqmid); + public BindDetail getBind(Integer sensorId) throws Exception { + Optional optionalNSensor = sensorRepository.findById(sensorId); if (!optionalNSensor.isPresent()) { throw new BusinessException("未找到该监测装置"); } @@ -256,7 +256,7 @@ public class ParamBindServiceImpl implements ParamBindService { sensor.setTableName(modevType.getTablename()); BindDetail result = new BindDetail(); - result.setEqmid(eqmid); + result.setSensorId(sensorId); if (StringUtils.isNotBlank(sensor.getTableName())) { List columnList = dataService.getDataTableColumns(sensor.getTableName()); result.setColumnList(columnList); @@ -297,7 +297,7 @@ public class ParamBindServiceImpl implements ParamBindService { private void generateOne(NSensor item) throws Exception { Optional optionalInst = instRepository.findById(item.getIcdId()); if (!optionalInst.isPresent()) { - throw new BusinessException("未找到该ICD逻辑设备实例, eqmid=" + item.getId() + ", icdid=" + item.getIcdId()); + throw new BusinessException("未找到该ICD逻辑设备实例, sensorId=" + item.getId() + ", icdid=" + item.getIcdId()); } IcdConfigTypeInst inst = optionalInst.get(); Optional optionalType = typeRepository.findById(inst.getIcdConfigTypeId()); @@ -319,7 +319,7 @@ public class ParamBindServiceImpl implements ParamBindService { Rptparamindex rpt = optionalRpt.get(); rpt.setTablename(type.getTableName()); rpt.setColname(att.getColName()); - rpt.setEqmid(item.getId()); + rpt.setEqmid(item.getDevId()); rptparamindexRepository.save(rpt); } }