diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/vo/DetectionData.java b/detection/src/main/java/com/njcn/gather/detection/pojo/vo/DetectionData.java index 6c352a72..aecdceaa 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/vo/DetectionData.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/vo/DetectionData.java @@ -3,6 +3,8 @@ package com.njcn.gather.detection.pojo.vo; import lombok.Data; +import java.math.BigDecimal; + /** * @author wr * @description @@ -37,4 +39,9 @@ public class DetectionData { */ private String radius; + /** + * 误差值 + */ + private BigDecimal errorData; + } diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java index 6ab05e61..725726fc 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java @@ -35,6 +35,7 @@ import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; + /** * @author wr * @description @@ -888,10 +889,16 @@ public class DetectionServiceImpl { List qualifiedList = harmDataList.stream() .filter(x -> v == 0 ? NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()), BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()), - BigDecimal.valueOf(errSysDtl.getMaxErrorValue())) : + BigDecimal.valueOf(errSysDtl.getMaxErrorValue())) + : x != 0 && NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()), BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()), BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(qualifiedList)) { + data.setErrorData(devSubtractChannelData(qualifiedList.get(0), v, errSysDtl.getErrorValueType())); + } else { + data.setErrorData(devSubtractChannelData(harmDataList.get(0), v, errSysDtl.getErrorValueType())); + } isData(dataRule, harmDataList, data, qualifiedList); } @@ -1072,6 +1079,13 @@ public class DetectionServiceImpl { BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())), BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue()))) ).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(qualifiedList)) { + Double a = qualifiedList.get(0) - (1.0 / data * (channelData - errSysDtl.getMaxErrorValue())); + detectionData.setErrorData(BigDecimal.valueOf(Math.abs(a))); + } else { + Double a = list.get(0) - (1.0 / data * (channelData - errSysDtl.getMaxErrorValue())); + detectionData.setErrorData(BigDecimal.valueOf(Math.abs(a))); + } isData(dataRule, qualifiedList, detectionData, qualifiedList); } } diff --git a/detection/src/main/java/com/njcn/gather/device/pojo/constant/DevValidMessage.java b/detection/src/main/java/com/njcn/gather/device/pojo/constant/DevValidMessage.java index 7b634137..02363996 100644 --- a/detection/src/main/java/com/njcn/gather/device/pojo/constant/DevValidMessage.java +++ b/detection/src/main/java/com/njcn/gather/device/pojo/constant/DevValidMessage.java @@ -85,6 +85,8 @@ public interface DevValidMessage { String STANDARD_TIME_NOT_BLANK = "标准推行时间不能为空,请检查standardTime参数"; String SCRIPT_TYPE_FORMAT_ERROR = "检测脚本类型格式错误,请检查scriptType参数"; + String SCRIPT_VOLT_FORMAT_ERROR = "检测脚本额定电压格式错误,请检查scriptType参数"; + String SCRIPT_CURR_FORMAT_ERROR = "检测脚本额定电流格式错误,请检查scriptType参数"; String DEV_LEVEL_NOT_BLANK = "设备等级不能为空,请检查devLevel参数"; diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java index c99634a6..c387b110 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java @@ -57,20 +57,20 @@ public class PqScriptParam { /** * 额定电压 */ -// @ApiModelProperty("额定电压") -// @NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) -// @Min(value = 0, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) -// @Max(value = 380, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) -// private Double ratedVolt; + @ApiModelProperty("额定电压") + @NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) + @Min(value = 0, message = DevValidMessage.SCRIPT_VOLT_FORMAT_ERROR) + @Max(value = 380, message = DevValidMessage.SCRIPT_VOLT_FORMAT_ERROR) + private Double ratedVolt; /** * 额定电流 */ -// @ApiModelProperty("额定电流") -// @NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) -// @Min(value = 0, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) -// @Max(value = 20, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) -// private Double ratedCurr; + @ApiModelProperty("额定电流") + @NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) + @Min(value = 0, message = DevValidMessage.SCRIPT_CURR_FORMAT_ERROR) + @Max(value = 20, message = DevValidMessage.SCRIPT_CURR_FORMAT_ERROR) + private Double ratedCurr; @Data diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScript.java b/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScript.java index cafd9647..9a06053c 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScript.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScript.java @@ -66,12 +66,12 @@ public class PqScript extends BaseEntity implements Serializable { /** * 额定电压 */ -// private Double ratedVolt; + private Double ratedVolt; /** * 额定电流 */ -// private Double ratedCurr; + private Double ratedCurr; /** * 状态:0-删除 1-正常 diff --git a/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawResultDataVO.java b/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawResultDataVO.java index 0ccdec94..726877d9 100644 --- a/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawResultDataVO.java +++ b/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawResultDataVO.java @@ -82,5 +82,9 @@ public class RawResultDataVO { */ private String radius; + /** + * 误差值 + */ + private BigDecimal errorData; } }