fix: 修正icd绑定的eqmid改用sensorId

dev
huangfeng 12 months ago
parent 69f6c83d90
commit ccd33fa7b0

@ -2,7 +2,6 @@ package com.xydl.cac.controller;
import com.xydl.cac.entity.Bdz; import com.xydl.cac.entity.Bdz;
import com.xydl.cac.entity.IcdConfigTypeInst; import com.xydl.cac.entity.IcdConfigTypeInst;
import com.xydl.cac.entity.Rptparamindex;
import com.xydl.cac.exception.BusinessException; import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.model.BindDetail; import com.xydl.cac.model.BindDetail;
import com.xydl.cac.model.BindingModel; import com.xydl.cac.model.BindingModel;
@ -57,21 +56,21 @@ public class ParamBindController extends BasicController {
@PostMapping("unbind") @PostMapping("unbind")
@ApiOperation("解绑") @ApiOperation("解绑")
public Response<String> unbind(@Validated @NotNull(message = "eqmid不能为空!") @Param("eqmid") Integer eqmid) throws Exception { public Response<String> unbind(@Validated @NotNull(message = "sensorId不能为空!") @Param("sensorId") Integer sensorId) throws Exception {
if (eqmid == null) { if (sensorId == null) {
throw new BusinessException("eqmid不能为空!"); throw new BusinessException("sensorId不能为空!");
} }
bindService.unbind(eqmid); bindService.unbind(sensorId);
return Response.success("OK"); return Response.success("OK");
} }
@GetMapping("getBind") @GetMapping("getBind")
@ApiOperation("查询绑定信息") @ApiOperation("查询绑定信息")
public Response<BindDetail> getBind(@Validated @NotNull(message = "eqmid不能为空!") @Param("eqmid") Integer eqmid) throws Exception { public Response<BindDetail> getBind(@Validated @NotNull(message = "sensorId不能为空!") @Param("sensorId") Integer sensorId) throws Exception {
if (eqmid == null) { if (sensorId == null) {
throw new BusinessException("eqmid不能为空!"); throw new BusinessException("sensorId不能为空!");
} }
BindDetail result = bindService.getBind(eqmid); BindDetail result = bindService.getBind(sensorId);
return Response.success(result); return Response.success(result);
} }

@ -8,8 +8,8 @@ import java.util.List;
@Data @Data
public class BindDetail { public class BindDetail {
@ApiModelProperty("eqmid") @ApiModelProperty("sensorId")
Integer eqmid; Integer sensorId;
@ApiModelProperty("逻辑设备实例的Id") @ApiModelProperty("逻辑设备实例的Id")
Integer icdid; Integer icdid;
@ApiModelProperty("iedName") @ApiModelProperty("iedName")

@ -7,9 +7,9 @@ import javax.validation.constraints.NotNull;
@Data @Data
public class BindingModel { public class BindingModel {
@NotNull(message = "eqmid不能为空") @NotNull(message = "sensorId不能为空")
@ApiModelProperty("eqmid") @ApiModelProperty("sensorId")
Integer eqmid; Integer sensorId;
@NotNull(message = "逻辑设备实例的Id不能为空") @NotNull(message = "逻辑设备实例的Id不能为空")
@ApiModelProperty("逻辑设备实例的Id") @ApiModelProperty("逻辑设备实例的Id")
Integer icdid; Integer icdid;

@ -20,9 +20,9 @@ public interface ParamBindService {
void bind(BindingModel item) throws Exception; 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; String generateParamindex() throws Exception;

@ -134,9 +134,9 @@ public class ParamBindServiceImpl implements ParamBindService {
@Override @Override
public Response preview(BindingModel item) throws Exception { public Response preview(BindingModel item) throws Exception {
Optional<NSensor> optionalNSensor = sensorRepository.findById(item.getEqmid()); Optional<NSensor> optionalNSensor = sensorRepository.findById(item.getSensorId());
if (!optionalNSensor.isPresent()) { if (!optionalNSensor.isPresent()) {
throw new BusinessException("未找到该监测装置, eqmid=" + item.getEqmid()); throw new BusinessException("未找到该监测装置, sensorId=" + item.getSensorId());
} }
NSensor sensor = optionalNSensor.get(); NSensor sensor = optionalNSensor.get();
if (sensor.getTypeId() == null) { if (sensor.getTypeId() == null) {
@ -187,9 +187,9 @@ public class ParamBindServiceImpl implements ParamBindService {
@Override @Override
public void bind(BindingModel item) throws Exception { public void bind(BindingModel item) throws Exception {
Optional<NSensor> optionalNSensor = sensorRepository.findById(item.getEqmid()); Optional<NSensor> optionalNSensor = sensorRepository.findById(item.getSensorId());
if (!optionalNSensor.isPresent()) { if (!optionalNSensor.isPresent()) {
throw new BusinessException("未找到该监测装置, eqmid=" + item.getEqmid()); throw new BusinessException("未找到该监测装置, sensorId=" + item.getSensorId());
} }
NSensor sensor = optionalNSensor.get(); NSensor sensor = optionalNSensor.get();
@ -204,7 +204,7 @@ public class ParamBindServiceImpl implements ParamBindService {
} }
IcdConfigType type = optionalType.get(); IcdConfigType type = optionalType.get();
List<NSensor> list = sensorRepository.findByIcdIdAndIdIsNot(item.getIcdid(), item.getEqmid()); List<NSensor> list = sensorRepository.findByIcdIdAndIdIsNot(item.getIcdid(), item.getSensorId());
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
throw new BusinessException("该逻辑设备实例已被" + list.get(0).getName() + "绑定"); throw new BusinessException("该逻辑设备实例已被" + list.get(0).getName() + "绑定");
} }
@ -235,10 +235,10 @@ public class ParamBindServiceImpl implements ParamBindService {
} }
@Override @Override
public void unbind(Integer eqmid) throws Exception { public void unbind(Integer sensorId) throws Exception {
Optional<NSensor> optionalNSensor = sensorRepository.findById(eqmid); Optional<NSensor> optionalNSensor = sensorRepository.findById(sensorId);
if (!optionalNSensor.isPresent()) { if (!optionalNSensor.isPresent()) {
throw new BusinessException("未找到该监测装置, eqmid=" + eqmid); throw new BusinessException("未找到该监测装置, sensorId=" + sensorId);
} }
NSensor sensor = optionalNSensor.get(); NSensor sensor = optionalNSensor.get();
sensor.setIcdId(null); sensor.setIcdId(null);
@ -246,8 +246,8 @@ public class ParamBindServiceImpl implements ParamBindService {
} }
@Override @Override
public BindDetail getBind(Integer eqmid) throws Exception { public BindDetail getBind(Integer sensorId) throws Exception {
Optional<NSensor> optionalNSensor = sensorRepository.findById(eqmid); Optional<NSensor> optionalNSensor = sensorRepository.findById(sensorId);
if (!optionalNSensor.isPresent()) { if (!optionalNSensor.isPresent()) {
throw new BusinessException("未找到该监测装置"); throw new BusinessException("未找到该监测装置");
} }
@ -256,7 +256,7 @@ public class ParamBindServiceImpl implements ParamBindService {
sensor.setTableName(modevType.getTablename()); sensor.setTableName(modevType.getTablename());
BindDetail result = new BindDetail(); BindDetail result = new BindDetail();
result.setEqmid(eqmid); result.setSensorId(sensorId);
if (StringUtils.isNotBlank(sensor.getTableName())) { if (StringUtils.isNotBlank(sensor.getTableName())) {
List<ColumnModel> columnList = dataService.getDataTableColumns(sensor.getTableName()); List<ColumnModel> columnList = dataService.getDataTableColumns(sensor.getTableName());
result.setColumnList(columnList); result.setColumnList(columnList);
@ -297,7 +297,7 @@ public class ParamBindServiceImpl implements ParamBindService {
private void generateOne(NSensor item) throws Exception { private void generateOne(NSensor item) throws Exception {
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(item.getIcdId()); Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(item.getIcdId());
if (!optionalInst.isPresent()) { 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(); IcdConfigTypeInst inst = optionalInst.get();
Optional<IcdConfigType> optionalType = typeRepository.findById(inst.getIcdConfigTypeId()); Optional<IcdConfigType> optionalType = typeRepository.findById(inst.getIcdConfigTypeId());
@ -319,7 +319,7 @@ public class ParamBindServiceImpl implements ParamBindService {
Rptparamindex rpt = optionalRpt.get(); Rptparamindex rpt = optionalRpt.get();
rpt.setTablename(type.getTableName()); rpt.setTablename(type.getTableName());
rpt.setColname(att.getColName()); rpt.setColname(att.getColName());
rpt.setEqmid(item.getId()); rpt.setEqmid(item.getDevId());
rptparamindexRepository.save(rpt); rptparamindexRepository.save(rpt);
} }
} }

Loading…
Cancel
Save